Merge "Fix indeterminate ProgressBars with weird sizes and padding; optimize ActionBar measurement" into jb-mr1-dev
This commit is contained in:
@@ -985,9 +985,13 @@ public class ProgressBar extends View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateDrawableBounds(int w, int h) {
|
private void updateDrawableBounds(int w, int h) {
|
||||||
// onDraw will translate the canvas so we draw starting at 0,0
|
// onDraw will translate the canvas so we draw starting at 0,0.
|
||||||
int right = w - mPaddingRight - mPaddingLeft;
|
// Subtract out padding for the purposes of the calculations below.
|
||||||
int bottom = h - mPaddingBottom - mPaddingTop;
|
w -= mPaddingRight + mPaddingLeft;
|
||||||
|
h -= mPaddingTop + mPaddingBottom;
|
||||||
|
|
||||||
|
int right = w;
|
||||||
|
int bottom = h;
|
||||||
int top = 0;
|
int top = 0;
|
||||||
int left = 0;
|
int left = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -856,6 +856,7 @@ public class ActionBarView extends AbsActionBarView {
|
|||||||
final int paddingRight = getPaddingRight();
|
final int paddingRight = getPaddingRight();
|
||||||
final int height = maxHeight - verticalPadding;
|
final int height = maxHeight - verticalPadding;
|
||||||
final int childSpecHeight = MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST);
|
final int childSpecHeight = MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST);
|
||||||
|
final int exactHeightSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);
|
||||||
|
|
||||||
int availableWidth = contentWidth - paddingLeft - paddingRight;
|
int availableWidth = contentWidth - paddingLeft - paddingRight;
|
||||||
int leftOfCenter = availableWidth / 2;
|
int leftOfCenter = availableWidth / 2;
|
||||||
@@ -871,16 +872,14 @@ public class ActionBarView extends AbsActionBarView {
|
|||||||
} else {
|
} else {
|
||||||
homeWidthSpec = MeasureSpec.makeMeasureSpec(lp.width, MeasureSpec.EXACTLY);
|
homeWidthSpec = MeasureSpec.makeMeasureSpec(lp.width, MeasureSpec.EXACTLY);
|
||||||
}
|
}
|
||||||
homeLayout.measure(homeWidthSpec,
|
homeLayout.measure(homeWidthSpec, exactHeightSpec);
|
||||||
MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
|
|
||||||
final int homeWidth = homeLayout.getMeasuredWidth() + homeLayout.getStartOffset();
|
final int homeWidth = homeLayout.getMeasuredWidth() + homeLayout.getStartOffset();
|
||||||
availableWidth = Math.max(0, availableWidth - homeWidth);
|
availableWidth = Math.max(0, availableWidth - homeWidth);
|
||||||
leftOfCenter = Math.max(0, availableWidth - homeWidth);
|
leftOfCenter = Math.max(0, availableWidth - homeWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mMenuView != null && mMenuView.getParent() == this) {
|
if (mMenuView != null && mMenuView.getParent() == this) {
|
||||||
availableWidth = measureChildView(mMenuView, availableWidth,
|
availableWidth = measureChildView(mMenuView, availableWidth, exactHeightSpec, 0);
|
||||||
childSpecHeight, 0);
|
|
||||||
rightOfCenter = Math.max(0, rightOfCenter - mMenuView.getMeasuredWidth());
|
rightOfCenter = Math.max(0, rightOfCenter - mMenuView.getMeasuredWidth());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user