Merge pull request #1046 from Bnyro/master

option to disable PiP
This commit is contained in:
Bnyro 2022-08-13 19:08:47 +02:00 committed by GitHub
commit 05d309dd59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 2 deletions

View File

@ -165,6 +165,7 @@ class PlayerFragment : BaseFragment() {
private var sponsorBlockEnabled = true private var sponsorBlockEnabled = true
private var sponsorBlockNotifications = true private var sponsorBlockNotifications = true
private var skipButtonsEnabled = false private var skipButtonsEnabled = false
private var pipEnabled = true
/** /**
* for autoplay * for autoplay
@ -328,6 +329,11 @@ class PlayerFragment : BaseFragment() {
PreferenceKeys.SKIP_BUTTONS, PreferenceKeys.SKIP_BUTTONS,
false false
) )
pipEnabled = PreferenceHelper.getBoolean(
PreferenceKeys.PICTURE_IN_PICTURE,
true
)
} }
private fun initializeTransitionLayout() { private fun initializeTransitionLayout() {
@ -1629,6 +1635,8 @@ class PlayerFragment : BaseFragment() {
} }
private fun shouldStartPiP(): Boolean { private fun shouldStartPiP(): Boolean {
if (!pipEnabled) return false
val bounds = Rect() val bounds = Rect()
binding.playerScrollView.getHitRect(bounds) binding.playerScrollView.getHitRect(bounds)

View File

@ -59,6 +59,7 @@ object PreferenceKeys {
const val PLAYER_AUDIO_QUALITY = "player_audio_quality" const val PLAYER_AUDIO_QUALITY = "player_audio_quality"
const val DEFAULT_SUBTITLE = "default_subtitle" const val DEFAULT_SUBTITLE = "default_subtitle"
const val SKIP_BUTTONS = "skip_buttons" const val SKIP_BUTTONS = "skip_buttons"
const val PICTURE_IN_PICTURE = "picture_in_picture"
/** /**
* Background mode * 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="repeat_mode_current">Current</string>
<string name="backup_restore">Backup &amp; restore</string> <string name="backup_restore">Backup &amp; restore</string>
<string name="backup">Backup</string> <string name="backup">Backup</string>
<string name="picture_in_picture">Picture in Picture</string>
</resources> </resources>

View File

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