am 0a27c486: Fix measurement bug in keyguard/MultiPaneChallengeLayout
* commit '0a27c4865e5f3afe891680f687ac75c6a659fb84': Fix measurement bug in keyguard/MultiPaneChallengeLayout
This commit is contained in:
@@ -221,30 +221,35 @@ public class MultiPaneChallengeLayout extends ViewGroup implements ChallengeLayo
|
|||||||
if (lp.centerWithinArea > 0) {
|
if (lp.centerWithinArea > 0) {
|
||||||
if (mOrientation == HORIZONTAL) {
|
if (mOrientation == HORIZONTAL) {
|
||||||
adjustedWidthSpec = MeasureSpec.makeMeasureSpec(
|
adjustedWidthSpec = MeasureSpec.makeMeasureSpec(
|
||||||
(int) (width * lp.centerWithinArea + 0.5f), MeasureSpec.EXACTLY);
|
(int) ((width - widthUsed) * lp.centerWithinArea + 0.5f),
|
||||||
adjustedHeightSpec = heightSpec;
|
MeasureSpec.EXACTLY);
|
||||||
} else {
|
|
||||||
adjustedWidthSpec = widthSpec;
|
|
||||||
adjustedHeightSpec = MeasureSpec.makeMeasureSpec(
|
adjustedHeightSpec = MeasureSpec.makeMeasureSpec(
|
||||||
(int) (height * lp.centerWithinArea + 0.5f), MeasureSpec.EXACTLY);
|
MeasureSpec.getSize(heightSpec) - heightUsed, MeasureSpec.EXACTLY);
|
||||||
|
} else {
|
||||||
|
adjustedWidthSpec = MeasureSpec.makeMeasureSpec(
|
||||||
|
MeasureSpec.getSize(widthSpec) - widthUsed, MeasureSpec.EXACTLY);
|
||||||
|
adjustedHeightSpec = MeasureSpec.makeMeasureSpec(
|
||||||
|
(int) ((height - heightUsed) * lp.centerWithinArea + 0.5f),
|
||||||
|
MeasureSpec.EXACTLY);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
adjustedWidthSpec = widthSpec;
|
adjustedWidthSpec = MeasureSpec.makeMeasureSpec(
|
||||||
adjustedHeightSpec = heightSpec;
|
MeasureSpec.getSize(widthSpec) - widthUsed, MeasureSpec.EXACTLY);
|
||||||
|
adjustedHeightSpec = MeasureSpec.makeMeasureSpec(
|
||||||
|
MeasureSpec.getSize(heightSpec) - heightUsed, MeasureSpec.EXACTLY);
|
||||||
}
|
}
|
||||||
if (lp.maxWidth >= 0) {
|
if (lp.maxWidth >= 0) {
|
||||||
adjustedWidthSpec = MeasureSpec.makeMeasureSpec(
|
adjustedWidthSpec = MeasureSpec.makeMeasureSpec(
|
||||||
Math.min(lp.maxWidth, MeasureSpec.getSize(widthSpec)),
|
Math.min(lp.maxWidth, MeasureSpec.getSize(adjustedWidthSpec)),
|
||||||
MeasureSpec.EXACTLY);
|
MeasureSpec.EXACTLY);
|
||||||
}
|
}
|
||||||
if (lp.maxHeight >= 0) {
|
if (lp.maxHeight >= 0) {
|
||||||
adjustedHeightSpec = MeasureSpec.makeMeasureSpec(
|
adjustedHeightSpec = MeasureSpec.makeMeasureSpec(
|
||||||
Math.min(lp.maxHeight, MeasureSpec.getSize(heightSpec)),
|
Math.min(lp.maxHeight, MeasureSpec.getSize(adjustedHeightSpec)),
|
||||||
MeasureSpec.EXACTLY);
|
MeasureSpec.EXACTLY);
|
||||||
}
|
}
|
||||||
|
|
||||||
measureChildWithMargins(child, adjustedWidthSpec, widthUsed,
|
measureChildWithMargins(child, adjustedWidthSpec, 0, adjustedHeightSpec, 0);
|
||||||
adjustedHeightSpec, heightUsed);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user