fix: navigation bar missing when closing player in fullscreen

This commit is contained in:
Bnyro 2024-05-08 16:42:43 +02:00
parent ddde276866
commit 1aaa801657

View File

@ -826,18 +826,28 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
_binding = null _binding = null
} }
/**
* Manually kill the player fragment - call instead of using onDestroy directly
*/
private fun killPlayerFragment() { private fun killPlayerFragment() {
viewModel.isFullscreen.value = false binding.playerMotionLayout.transitionToEnd()
viewModel.isMiniPlayerVisible.value = false viewModel.isMiniPlayerVisible.value = false
// dismiss the fullscreen dialog if it's currently visible if (viewModel.isFullscreen.value == true) {
// otherwise it would stay alive while being detached from this fragment unsetFullscreen()
fullscreenDialog.dismiss()
binding.player.currentWindow = null
binding.playerMotionLayout.transitionToEnd() // wait a short amount of time for the unset fullscreen process to properly finish
mainActivity.supportFragmentManager.commit { // (Android animations etc...)
remove(this@PlayerFragment) handler.postDelayed(100) {
mainActivity.supportFragmentManager.commit {
remove(this@PlayerFragment)
}
}
} else {
mainActivity.supportFragmentManager.commit {
remove(this@PlayerFragment)
}
} }
} }