[Now Playing] Fixed enterTransition for startDestination
This commit is contained in:
parent
dc0c4d2046
commit
766f62a1b7
2 changed files with 4 additions and 1 deletions
|
@ -96,6 +96,9 @@ class MainActivity : AbsCastActivity(), OnSharedPreferenceChangeListener {
|
|||
}
|
||||
}
|
||||
navController.addOnDestinationChangedListener { _, destination, _ ->
|
||||
if (destination.id == navGraph.startDestinationId) {
|
||||
currentFragment(R.id.fragment_container)?.enterTransition = null
|
||||
}
|
||||
when (destination.id) {
|
||||
R.id.action_home, R.id.action_song, R.id.action_album, R.id.action_artist, R.id.action_folder, R.id.action_playlist, R.id.action_genre -> {
|
||||
// Save the last tab
|
||||
|
|
|
@ -67,7 +67,7 @@ fun AppCompatActivity.currentFragment(navHostId: Int): Fragment? {
|
|||
val navHostFragment: NavHostFragment =
|
||||
supportFragmentManager.findFragmentById(navHostId) as NavHostFragment
|
||||
navHostFragment.targetFragment
|
||||
return navHostFragment.childFragmentManager.fragments.first()
|
||||
return navHostFragment.childFragmentManager.fragments.firstOrNull()
|
||||
}
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue