am efb49bd8: Merge "Constrain width and height to >= 0 in FastScroller layout" into mnc-dev
* commit 'efb49bd81101046ced1f75aeef81dcda27580514': Constrain width and height to >= 0 in FastScroller layout
This commit is contained in:
@@ -660,10 +660,11 @@ class FastScroller {
|
|||||||
maxWidth = containerWidth - adjacent.getRight();
|
maxWidth = containerWidth - adjacent.getRight();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final int adjMaxHeight = Math.max(0, container.height());
|
||||||
final int adjMaxWidth = Math.max(0, maxWidth - marginLeft - marginRight);
|
final int adjMaxWidth = Math.max(0, maxWidth - marginLeft - marginRight);
|
||||||
final int widthMeasureSpec = MeasureSpec.makeMeasureSpec(adjMaxWidth, MeasureSpec.AT_MOST);
|
final int widthMeasureSpec = MeasureSpec.makeMeasureSpec(adjMaxWidth, MeasureSpec.AT_MOST);
|
||||||
final int heightMeasureSpec = MeasureSpec.makeSafeMeasureSpec(container.height(),
|
final int heightMeasureSpec = MeasureSpec.makeSafeMeasureSpec(
|
||||||
MeasureSpec.UNSPECIFIED);
|
adjMaxHeight, MeasureSpec.UNSPECIFIED);
|
||||||
view.measure(widthMeasureSpec, heightMeasureSpec);
|
view.measure(widthMeasureSpec, heightMeasureSpec);
|
||||||
|
|
||||||
// Align to the left or right.
|
// Align to the left or right.
|
||||||
@@ -700,10 +701,11 @@ class FastScroller {
|
|||||||
|
|
||||||
final Rect container = mContainerRect;
|
final Rect container = mContainerRect;
|
||||||
final int containerWidth = container.width();
|
final int containerWidth = container.width();
|
||||||
final int adjMaxWidth = containerWidth - marginLeft - marginRight;
|
final int adjMaxHeight = Math.max(0, container.height());
|
||||||
|
final int adjMaxWidth = Math.max(0, containerWidth - marginLeft - marginRight);
|
||||||
final int widthMeasureSpec = MeasureSpec.makeMeasureSpec(adjMaxWidth, MeasureSpec.AT_MOST);
|
final int widthMeasureSpec = MeasureSpec.makeMeasureSpec(adjMaxWidth, MeasureSpec.AT_MOST);
|
||||||
final int heightMeasureSpec = MeasureSpec.makeSafeMeasureSpec(container.height(),
|
final int heightMeasureSpec = MeasureSpec.makeSafeMeasureSpec(
|
||||||
MeasureSpec.UNSPECIFIED);
|
adjMaxHeight, MeasureSpec.UNSPECIFIED);
|
||||||
preview.measure(widthMeasureSpec, heightMeasureSpec);
|
preview.measure(widthMeasureSpec, heightMeasureSpec);
|
||||||
|
|
||||||
// Align at the vertical center, 10% from the top.
|
// Align at the vertical center, 10% from the top.
|
||||||
@@ -766,10 +768,11 @@ class FastScroller {
|
|||||||
final View track = mTrackImage;
|
final View track = mTrackImage;
|
||||||
final View thumb = mThumbImage;
|
final View thumb = mThumbImage;
|
||||||
final Rect container = mContainerRect;
|
final Rect container = mContainerRect;
|
||||||
final int maxWidth = container.width();
|
final int maxWidth = Math.max(0, container.width());
|
||||||
|
final int maxHeight = Math.max(0, container.height());
|
||||||
final int widthMeasureSpec = MeasureSpec.makeMeasureSpec(maxWidth, MeasureSpec.AT_MOST);
|
final int widthMeasureSpec = MeasureSpec.makeMeasureSpec(maxWidth, MeasureSpec.AT_MOST);
|
||||||
final int heightMeasureSpec = MeasureSpec.makeSafeMeasureSpec(container.height(),
|
final int heightMeasureSpec = MeasureSpec.makeSafeMeasureSpec(
|
||||||
MeasureSpec.UNSPECIFIED);
|
maxHeight, MeasureSpec.UNSPECIFIED);
|
||||||
track.measure(widthMeasureSpec, heightMeasureSpec);
|
track.measure(widthMeasureSpec, heightMeasureSpec);
|
||||||
|
|
||||||
final int top;
|
final int top;
|
||||||
|
|||||||
Reference in New Issue
Block a user