mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-09 16:11:20 +02:00
Add preference for skipping back on resume
This commit is contained in:
parent
c1e64beb74
commit
e412c3da48
9 changed files with 63 additions and 1 deletions
|
|
@ -212,6 +212,28 @@ sealed interface AppPreference<T> {
|
|||
summaryOff = R.string.disabled,
|
||||
)
|
||||
|
||||
val SkipBackOnResume =
|
||||
AppSliderPreference(
|
||||
title = R.string.skip_back_on_resume_preference,
|
||||
defaultValue = 0,
|
||||
min = 0,
|
||||
max = 10,
|
||||
interval = 1,
|
||||
getter = { it.playbackPreferences.skipBackOnResumeSeconds.milliseconds.inWholeSeconds },
|
||||
setter = { prefs, value ->
|
||||
prefs.updatePlaybackPreferences {
|
||||
skipBackOnResumeSeconds = value.seconds.inWholeMilliseconds
|
||||
}
|
||||
},
|
||||
summarizer = { value ->
|
||||
if (value == 0L) {
|
||||
"Disabled"
|
||||
} else {
|
||||
"${value}s"
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
val AutoPlayNextDelay =
|
||||
AppSliderPreference(
|
||||
title = R.string.auto_play_next_delay,
|
||||
|
|
@ -290,6 +312,7 @@ val basicPreferences =
|
|||
AppPreference.ControllerTimeout,
|
||||
AppPreference.AutoPlayNextUp,
|
||||
AppPreference.AutoPlayNextDelay,
|
||||
AppPreference.SkipBackOnResume,
|
||||
AppPreference.PlaybackDebugInfo,
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ class AppPreferencesSerializer
|
|||
autoPlayNext = AppPreference.AutoPlayNextUp.defaultValue
|
||||
autoPlayNextDelaySeconds =
|
||||
AppPreference.AutoPlayNextDelay.defaultValue
|
||||
skipBackOnResumeSeconds =
|
||||
AppPreference.SkipBackOnResume.defaultValue.seconds.inWholeMilliseconds
|
||||
}.build()
|
||||
homePagePreferences =
|
||||
HomePagePreferences
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
package com.github.damontecres.dolphin.preferences
|
||||
|
||||
import kotlin.time.Duration
|
||||
import kotlin.time.Duration.Companion.milliseconds
|
||||
|
||||
val PlaybackPreferences.skipBackOnResume: Duration?
|
||||
get() =
|
||||
if (skipBackOnResumeSeconds > 0) {
|
||||
skipBackOnResumeSeconds.milliseconds
|
||||
} else {
|
||||
null
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue