Skip to content

Commit

Permalink
Fixed "Changing the seeks duration does not update the displayed seco…
Browse files Browse the repository at this point in the history
…nds"
  • Loading branch information
litetex committed Jan 25, 2022
1 parent 54ef604 commit af79479
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
3 changes: 2 additions & 1 deletion app/src/main/java/org/schabi/newpipe/player/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,8 @@ public void onChange(final boolean selfChange) {
*/
private void setupPlayerSeekOverlay() {
binding.fastSeekOverlay
.seekSeconds((int) (retrieveSeekDurationFromPreferences(this) / 1000.0f))
.seekSecondsSupplier(
() -> (int) (retrieveSeekDurationFromPreferences(this) / 1000.0f))
.performListener(new PlayerFastSeekOverlay.PerformListener() {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -94,7 +93,7 @@ class PlayerFastSeekOverlay(context: Context, attrs: AttributeSet?) :

performListener?.onDoubleTap()

secondsView.seconds += seekSeconds
secondsView.seconds += seekSecondsSupplier.invoke()
performListener?.seek(forward = shouldForward)
}

Expand Down

0 comments on commit af79479

Please sign in to comment.