mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 06:10:31 +05:30
Turn #1560 into an option
This commit is contained in:
parent
0dfb47143b
commit
0f72df6e70
@ -86,6 +86,7 @@ object PreferenceKeys {
|
||||
const val PLAYER_PINCH_CONTROL = "player_pinch_control"
|
||||
const val CAPTIONS_SIZE = "captions_size"
|
||||
const val DOUBLE_TAP_TO_SEEK = "double_tap_seek"
|
||||
const val PAUSE_ON_QUIT = "pause_on_quit"
|
||||
|
||||
/**
|
||||
* Background mode
|
||||
|
@ -1442,7 +1442,7 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
|
||||
activity?.enterPictureInPictureMode(getPipParams())
|
||||
return
|
||||
}
|
||||
if (!PlayerHelper.pipEnabled) exoPlayer.pause()
|
||||
if (PlayerHelper.pauseOnQuit) exoPlayer.pause()
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
|
@ -2,6 +2,8 @@ package com.github.libretube.ui.preferences
|
||||
|
||||
import android.content.ActivityNotFoundException
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.os.Build.VERSION.SDK_INT
|
||||
import android.os.Bundle
|
||||
import android.provider.Settings
|
||||
import android.widget.Toast
|
||||
@ -59,6 +61,18 @@ class PlayerSettings : BasePreferenceFragment() {
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
val pictureInPicture = findPreference<SwitchPreferenceCompat>(
|
||||
PreferenceKeys.PICTURE_IN_PICTURE
|
||||
)!!
|
||||
val pauseOnQuit = findPreference<SwitchPreferenceCompat>(PreferenceKeys.PAUSE_ON_QUIT)
|
||||
pictureInPicture.isVisible = SDK_INT >= Build.VERSION_CODES.O
|
||||
pauseOnQuit?.isVisible = !pictureInPicture.isVisible || !pictureInPicture.isChecked
|
||||
|
||||
pictureInPicture.setOnPreferenceChangeListener { _, newValue ->
|
||||
pauseOnQuit?.isVisible = !(newValue as Boolean)
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupSubtitlePref(preference: ListPreference) {
|
||||
|
@ -320,6 +320,12 @@ object PlayerHelper {
|
||||
true
|
||||
)
|
||||
|
||||
val pauseOnQuit: Boolean
|
||||
get() = PreferenceHelper.getBoolean(
|
||||
PreferenceKeys.PAUSE_ON_QUIT,
|
||||
false
|
||||
)
|
||||
|
||||
fun getDefaultResolution(context: Context): String {
|
||||
return if (NetworkHelper.isNetworkMobile(context)) {
|
||||
PreferenceHelper.getString(
|
||||
|
@ -421,6 +421,7 @@
|
||||
<string name="hide_watched_from_feed">Hide watched videos from feed</string>
|
||||
<string name="hide_watched_from_feed_summary">Don\'t show videos being watched more than 90% in the subscriptions tab.</string>
|
||||
<string name="playlistUrl">Playlist URL</string>
|
||||
<string name="pause_on_quit">Pause on quit</string>
|
||||
|
||||
<!-- Notification channel strings -->
|
||||
<string name="download_channel_name">Download Service</string>
|
||||
|
@ -38,6 +38,12 @@
|
||||
app:key="picture_in_picture"
|
||||
app:title="@string/picture_in_picture" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:icon="@drawable/ic_pause_filled"
|
||||
app:key="pause_on_quit"
|
||||
app:title="@string/pause_on_quit" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:icon="@drawable/ic_rotating_circle"
|
||||
android:summary="@string/autoRotatePlayer_summary"
|
||||
|
Loading…
Reference in New Issue
Block a user