mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 16:00:31 +05:30
Merge pull request #6931 from Bnyro/master
fix: wrong back order when new fragment opened from audio/video player
This commit is contained in:
commit
b65f81433d
@ -262,6 +262,13 @@ class AudioPlayerFragment : Fragment(), AudioPlayerOptions {
|
|||||||
setOnBackPressed(onBackPressedCallback)
|
setOnBackPressed(onBackPressedCallback)
|
||||||
|
|
||||||
viewModel.isMiniPlayerVisible.observe(viewLifecycleOwner) { isMiniPlayerVisible ->
|
viewModel.isMiniPlayerVisible.observe(viewLifecycleOwner) { isMiniPlayerVisible ->
|
||||||
|
// re-add the callback on top of the back pressed dispatcher listeners stack,
|
||||||
|
// so that it's the first one to become called while the full player is visible
|
||||||
|
if (!isMiniPlayerVisible) {
|
||||||
|
onBackPressedCallback.remove()
|
||||||
|
setOnBackPressed(onBackPressedCallback)
|
||||||
|
}
|
||||||
|
|
||||||
// if the player is minimized, the fragment behind the player should handle the event
|
// if the player is minimized, the fragment behind the player should handle the event
|
||||||
onBackPressedCallback.isEnabled = isMiniPlayerVisible != true
|
onBackPressedCallback.isEnabled = isMiniPlayerVisible != true
|
||||||
}
|
}
|
||||||
|
@ -486,6 +486,13 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
|||||||
setOnBackPressed(onBackPressedCallback)
|
setOnBackPressed(onBackPressedCallback)
|
||||||
|
|
||||||
commonPlayerViewModel.isMiniPlayerVisible.observe(viewLifecycleOwner) { isMiniPlayerVisible ->
|
commonPlayerViewModel.isMiniPlayerVisible.observe(viewLifecycleOwner) { isMiniPlayerVisible ->
|
||||||
|
// re-add the callback on top of the back pressed dispatcher listeners stack,
|
||||||
|
// so that it's the first one to become called while the full player is visible
|
||||||
|
if (!isMiniPlayerVisible) {
|
||||||
|
onBackPressedCallback.remove()
|
||||||
|
setOnBackPressed(onBackPressedCallback)
|
||||||
|
}
|
||||||
|
|
||||||
// if the player is minimized, the fragment behind the player should handle the event
|
// if the player is minimized, the fragment behind the player should handle the event
|
||||||
onBackPressedCallback.isEnabled = isMiniPlayerVisible != true
|
onBackPressedCallback.isEnabled = isMiniPlayerVisible != true
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user