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 a10b209845..49c938e946 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 @@ -476,17 +476,28 @@ open class MainActivity : BaseActivity(), DownloadServiceLi when (intent.action) { SHORTCUT_LIBRARY -> binding.bottomNav.selectedItemId = R.id.nav_library SHORTCUT_RECENTLY_UPDATED, SHORTCUT_RECENTLY_READ -> { - binding.bottomNav.selectedItemId = R.id.nav_recents - val viewType = when (intent.action) { - SHORTCUT_RECENTLY_UPDATED -> RecentsPresenter.VIEW_TYPE_ONLY_UPDATES - else -> RecentsPresenter.VIEW_TYPE_ONLY_HISTORY + if (binding.bottomNav.selectedItemId != R.id.nav_recents) { + binding.bottomNav.selectedItemId = R.id.nav_recents + } else { + router.popToRoot() + } + binding.bottomNav.post { + val controller = router.backstack.firstOrNull()?.controller() as? RecentsController + controller?.tempJumpTo( + when (intent.action) { + SHORTCUT_RECENTLY_UPDATED -> RecentsPresenter.VIEW_TYPE_ONLY_UPDATES + else -> RecentsPresenter.VIEW_TYPE_ONLY_HISTORY + } + ) } - router.pushController(RecentsController(viewType).withFadeTransaction()) } SHORTCUT_BROWSE -> binding.bottomNav.selectedItemId = R.id.nav_browse SHORTCUT_EXTENSIONS -> { - binding.bottomNav.selectedItemId = R.id.nav_browse - router.popToRoot() + if (binding.bottomNav.selectedItemId != R.id.nav_recents) { + binding.bottomNav.selectedItemId = R.id.nav_browse + } else { + router.popToRoot() + } binding.bottomNav.post { val controller = router.backstack.firstOrNull()?.controller() as? BrowseController diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recents/RecentsController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recents/RecentsController.kt index a6a94af84e..5827664219 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recents/RecentsController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recents/RecentsController.kt @@ -323,7 +323,7 @@ class RecentsController(bundle: Bundle? = null) : return true } if (presenter.preferences.recentsViewType().get() != presenter.viewType) { - tempJumpTo(RecentsPresenter.VIEW_TYPE_GROUP_ALL) + tempJumpTo(presenter.preferences.recentsViewType().get()) return true } return false @@ -440,7 +440,7 @@ class RecentsController(bundle: Bundle? = null) : onItemLongClick(position) } - private fun tempJumpTo(viewType: Int) { + fun tempJumpTo(viewType: Int) { presenter.toggleGroupRecents(viewType, false) activityBinding?.mainTabs?.selectTab(activityBinding?.mainTabs?.getTabAt(viewType)) }