From 719aa751b89038fa529082b2366ca3ef03ff2287 Mon Sep 17 00:00:00 2001 From: Jay Date: Wed, 25 Mar 2020 00:48:24 -0400 Subject: [PATCH] Fixed extensions notifcation action --- .../kanade/tachiyomi/ui/main/MainActivity.kt | 36 +++++++------------ .../tachiyomi/ui/manga/MangaHeaderHolder.kt | 2 +- 2 files changed, 13 insertions(+), 25 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 12b036c895..5272a8ae2c 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 @@ -31,7 +31,6 @@ import com.bluelinelabs.conductor.ControllerChangeHandler import com.bluelinelabs.conductor.Router import com.bluelinelabs.conductor.RouterTransaction import com.bluelinelabs.conductor.changehandler.FadeChangeHandler -import com.bluelinelabs.conductor.changehandler.SimpleSwapChangeHandler import com.google.android.material.snackbar.Snackbar import eu.kanade.tachiyomi.BuildConfig import eu.kanade.tachiyomi.Migrations @@ -62,9 +61,6 @@ import eu.kanade.tachiyomi.util.system.launchUI import eu.kanade.tachiyomi.util.view.doOnApplyWindowInsets import eu.kanade.tachiyomi.util.view.updateLayoutParams import eu.kanade.tachiyomi.util.view.updatePadding -import java.util.Date -import java.util.concurrent.TimeUnit -import kotlin.math.abs import kotlinx.android.synthetic.main.main_activity.* import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.GlobalScope @@ -72,6 +68,9 @@ import kotlinx.coroutines.delay import kotlinx.coroutines.launch import timber.log.Timber import uy.kohesive.injekt.injectLazy +import java.util.Date +import java.util.concurrent.TimeUnit +import kotlin.math.abs open class MainActivity : BaseActivity(), DownloadServiceListener { @@ -394,34 +393,23 @@ open class MainActivity : BaseActivity(), DownloadServiceListener { } SHORTCUT_CATALOGUES -> bottom_nav.selectedItemId = R.id.nav_catalogues SHORTCUT_EXTENSIONS -> { - if (router.backstack.isEmpty()) { - bottom_nav.selectedItemId = R.id.nav_catalogues - bottom_nav.post { - val controller = - router.backstack.firstOrNull()?.controller() as? CatalogueController - controller?.showExtensions() - } + bottom_nav.selectedItemId = R.id.nav_catalogues + router.popToRoot() + bottom_nav.post { + val controller = + router.backstack.firstOrNull()?.controller() as? CatalogueController + controller?.showExtensions() } } SHORTCUT_MANGA -> { val extras = intent.extras ?: return false - if (router.backstack.isEmpty()) { - bottom_nav.selectedItemId = R.id.nav_library - } + if (router.backstack.isEmpty()) bottom_nav.selectedItemId = R.id.nav_library router.pushController(MangaDetailsController(extras).withFadeTransaction()) } SHORTCUT_DOWNLOADS -> { if (router.backstack.none { it.controller() is DownloadController }) { - if (router.backstack.isEmpty()) { - bottom_nav.selectedItemId = R.id.nav_library - router.pushController( - RouterTransaction.with(DownloadController()) - .pushChangeHandler(SimpleSwapChangeHandler()) - .popChangeHandler(FadeChangeHandler()) - ) - } else { - router.pushController(DownloadController().withFadeTransaction()) - } + if (router.backstack.isEmpty()) bottom_nav.selectedItemId = R.id.nav_library + router.pushController(DownloadController().withFadeTransaction()) } } Intent.ACTION_SEARCH, "com.google.android.gms.actions.SEARCH_ACTION" -> { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaHeaderHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaHeaderHolder.kt index 3f8d8c98c3..4165d002f1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaHeaderHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaHeaderHolder.kt @@ -24,8 +24,8 @@ import eu.kanade.tachiyomi.util.view.invisible import eu.kanade.tachiyomi.util.view.updateLayoutParams import eu.kanade.tachiyomi.util.view.visible import eu.kanade.tachiyomi.util.view.visibleIf -import kotlinx.android.synthetic.main.manga_header_item.* import java.util.Locale +import kotlinx.android.synthetic.main.manga_header_item.* class MangaHeaderHolder( private val view: View,