Show larger scrubber handle when focused

Also remove updateScrubberState as it doesn't do anything useful.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160496133
This commit is contained in:
andrewlewis 2017-06-29 00:37:28 -07:00 committed by Oliver Woodman
parent a543436b96
commit db11e3ddb6

View File

@ -89,7 +89,6 @@ public class DefaultTimeBar extends View implements TimeBar {
private final Formatter formatter;
private final Runnable stopScrubbingRunnable;
private int scrubberSize;
private OnScrubListener listener;
private int keyCountIncrement;
private long keyTimeIncrement;
@ -185,7 +184,6 @@ public class DefaultTimeBar extends View implements TimeBar {
stopScrubbing(false);
}
};
scrubberSize = scrubberEnabledSize;
scrubberPadding =
(Math.max(scrubberDisabledSize, Math.max(scrubberEnabledSize, scrubberDraggedSize)) + 1)
/ 2;
@ -235,8 +233,6 @@ public class DefaultTimeBar extends View implements TimeBar {
this.duration = duration;
if (scrubbing && duration == C.TIME_UNSET) {
stopScrubbing(true);
} else {
updateScrubberState();
}
update();
}
@ -252,7 +248,6 @@ public class DefaultTimeBar extends View implements TimeBar {
@Override
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
updateScrubberState();
if (scrubbing && !enabled) {
stopScrubbing(true);
}
@ -437,7 +432,6 @@ public class DefaultTimeBar extends View implements TimeBar {
private void startScrubbing() {
scrubbing = true;
updateScrubberState();
ViewParent parent = getParent();
if (parent != null) {
parent.requestDisallowInterceptTouchEvent(true);
@ -453,18 +447,12 @@ public class DefaultTimeBar extends View implements TimeBar {
if (parent != null) {
parent.requestDisallowInterceptTouchEvent(false);
}
updateScrubberState();
invalidate();
if (listener != null) {
listener.onScrubStop(this, getScrubberPosition(), canceled);
}
}
private void updateScrubberState() {
scrubberSize = scrubbing ? scrubberDraggedSize
: (isEnabled() && duration >= 0 ? scrubberEnabledSize : scrubberDisabledSize);
}
private void update() {
bufferedBar.set(progressBar);
scrubberBar.set(progressBar);
@ -544,6 +532,8 @@ public class DefaultTimeBar extends View implements TimeBar {
if (duration <= 0) {
return;
}
int scrubberSize = (scrubbing || isFocused()) ? scrubberDraggedSize
: (isEnabled() ? scrubberEnabledSize : scrubberDisabledSize);
int playheadRadius = scrubberSize / 2;
int playheadCenter = Util.constrainValue(scrubberBar.right, scrubberBar.left,
progressBar.right);