option to disable PiP

This commit is contained in:
Bnyro 2022-08-13 19:06:31 +02:00
parent 1be4b3146b
commit da8bfe6327
5 changed files with 27 additions and 2 deletions

View File

@ -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)

View File

@ -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

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M20,3H4C2.9,3 2,3.9 2,5v10c0,1.1 0.9,2 2,2h6v2H8v2h8v-2h-2v-2h6c1.1,0 2,-0.9 2,-2V5C22,3.9 21.1,3 20,3" />
</vector>

View File

@ -312,4 +312,5 @@
<string name="repeat_mode_current">Current</string>
<string name="backup_restore">Backup &amp; restore</string>
<string name="backup">Backup</string>
<string name="picture_in_picture">Picture in Picture</string>
</resources>

View File

@ -46,7 +46,7 @@
<ListPreference
android:icon="@drawable/ic_speed"
app:defaultValue="1"
app:defaultValue="1.0"
app:entries="@array/playbackSpeed"
app:entryValues="@array/playbackSpeedValues"
app:key="playback_speed"
@ -95,6 +95,12 @@
app:key="autoplay"
app:title="@string/player_autoplay" />
<SwitchPreferenceCompat
android:defaultValue="true"
android:icon="@drawable/ic_window"
app:key="picture_in_picture"
app:title="@string/picture_in_picture" />
<SwitchPreferenceCompat
android:icon="@drawable/ic_pause_filled"
android:summary="@string/pauseOnScreenOff_summary"
@ -124,7 +130,7 @@
<ListPreference
android:icon="@drawable/ic_speed"
app:defaultValue="1"
app:defaultValue="1.0"
app:entries="@array/playbackSpeed"
app:entryValues="@array/playbackSpeedValues"
app:key="background_playback_speed"