diff --git a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt index bcee38708..c80636795 100644 --- a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt @@ -1629,6 +1629,13 @@ class PlayerFragment : BaseFragment() { } private fun shouldStartPiP(): Boolean { + val pipEnabled = PreferenceHelper.getBoolean( + PreferenceKeys.PICTURE_IN_PICTURE, + true + ) + + if (!pipEnabled) return false + val bounds = Rect() binding.playerScrollView.getHitRect(bounds) diff --git a/app/src/main/java/com/github/libretube/preferences/PreferenceKeys.kt b/app/src/main/java/com/github/libretube/preferences/PreferenceKeys.kt index 4074128fd..c8e087461 100644 --- a/app/src/main/java/com/github/libretube/preferences/PreferenceKeys.kt +++ b/app/src/main/java/com/github/libretube/preferences/PreferenceKeys.kt @@ -59,6 +59,7 @@ object PreferenceKeys { const val PLAYER_AUDIO_QUALITY = "player_audio_quality" const val DEFAULT_SUBTITLE = "default_subtitle" const val SKIP_BUTTONS = "skip_buttons" + const val PICTURE_IN_PICTURE = "picture_in_picture" /** * Background mode diff --git a/app/src/main/res/drawable/ic_window.xml b/app/src/main/res/drawable/ic_window.xml new file mode 100644 index 000000000..e58d327cd --- /dev/null +++ b/app/src/main/res/drawable/ic_window.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6f3ccd18c..5a4bee15d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -312,4 +312,5 @@ Current Backup & restore Backup + Picture in Picture diff --git a/app/src/main/res/xml/player_settings.xml b/app/src/main/res/xml/player_settings.xml index b3b646ed0..660f19e37 100644 --- a/app/src/main/res/xml/player_settings.xml +++ b/app/src/main/res/xml/player_settings.xml @@ -46,7 +46,7 @@ + +