mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 22:30:30 +05:30
Fix service not stopping on close video or removed from recents
Stop the `BackgroundMode` service when close icon on player is pressed. Stop the `BackgroundMode` service when app is removed by user from task manager.
This commit is contained in:
parent
e1100db58e
commit
93546382b9
@ -353,6 +353,14 @@ class BackgroundMode : Service() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop the service when app is removed from the task manager.
|
||||
*/
|
||||
override fun onTaskRemoved(rootIntent: Intent?) {
|
||||
super.onTaskRemoved(rootIntent)
|
||||
onDestroy()
|
||||
}
|
||||
|
||||
/**
|
||||
* destroy the [BackgroundMode] foreground service
|
||||
*/
|
||||
|
@ -303,6 +303,7 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
|
||||
mainActivity.supportFragmentManager.beginTransaction()
|
||||
.remove(this)
|
||||
.commit()
|
||||
BackgroundHelper.stopBackgroundPlay(requireContext())
|
||||
}
|
||||
playerBinding.closeImageButton.setOnClickListener {
|
||||
viewModel.isFullscreen.value = false
|
||||
@ -311,6 +312,7 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
|
||||
mainActivity.supportFragmentManager.beginTransaction()
|
||||
.remove(this)
|
||||
.commit()
|
||||
BackgroundHelper.stopBackgroundPlay(requireContext())
|
||||
}
|
||||
|
||||
binding.playImageView.setOnClickListener {
|
||||
|
Loading…
Reference in New Issue
Block a user