Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pip-to-audio action does not close pip window #6476

Merged
merged 3 commits into from
Sep 10, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -175,6 +176,8 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
*/
private var playerLayoutOrientation = Int.MIN_VALUE

private var pipActivity: Activity? = null
janisslsm marked this conversation as resolved.
Show resolved Hide resolved

private val mainActivity get() = activity as MainActivity
private val windowInsetsControllerCompat
get() = WindowCompat
Expand Down Expand Up @@ -219,7 +222,7 @@ 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)
janisslsm marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down Expand Up @@ -1515,6 +1518,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
updateCurrentSubtitle(null)

openOrCloseFullscreenDialog(true)
pipActivity = activity
} else {
binding.player.useController = true

Expand Down
Loading