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