mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-01-06 01:20:29 +05:30
improve backstack behavior
This commit is contained in:
parent
72a34dd25e
commit
d4d1087803
@ -136,6 +136,12 @@ class MainActivity : AppCompatActivity() {
|
|||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* don't remove this line
|
||||||
|
* this prevents reselected items at the bottomNav to be duplicated in the backstack
|
||||||
|
*/
|
||||||
|
binding.bottomNav.setOnItemReselectedListener {}
|
||||||
|
|
||||||
binding.toolbar.title = ThemeHelper.getStyledAppName(this)
|
binding.toolbar.title = ThemeHelper.getStyledAppName(this)
|
||||||
|
|
||||||
binding.toolbar.setNavigationOnClickListener {
|
binding.toolbar.setNavigationOnClickListener {
|
||||||
@ -260,13 +266,15 @@ class MainActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onBackPressed() {
|
override fun onBackPressed() {
|
||||||
if (
|
if (binding.mainMotionLayout.progress == 1F) {
|
||||||
binding.mainMotionLayout.progress == 0F
|
|
||||||
) {
|
|
||||||
try {
|
try {
|
||||||
minimizePlayer()
|
minimizePlayer()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
super.onBackPressed()
|
if (navController.currentDestination?.id == startFragmentId) {
|
||||||
|
super.onBackPressed()
|
||||||
|
} else {
|
||||||
|
navController.popBackStack()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (navController.currentDestination?.id == startFragmentId) {
|
} else if (navController.currentDestination?.id == startFragmentId) {
|
||||||
super.onBackPressed()
|
super.onBackPressed()
|
||||||
|
Loading…
Reference in New Issue
Block a user