Fix wrap_content handling in DefaultTimeBar
Issue: #2788 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=155705318
This commit is contained in:
parent
8d6f5d86b4
commit
7eadfb1ff0
@ -343,16 +343,18 @@ public class DefaultTimeBar extends View implements TimeBar {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
int measureWidth = MeasureSpec.getSize(widthMeasureSpec);
|
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
|
||||||
int measureHeight = MeasureSpec.getSize(heightMeasureSpec);
|
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
|
||||||
setMeasuredDimension(measureWidth, measureHeight);
|
int height = heightMode == MeasureSpec.UNSPECIFIED ? touchTargetHeight
|
||||||
|
: heightMode == MeasureSpec.EXACTLY ? heightSize : Math.min(touchTargetHeight, heightSize);
|
||||||
|
setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||||
int width = right - left;
|
int width = right - left;
|
||||||
int height = bottom - top;
|
int height = bottom - top;
|
||||||
int barY = height - touchTargetHeight;
|
int barY = (height - touchTargetHeight) / 2;
|
||||||
int seekLeft = getPaddingLeft();
|
int seekLeft = getPaddingLeft();
|
||||||
int seekRight = width - getPaddingRight();
|
int seekRight = width - getPaddingRight();
|
||||||
int progressY = barY + (touchTargetHeight - barHeight) / 2;
|
int progressY = barY + (touchTargetHeight - barHeight) / 2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user