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) { when (intent.action) {
SHORTCUT_LIBRARY -> binding.bottomNav.selectedItemId = R.id.nav_library SHORTCUT_LIBRARY -> binding.bottomNav.selectedItemId = R.id.nav_library
SHORTCUT_RECENTLY_UPDATED, SHORTCUT_RECENTLY_READ -> { SHORTCUT_RECENTLY_UPDATED, SHORTCUT_RECENTLY_READ -> {
binding.bottomNav.selectedItemId = R.id.nav_recents if (binding.bottomNav.selectedItemId != R.id.nav_recents) {
val viewType = when (intent.action) { binding.bottomNav.selectedItemId = R.id.nav_recents
SHORTCUT_RECENTLY_UPDATED -> RecentsPresenter.VIEW_TYPE_ONLY_UPDATES } else {
else -> RecentsPresenter.VIEW_TYPE_ONLY_HISTORY 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_BROWSE -> binding.bottomNav.selectedItemId = R.id.nav_browse
SHORTCUT_EXTENSIONS -> { SHORTCUT_EXTENSIONS -> {
binding.bottomNav.selectedItemId = R.id.nav_browse if (binding.bottomNav.selectedItemId != R.id.nav_recents) {
router.popToRoot() binding.bottomNav.selectedItemId = R.id.nav_browse
} else {
router.popToRoot()
}
binding.bottomNav.post { binding.bottomNav.post {
val controller = val controller =
router.backstack.firstOrNull()?.controller() as? BrowseController router.backstack.firstOrNull()?.controller() as? BrowseController

View File

@ -323,7 +323,7 @@ class RecentsController(bundle: Bundle? = null) :
return true return true
} }
if (presenter.preferences.recentsViewType().get() != presenter.viewType) { if (presenter.preferences.recentsViewType().get() != presenter.viewType) {
tempJumpTo(RecentsPresenter.VIEW_TYPE_GROUP_ALL) tempJumpTo(presenter.preferences.recentsViewType().get())
return true return true
} }
return false return false
@ -440,7 +440,7 @@ class RecentsController(bundle: Bundle? = null) :
onItemLongClick(position) onItemLongClick(position)
} }
private fun tempJumpTo(viewType: Int) { fun tempJumpTo(viewType: Int) {
presenter.toggleGroupRecents(viewType, false) presenter.toggleGroupRecents(viewType, false)
activityBinding?.mainTabs?.selectTab(activityBinding?.mainTabs?.getTabAt(viewType)) activityBinding?.mainTabs?.selectTab(activityBinding?.mainTabs?.getTabAt(viewType))
} }