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,20 +826,30 @@ 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
// (Android animations etc...)
handler.postDelayed(100) {
mainActivity.supportFragmentManager.commit { mainActivity.supportFragmentManager.commit {
remove(this@PlayerFragment) remove(this@PlayerFragment)
} }
} }
} else {
mainActivity.supportFragmentManager.commit {
remove(this@PlayerFragment)
}
}
}
// save the watch position if video isn't finished and option enabled // save the watch position if video isn't finished and option enabled
private fun saveWatchPosition() { private fun saveWatchPosition() {