forked from github/szkolny
fix collapsing toolbar title when doing back gesture
This commit is contained in:
parent
743050712b
commit
bc8c952853
@ -967,16 +967,18 @@ class MainActivity : AppCompatActivity(), CoroutineScope {
|
|||||||
bottomSheet.removeAllContextual()
|
bottomSheet.removeAllContextual()
|
||||||
bottomSheet.toggleGroupEnabled = false
|
bottomSheet.toggleGroupEnabled = false
|
||||||
drawer.close()
|
drawer.close()
|
||||||
|
|
||||||
if (drawer.getSelection() != navTarget.id)
|
if (drawer.getSelection() != navTarget.id)
|
||||||
drawer.setSelection(navTarget.id, fireOnClick = false)
|
drawer.setSelection(navTarget.id, fireOnClick = false)
|
||||||
navView.toolbar.setTitle(navTarget.titleRes ?: navTarget.nameRes)
|
|
||||||
navView.bottomBar.fabEnable = false
|
navView.bottomBar.fabEnable = false
|
||||||
navView.bottomBar.fabExtended = false
|
navView.bottomBar.fabExtended = false
|
||||||
navView.bottomBar.setFabOnClickListener(null)
|
navView.bottomBar.setFabOnClickListener(null)
|
||||||
|
navView.toolbarLayout.setTitle((navTarget.titleRes ?: navTarget.nameRes).resolveString(applicationContext))
|
||||||
|
|
||||||
d("NavDebug", "Navigating from ${this.navTarget.name} to ${navTarget.name}")
|
d("NavDebug", "Navigating from ${this.navTarget.name} to ${navTarget.name}")
|
||||||
|
|
||||||
val fragment = navTarget.fragmentClass?.newInstance() ?: return
|
val fragment = navTarget.fragmentClass?.getDeclaredConstructor()?.newInstance() ?: return
|
||||||
fragment.arguments = arguments
|
fragment.arguments = arguments
|
||||||
val transaction = fragmentManager.beginTransaction()
|
val transaction = fragmentManager.beginTransaction()
|
||||||
|
|
||||||
@ -1084,7 +1086,7 @@ class MainActivity : AppCompatActivity(), CoroutineScope {
|
|||||||
|
|
||||||
fun navigateUp(skipBeforeNavigate: Boolean = false) {
|
fun navigateUp(skipBeforeNavigate: Boolean = false) {
|
||||||
if (!popBackStack(skipBeforeNavigate)) {
|
if (!popBackStack(skipBeforeNavigate)) {
|
||||||
super.onBackPressed()
|
super.onBackPressedDispatcher.onBackPressed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user