From 5e3d71c6c53b8bafc8fdc43a8d3a279d4708b663 Mon Sep 17 00:00:00 2001 From: len Date: Sun, 9 Apr 2017 15:53:47 +0200 Subject: [PATCH] Fix shortcuts --- .../java/eu/kanade/tachiyomi/ui/main/MainActivity.kt | 6 +++--- .../tachiyomi/ui/manga/info/MangaInfoPresenter.kt | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index e841c83c7..e5fbb5c6f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -37,8 +37,8 @@ class MainActivity : BaseActivity() { setAppTheme() super.onCreate(savedState) - // Do not let the launcher create a new activity - if (intent.flags and Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT != 0) { + // Do not let the launcher create a new activity http://stackoverflow.com/questions/16283079 + if (!isTaskRoot) { finish() return } @@ -154,7 +154,7 @@ class MainActivity : BaseActivity() { // Shortcut actions private const val SHORTCUT_LIBRARY = "eu.kanade.tachiyomi.SHOW_LIBRARY" private const val SHORTCUT_RECENTLY_UPDATED = "eu.kanade.tachiyomi.SHOW_RECENTLY_UPDATED" - private const val SHORTCUT_RECENTLY_READ = "eu.kanade.tachiyomi.RECENTLY_READ" + private const val SHORTCUT_RECENTLY_READ = "eu.kanade.tachiyomi.SHOW_RECENTLY_READ" private const val SHORTCUT_CATALOGUES = "eu.kanade.tachiyomi.SHOW_CATALOGUES" } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoPresenter.kt index 52f8be360..f0f896346 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoPresenter.kt @@ -18,7 +18,6 @@ import rx.Subscription import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import uy.kohesive.injekt.injectLazy -import java.util.ArrayList /** * Presenter of MangaInfoFragment. @@ -79,9 +78,12 @@ class MangaInfoPresenter : BasePresenter() { ?.subscribeLatestCache(MangaInfoFragment::setChapterCount) // Update favorite status - SharedData.get(MangaFavoriteEvent::class.java)?.observable - ?.observeOn(AndroidSchedulers.mainThread()) - ?.subscribe { setFavorite(it) } + SharedData.get(MangaFavoriteEvent::class.java)?.let { + it.observable + .observeOn(AndroidSchedulers.mainThread()) + .subscribe { setFavorite(it) } + .apply { add(this) } + } } /**