From 361241f81cd494a9daae80b769ed6d7cd1c37d99 Mon Sep 17 00:00:00 2001 From: olly Date: Tue, 3 Jan 2017 07:01:38 -0800 Subject: [PATCH] Make SeekBar work properly with key events if focusable This isn't perfect because it performs seeks whilst the user is holding down L/R, rather than when they release it. Performing the seek on release properly looks non trivial, and would likely require extending SeekBar. Issue: #2278 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=143440580 --- .../android/exoplayer2/ui/PlaybackControlView.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/library/src/main/java/com/google/android/exoplayer2/ui/PlaybackControlView.java b/library/src/main/java/com/google/android/exoplayer2/ui/PlaybackControlView.java index 40e814dab31..dc3c398357c 100644 --- a/library/src/main/java/com/google/android/exoplayer2/ui/PlaybackControlView.java +++ b/library/src/main/java/com/google/android/exoplayer2/ui/PlaybackControlView.java @@ -735,8 +735,14 @@ public void onStartTrackingTouch(SeekBar seekBar) { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { - if (fromUser && positionView != null) { - positionView.setText(stringForTime(positionValue(progress))); + if (fromUser) { + long position = positionValue(progress); + if (positionView != null) { + positionView.setText(stringForTime(position)); + } + if (player != null && !dragging) { + seekTo(position); + } } }