mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-13 13:50:30 +05:30
fix: pip-to-audio action does not close pip window (#6476)
This commit is contained in:
parent
d8f826ec6b
commit
bf99635b48
@ -1,6 +1,7 @@
|
||||
package com.github.libretube.ui.fragments
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.app.Dialog
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
@ -175,6 +176,9 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
||||
*/
|
||||
private var playerLayoutOrientation = Int.MIN_VALUE
|
||||
|
||||
// Activity that's active during PiP, can be used for controlling its lifecycle.
|
||||
private var pipActivity: Activity? = null
|
||||
|
||||
private val mainActivity get() = activity as MainActivity
|
||||
private val windowInsetsControllerCompat
|
||||
get() = WindowCompat
|
||||
@ -219,7 +223,8 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
||||
playOnBackground()
|
||||
// wait some time in order for the service to get started properly
|
||||
handler.postDelayed(500) {
|
||||
activity?.finish()
|
||||
pipActivity?.moveTaskToBack(false)
|
||||
pipActivity = null
|
||||
}
|
||||
}
|
||||
|
||||
@ -1511,6 +1516,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
||||
updateCurrentSubtitle(null)
|
||||
|
||||
openOrCloseFullscreenDialog(true)
|
||||
pipActivity = activity
|
||||
} else {
|
||||
binding.player.useController = true
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user