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() {
binding.fastSeekOverlay
.seekSeconds((int) (retrieveSeekDurationFromPreferences(this) / 1000.0f))
.seekSecondsSupplier(
() -> (int) (retrieveSeekDurationFromPreferences(this) / 1000.0f))
.performListener(new PlayerFastSeekOverlay.PerformListener() {
@Override

View File

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