mirror of
https://github.com/samsonjs/media.git
synced 2026-06-29 05:39:31 +00:00
Apply minimal layout change according to view size
- Add method to scale scrubber handle of DefaultTimeBar PiperOrigin-RevId: 294366734
This commit is contained in:
parent
10b8eff727
commit
2640538228
1 changed files with 15 additions and 1 deletions
|
|
@ -203,6 +203,7 @@ public class DefaultTimeBar extends View implements TimeBar {
|
|||
private int lastCoarseScrubXPosition;
|
||||
@MonotonicNonNull private Rect lastExclusionRectangle;
|
||||
|
||||
private float scrubberScale;
|
||||
private boolean scrubbing;
|
||||
private long scrubPosition;
|
||||
private long duration;
|
||||
|
|
@ -329,6 +330,7 @@ public class DefaultTimeBar extends View implements TimeBar {
|
|||
(Math.max(scrubberDisabledSize, Math.max(scrubberEnabledSize, scrubberDraggedSize)) + 1)
|
||||
/ 2;
|
||||
}
|
||||
scrubberScale = 1.0f;
|
||||
duration = C.TIME_UNSET;
|
||||
keyTimeIncrement = C.TIME_UNSET;
|
||||
keyCountIncrement = DEFAULT_INCREMENT_COUNT;
|
||||
|
|
@ -359,6 +361,18 @@ public class DefaultTimeBar extends View implements TimeBar {
|
|||
invalidate(seekBounds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the scale factor for the scrubber handle. Scrubber enabled size, scrubber disabled size,
|
||||
* scrubber dragged size are scaled by the scale factor. If scrubber drawable is set, the scale
|
||||
* factor isn't applied.
|
||||
*
|
||||
* @param scrubberScale The scale factor for the scrubber handle.
|
||||
*/
|
||||
public void setScrubberScale(float scrubberScale) {
|
||||
this.scrubberScale = scrubberScale;
|
||||
invalidate(seekBounds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the color for the portion of the time bar after the current played position up to the
|
||||
* current buffered position.
|
||||
|
|
@ -815,7 +829,7 @@ public class DefaultTimeBar extends View implements TimeBar {
|
|||
if (scrubberDrawable == null) {
|
||||
int scrubberSize = (scrubbing || isFocused()) ? scrubberDraggedSize
|
||||
: (isEnabled() ? scrubberEnabledSize : scrubberDisabledSize);
|
||||
int playheadRadius = scrubberSize / 2;
|
||||
int playheadRadius = (int) ((scrubberSize * scrubberScale) / 2);
|
||||
canvas.drawCircle(playheadX, playheadY, playheadRadius, scrubberPaint);
|
||||
} else {
|
||||
int scrubberDrawableWidth = scrubberDrawable.getIntrinsicWidth();
|
||||
|
|
|
|||
Loading…
Reference in a new issue