diff --git a/app/src/main/java/com/github/libretube/constants/PreferenceRanges.kt b/app/src/main/java/com/github/libretube/constants/PreferenceRanges.kt index a82e623d3..abffb31d5 100644 --- a/app/src/main/java/com/github/libretube/constants/PreferenceRanges.kt +++ b/app/src/main/java/com/github/libretube/constants/PreferenceRanges.kt @@ -12,4 +12,11 @@ object PreferenceRanges { 0.25f, 1.0f ) + + val seekIncrement = SliderRange( + 5f, + 60f, + 5f, + 10f + ) } diff --git a/app/src/main/java/com/github/libretube/interfaces/DoubleTapInterface.kt b/app/src/main/java/com/github/libretube/models/interfaces/DoubleTapInterface.kt similarity index 56% rename from app/src/main/java/com/github/libretube/interfaces/DoubleTapInterface.kt rename to app/src/main/java/com/github/libretube/models/interfaces/DoubleTapInterface.kt index ba8bcd8f0..b26a13b4f 100644 --- a/app/src/main/java/com/github/libretube/interfaces/DoubleTapInterface.kt +++ b/app/src/main/java/com/github/libretube/models/interfaces/DoubleTapInterface.kt @@ -1,4 +1,4 @@ -package com.github.libretube.interfaces +package com.github.libretube.models.interfaces interface DoubleTapInterface { fun onEvent(x: Float) diff --git a/app/src/main/java/com/github/libretube/interfaces/PlayerOptionsInterface.kt b/app/src/main/java/com/github/libretube/models/interfaces/PlayerOptionsInterface.kt similarity index 66% rename from app/src/main/java/com/github/libretube/interfaces/PlayerOptionsInterface.kt rename to app/src/main/java/com/github/libretube/models/interfaces/PlayerOptionsInterface.kt index 9cd6373a3..66d3d87d9 100644 --- a/app/src/main/java/com/github/libretube/interfaces/PlayerOptionsInterface.kt +++ b/app/src/main/java/com/github/libretube/models/interfaces/PlayerOptionsInterface.kt @@ -1,4 +1,4 @@ -package com.github.libretube.interfaces +package com.github.libretube.models.interfaces interface PlayerOptionsInterface { fun onCaptionClicked() diff --git a/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt index 6b1053043..1a0434cd3 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt @@ -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 diff --git a/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt b/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt index 6c5e91b24..a56187838 100644 --- a/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt +++ b/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt @@ -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, diff --git a/app/src/main/java/com/github/libretube/ui/views/SliderPreference.kt b/app/src/main/java/com/github/libretube/ui/views/SliderPreference.kt index bf932ec51..c965d04af 100644 --- a/app/src/main/java/com/github/libretube/ui/views/SliderPreference.kt +++ b/app/src/main/java/com/github/libretube/ui/views/SliderPreference.kt @@ -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 } diff --git a/app/src/main/res/values/array.xml b/app/src/main/res/values/array.xml index 121edb4c7..2a07214b9 100644 --- a/app/src/main/res/values/array.xml +++ b/app/src/main/res/values/array.xml @@ -263,19 +263,6 @@ mpeg - - 5s - 10s - 20s - 30s - - - 5 - 10 - 20 - 30 - - @string/aspect_ratio @string/auto_rotation @@ -330,6 +317,7 @@ 2 hours 6 hours 12 hours + 1 day @@ -339,6 +327,7 @@ 120 360 720 + 1440 diff --git a/app/src/main/res/xml/player_settings.xml b/app/src/main/res/xml/player_settings.xml index 49105aaa2..0777d740e 100644 --- a/app/src/main/res/xml/player_settings.xml +++ b/app/src/main/res/xml/player_settings.xml @@ -10,14 +10,11 @@ app:key="playback_speed" app:title="@string/playback_speed" /> - + app:title="@string/seek_increment" />