Skip to content

Commit

Permalink
fix: When no further fragment is visible, the app should close itself (
Browse files Browse the repository at this point in the history
  • Loading branch information
g123k committed Oct 24, 2021
1 parent afd8056 commit 8ae0954
Showing 1 changed file with 11 additions and 8 deletions.
Expand Up @@ -628,15 +628,18 @@ class MainActivity : BaseActivity(), NavigationDrawerListener {
// activity
if (drawerResult.isDrawerOpen) {
drawerResult.closeDrawer()
} else if (supportFragmentManager.backStackEntryCount > 0) {
supportFragmentManager.popBackStackImmediate(
supportFragmentManager.getBackStackEntryAt(0).id,
FragmentManager.POP_BACK_STACK_INCLUSIVE
)

// Close the app if no Fragment is visible anymore
if (supportFragmentManager.backStackEntryCount == 0) {
super.onBackPressed()
}
} else {
if (supportFragmentManager.backStackEntryCount > 0) {
supportFragmentManager.popBackStack(
supportFragmentManager.getBackStackEntryAt(0).id,
FragmentManager.POP_BACK_STACK_INCLUSIVE
)
// Recreate the activity onBackPressed
recreate()
} else super.onBackPressed()
super.onBackPressed()
}
}

Expand Down

0 comments on commit 8ae0954

Please sign in to comment.