A few more crashes fixed

This commit is contained in:
len 2016-04-08 22:57:31 +02:00
parent 72f029b57f
commit 5fbeeade94
5 changed files with 8 additions and 8 deletions

View File

@ -237,7 +237,9 @@ class LibraryFragment : BaseRxFragment<LibraryPresenter>(), ActionMode.Callback
this.query = query this.query = query
// Notify the subject the query has changed. // Notify the subject the query has changed.
presenter.searchSubject.onNext(query) if (isResumed) {
presenter.searchSubject.onNext(query)
}
} }
/** /**

View File

@ -68,7 +68,7 @@ class ChaptersPresenter : BasePresenter<ChaptersFragment>() {
{ view, download -> view.onChapterStatusChange(download) }, { view, download -> view.onChapterStatusChange(download) },
{ view, error -> Timber.e(error.cause, error.message) }) { 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) add(Observable.just(manga)
.subscribeLatestCache({ view, manga -> view.onNextManga(manga) })) .subscribeLatestCache({ view, manga -> view.onNextManga(manga) }))
@ -79,9 +79,7 @@ class ChaptersPresenter : BasePresenter<ChaptersFragment>() {
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnNext { chapters -> .doOnNext { chapters ->
this.chapters = chapters this.chapters = chapters
SharedData.get(ChapterCountEvent::class.java)?.let { SharedData.get(ChapterCountEvent::class.java)?.emit(chapters.size)
it.emit(chapters.size)
}
for (chapter in chapters) { for (chapter in chapters) {
setChapterStatus(chapter) setChapterStatus(chapter)
} }

View File

@ -73,7 +73,7 @@ class MangaInfoPresenter : BasePresenter<MangaInfoFragment>() {
{ view, manga -> view.onFetchMangaDone() }, { view, manga -> view.onFetchMangaDone() },
{ view, error -> view.onFetchMangaError() }) { view, error -> view.onFetchMangaError() })
manga = SharedData.get(MangaEvent::class.java)!!.manga manga = SharedData.get(MangaEvent::class.java)?.manga ?: return
source = sourceManager.get(manga.source)!! source = sourceManager.get(manga.source)!!
refreshManga() refreshManga()

View File

@ -58,7 +58,7 @@ class MyAnimeListPresenter : BasePresenter<MyAnimeListFragment>() {
{ view, result -> view.onRefreshDone() }, { view, result -> view.onRefreshDone() },
{ view, error -> view.onRefreshError(error) }) { view, error -> view.onRefreshError(error) })
manga = SharedData.get(MangaEvent::class.java)!!.manga manga = SharedData.get(MangaEvent::class.java)?.manga ?: return
start(GET_MANGA_SYNC) start(GET_MANGA_SYNC)
} }

View File

@ -71,7 +71,7 @@ class ReaderPresenter : BasePresenter<ReaderActivity>() {
super.onCreate(savedState) super.onCreate(savedState)
if (savedState == null) { if (savedState == null) {
val event = SharedData.remove(ReaderEvent::class.java)!! val event = SharedData.remove(ReaderEvent::class.java) ?: return
manga = event.manga manga = event.manga
chapter = event.chapter chapter = event.chapter
} else { } else {