Merge pull request #1412 from Bnyro/master

add pref values
This commit is contained in:
Bnyro 2022-09-29 19:43:23 +02:00 committed by GitHub
commit fa45c24c09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 22 additions and 25 deletions

View File

@ -12,4 +12,11 @@ object PreferenceRanges {
0.25f,
1.0f
)
val seekIncrement = SliderRange(
5f,
60f,
5f,
10f
)
}

View File

@ -1,4 +1,4 @@
package com.github.libretube.interfaces
package com.github.libretube.models.interfaces
interface DoubleTapInterface {
fun onEvent(x: Float)

View File

@ -1,4 +1,4 @@
package com.github.libretube.interfaces
package com.github.libretube.models.interfaces
interface PlayerOptionsInterface {
fun onCaptionClicked()

View File

@ -51,8 +51,8 @@ import com.github.libretube.extensions.formatShort
import com.github.libretube.extensions.hideKeyboard
import com.github.libretube.extensions.query
import com.github.libretube.extensions.toID
import com.github.libretube.interfaces.PlayerOptionsInterface
import com.github.libretube.models.PlayerViewModel
import com.github.libretube.models.interfaces.PlayerOptionsInterface
import com.github.libretube.services.BackgroundMode
import com.github.libretube.services.DownloadService
import com.github.libretube.ui.activities.MainActivity

View File

@ -16,8 +16,8 @@ import com.github.libretube.databinding.DialogSliderBinding
import com.github.libretube.databinding.DoubleTapOverlayBinding
import com.github.libretube.databinding.ExoStyledPlayerControlViewBinding
import com.github.libretube.extensions.setSliderRangeAndValue
import com.github.libretube.interfaces.DoubleTapInterface
import com.github.libretube.interfaces.PlayerOptionsInterface
import com.github.libretube.models.interfaces.DoubleTapInterface
import com.github.libretube.models.interfaces.PlayerOptionsInterface
import com.github.libretube.obj.BottomSheetItem
import com.github.libretube.ui.activities.MainActivity
import com.github.libretube.util.DoubleTapListener
@ -27,6 +27,7 @@ import com.google.android.exoplayer2.ui.AspectRatioFrameLayout
import com.google.android.exoplayer2.ui.StyledPlayerView
import com.google.android.exoplayer2.util.RepeatModeUtil
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import kotlin.math.roundToInt
@SuppressLint("ClickableViewAccessibility")
internal class CustomExoPlayerView(
@ -61,8 +62,10 @@ internal class CustomExoPlayerView(
private val seekIncrement = PreferenceHelper.getString(
PreferenceKeys.SEEK_INCREMENT,
"5"
).toLong() * 1000
"10.0"
).toFloat()
.roundToInt()
.toLong() * 1000
private var resizeModePref = PreferenceHelper.getString(
PreferenceKeys.PLAYER_RESIZE_MODE,

View File

@ -31,6 +31,7 @@ class SliderPreference(
val range = when (key) {
PreferenceKeys.PLAYBACK_SPEED -> PreferenceRanges.playbackSpeed
PreferenceKeys.BACKGROUND_PLAYBACK_SPEED -> PreferenceRanges.playbackSpeed
PreferenceKeys.SEEK_INCREMENT -> PreferenceRanges.seekIncrement
else -> null
}

View File

@ -263,19 +263,6 @@
<item>mpeg</item>
</string-array>
<string-array name="seekIncrement">
<item>5s</item>
<item>10s</item>
<item>20s</item>
<item>30s</item>
</string-array>
<string-array name="seekIncrementValues">
<item>5</item>
<item>10</item>
<item>20</item>
<item>30</item>
</string-array>
<string-array name="fullscreenOrientation">
<item>@string/aspect_ratio</item>
<item>@string/auto_rotation</item>
@ -330,6 +317,7 @@
<item>2 hours</item>
<item>6 hours</item>
<item>12 hours</item>
<item>1 day</item>
</string-array>
<string-array name="checkingFrequencyValues">
@ -339,6 +327,7 @@
<item>120</item>
<item>360</item>
<item>720</item>
<item>1440</item>
</string-array>
<string-array name="sortOptions">

View File

@ -10,14 +10,11 @@
app:key="playback_speed"
app:title="@string/playback_speed" />
<ListPreference
<com.github.libretube.ui.views.SliderPreference
android:icon="@drawable/ic_skip"
app:defaultValue="5"
app:entries="@array/seekIncrement"
app:entryValues="@array/seekIncrementValues"
app:key="seek_increment"
app:title="@string/seek_increment"
app:useSimpleSummaryProvider="true" />
app:title="@string/seek_increment" />
<ListPreference
android:icon="@drawable/ic_time"