Skip to content

Commit

Permalink
Make SeekBar work properly with key events if focusable
Browse files Browse the repository at this point in the history
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:/google/moe
MOE_MIGRATED_REVID=143440580
  • Loading branch information
ojw28 committed Jan 4, 2017
1 parent 04968a6 commit 361241f
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

Expand Down

0 comments on commit 361241f

Please sign in to comment.