mirror of
https://git.mihon.tech/mihonapp/mihon
synced 2024-11-25 22:55:59 +03:00
A few more crashes fixed
This commit is contained in:
parent
72f029b57f
commit
5fbeeade94
5 changed files with 8 additions and 8 deletions
|
@ -237,7 +237,9 @@ class LibraryFragment : BaseRxFragment<LibraryPresenter>(), ActionMode.Callback
|
|||
this.query = query
|
||||
|
||||
// Notify the subject the query has changed.
|
||||
presenter.searchSubject.onNext(query)
|
||||
if (isResumed) {
|
||||
presenter.searchSubject.onNext(query)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -68,7 +68,7 @@ class ChaptersPresenter : BasePresenter<ChaptersFragment>() {
|
|||
{ view, download -> view.onChapterStatusChange(download) },
|
||||
{ view, error -> Timber.e(error.cause, error.message) })
|
||||
|
||||
manga = SharedData.get(MangaEvent::class.java)!!.manga
|
||||
manga = SharedData.get(MangaEvent::class.java)?.manga ?: return
|
||||
add(Observable.just(manga)
|
||||
.subscribeLatestCache({ view, manga -> view.onNextManga(manga) }))
|
||||
|
||||
|
@ -79,9 +79,7 @@ class ChaptersPresenter : BasePresenter<ChaptersFragment>() {
|
|||
.subscribeOn(Schedulers.io())
|
||||
.doOnNext { chapters ->
|
||||
this.chapters = chapters
|
||||
SharedData.get(ChapterCountEvent::class.java)?.let {
|
||||
it.emit(chapters.size)
|
||||
}
|
||||
SharedData.get(ChapterCountEvent::class.java)?.emit(chapters.size)
|
||||
for (chapter in chapters) {
|
||||
setChapterStatus(chapter)
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ class MangaInfoPresenter : BasePresenter<MangaInfoFragment>() {
|
|||
{ view, manga -> view.onFetchMangaDone() },
|
||||
{ view, error -> view.onFetchMangaError() })
|
||||
|
||||
manga = SharedData.get(MangaEvent::class.java)!!.manga
|
||||
manga = SharedData.get(MangaEvent::class.java)?.manga ?: return
|
||||
source = sourceManager.get(manga.source)!!
|
||||
refreshManga()
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ class MyAnimeListPresenter : BasePresenter<MyAnimeListFragment>() {
|
|||
{ view, result -> view.onRefreshDone() },
|
||||
{ view, error -> view.onRefreshError(error) })
|
||||
|
||||
manga = SharedData.get(MangaEvent::class.java)!!.manga
|
||||
manga = SharedData.get(MangaEvent::class.java)?.manga ?: return
|
||||
start(GET_MANGA_SYNC)
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ class ReaderPresenter : BasePresenter<ReaderActivity>() {
|
|||
super.onCreate(savedState)
|
||||
|
||||
if (savedState == null) {
|
||||
val event = SharedData.remove(ReaderEvent::class.java)!!
|
||||
val event = SharedData.remove(ReaderEvent::class.java) ?: return
|
||||
manga = event.manga
|
||||
chapter = event.chapter
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue