mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-29 06:57:38 +00:00
Fixed core UI elements not behaving properly after recreating
This commit is contained in:
parent
6379108a75
commit
8a86b30fd1
@ -85,6 +85,10 @@ open class MainActivity : CompatActivity<MainViewModel, ActivityMainMd2Binding>(
|
||||
if (savedInstanceState != null) {
|
||||
onTabTransaction(null, -1)
|
||||
onFragmentTransaction(null, FragNavController.TransactionType.PUSH)
|
||||
|
||||
if (!navigation.isRoot) {
|
||||
requestNavigationHidden(animate = false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,6 +122,11 @@ open class MainActivity : CompatActivity<MainViewModel, ActivityMainMd2Binding>(
|
||||
fragment: Fragment?,
|
||||
transactionType: FragNavController.TransactionType
|
||||
) {
|
||||
binding.mainToolbarWrapper.animate()
|
||||
.translationY(0f)
|
||||
.setInterpolator(FastOutSlowInInterpolator())
|
||||
.start()
|
||||
|
||||
setDisplayHomeAsUpEnabled(!navigation.isRoot)
|
||||
requestNavigationHidden(!navigation.isRoot)
|
||||
}
|
||||
@ -134,13 +143,19 @@ open class MainActivity : CompatActivity<MainViewModel, ActivityMainMd2Binding>(
|
||||
}
|
||||
}
|
||||
|
||||
internal fun requestNavigationHidden(hide: Boolean = true) {
|
||||
internal fun requestNavigationHidden(hide: Boolean = true, animate: Boolean = true) {
|
||||
val lapam = binding.mainBottomBar.layoutParams as ViewGroup.MarginLayoutParams
|
||||
val height = binding.mainBottomBar.measuredHeight
|
||||
val verticalMargin = lapam.let { it.topMargin + it.bottomMargin }
|
||||
val maxTranslation = height + verticalMargin
|
||||
val translation = if (!hide) 0 else maxTranslation
|
||||
|
||||
if (!animate) {
|
||||
binding.mainBottomBar.translationY = translation.toFloat()
|
||||
binding.mainBottomBar.isVisible = !hide
|
||||
return
|
||||
}
|
||||
|
||||
binding.mainBottomBar.animate()
|
||||
.translationY(translation.toFloat())
|
||||
.setInterpolator(FastOutSlowInInterpolator())
|
||||
|
Loading…
x
Reference in New Issue
Block a user