Skip to content
Snippets Groups Projects
Commit 7d4f09b8 authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Navigator: Remove backstack option

parent 226dd128
No related branches found
No related tags found
No related merge requests found
......@@ -102,13 +102,12 @@ class Navigator(private val activity: MainActivity,
showFragment(fragment, id, tag)
}
private fun showFragment(fragment: androidx.fragment.app.Fragment, id: Int, tag: String = getTag(id), backTag: String? = null) {
private fun showFragment(fragment: androidx.fragment.app.Fragment, id: Int, tag: String = getTag(id)) {
val fm = activity.supportFragmentManager
if (currentFragment is BaseBrowserFragment && !(currentFragment as BaseBrowserFragment).isRootDirectory)
fm.popBackStackImmediate("root", androidx.fragment.app.FragmentManager.POP_BACK_STACK_INCLUSIVE)
val ft = fm.beginTransaction()
ft.replace(R.id.fragment_placeholder, fragment, tag)
if (backTag !== null) ft.addToBackStack(backTag)
ft.commit()
activity.updateCheckedItem(id)
currentFragment = fragment
......@@ -220,12 +219,12 @@ class Navigator(private val activity: MainActivity,
fragment.setExtensionService(extensionsService)
when {
currentFragment !is ExtensionBrowser -> //case: non-extension to extension root
showFragment(fragment, extensionId, title, null)
showFragment(fragment, extensionId, title)
currentFragmentId == extensionId -> //case: extension root to extension sub dir
showFragment(fragment, extensionId, title, getTag(currentFragmentId))
showFragment(fragment, extensionId, title)
else -> { //case: extension to other extension root
clearBackstackFromClass(ExtensionBrowser::class.java)
showFragment(fragment, extensionId, title, null)
showFragment(fragment, extensionId, title)
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment