mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 06:10:31 +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
|
package com.github.libretube.ui.fragments
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
|
import android.app.Activity
|
||||||
import android.app.Dialog
|
import android.app.Dialog
|
||||||
import android.content.BroadcastReceiver
|
import android.content.BroadcastReceiver
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
@ -175,6 +176,9 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
|||||||
*/
|
*/
|
||||||
private var playerLayoutOrientation = Int.MIN_VALUE
|
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 mainActivity get() = activity as MainActivity
|
||||||
private val windowInsetsControllerCompat
|
private val windowInsetsControllerCompat
|
||||||
get() = WindowCompat
|
get() = WindowCompat
|
||||||
@ -219,7 +223,8 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
|||||||
playOnBackground()
|
playOnBackground()
|
||||||
// wait some time in order for the service to get started properly
|
// wait some time in order for the service to get started properly
|
||||||
handler.postDelayed(500) {
|
handler.postDelayed(500) {
|
||||||
activity?.finish()
|
pipActivity?.moveTaskToBack(false)
|
||||||
|
pipActivity = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1511,6 +1516,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
|||||||
updateCurrentSubtitle(null)
|
updateCurrentSubtitle(null)
|
||||||
|
|
||||||
openOrCloseFullscreenDialog(true)
|
openOrCloseFullscreenDialog(true)
|
||||||
|
pipActivity = activity
|
||||||
} else {
|
} else {
|
||||||
binding.player.useController = true
|
binding.player.useController = true
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user