Fixed "Changing the seeks duration does not update the displayed seconds"

This commit is contained in:
litetex 2022-01-25 20:44:49 +01:00
parent 54ef604569
commit af79479716
2 changed files with 6 additions and 6 deletions

View File

@ -586,7 +586,8 @@ public final class Player implements
*/ */
private void setupPlayerSeekOverlay() { private void setupPlayerSeekOverlay() {
binding.fastSeekOverlay binding.fastSeekOverlay
.seekSeconds((int) (retrieveSeekDurationFromPreferences(this) / 1000.0f)) .seekSecondsSupplier(
() -> (int) (retrieveSeekDurationFromPreferences(this) / 1000.0f))
.performListener(new PlayerFastSeekOverlay.PerformListener() { .performListener(new PlayerFastSeekOverlay.PerformListener() {
@Override @Override

View File

@ -42,11 +42,10 @@ class PlayerFastSeekOverlay(context: Context, attrs: AttributeSet?) :
performListener = listener performListener = listener
} }
var seekSeconds: Int = 0 private var seekSecondsSupplier: () -> Int = { 0 }
private set
fun seekSeconds(seconds: Int) = apply { fun seekSecondsSupplier(supplier: () -> Int) = apply {
seekSeconds = seconds seekSecondsSupplier = supplier
} }
// Indicates whether this (double) tap is the first of a series // Indicates whether this (double) tap is the first of a series
@ -94,7 +93,7 @@ class PlayerFastSeekOverlay(context: Context, attrs: AttributeSet?) :
performListener?.onDoubleTap() performListener?.onDoubleTap()
secondsView.seconds += seekSeconds secondsView.seconds += seekSecondsSupplier.invoke()
performListener?.seek(forward = shouldForward) performListener?.seek(forward = shouldForward)
} }