Fix recents intent for latest chapters and history

This commit is contained in:
Jays2Kings 2021-04-11 12:35:43 -04:00
parent 780585caed
commit 283808a865
2 changed files with 20 additions and 9 deletions

View File

@ -476,17 +476,28 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), 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

View File

@ -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))
}