Merge "Revert "Fix bug #7325234 LayoutParams are not resolved correctly (Settings apps looks broken on Manta in Arabic)"" into jb-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
68b14054b9
@@ -4816,8 +4816,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
|
||||
int parentWidthMeasureSpec, int widthUsed,
|
||||
int parentHeightMeasureSpec, int heightUsed) {
|
||||
final MarginLayoutParams lp = (MarginLayoutParams) child.getLayoutParams();
|
||||
final int layoutDirection = getLayoutDirection();
|
||||
lp.resolveLayoutDirection(layoutDirection);
|
||||
|
||||
final int childWidthMeasureSpec = getChildMeasureSpec(parentWidthMeasureSpec,
|
||||
mPaddingLeft + mPaddingRight + lp.leftMargin + lp.rightMargin
|
||||
|
||||
@@ -304,16 +304,11 @@ public class FrameLayout extends ViewGroup {
|
||||
int maxWidth = 0;
|
||||
int childState = 0;
|
||||
|
||||
final int layoutDirection = getLayoutDirection();
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
final View child = getChildAt(i);
|
||||
if (mMeasureAllChildren || child.getVisibility() != GONE) {
|
||||
measureChildWithMargins(child, widthMeasureSpec, 0, heightMeasureSpec, 0);
|
||||
// measureChildWithMargins() has triggered layout params resolution, so no need
|
||||
// to do it now
|
||||
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
|
||||
|
||||
maxWidth = Math.max(maxWidth,
|
||||
child.getMeasuredWidth() + lp.leftMargin + lp.rightMargin);
|
||||
maxHeight = Math.max(maxHeight,
|
||||
|
||||
@@ -648,8 +648,6 @@ public class LinearLayout extends ViewGroup {
|
||||
|
||||
int largestChildHeight = Integer.MIN_VALUE;
|
||||
|
||||
final int layoutDirection = getLayoutDirection();
|
||||
|
||||
// See how tall everyone is. Also remember max width.
|
||||
for (int i = 0; i < count; ++i) {
|
||||
final View child = getVirtualChildAt(i);
|
||||
@@ -669,7 +667,6 @@ public class LinearLayout extends ViewGroup {
|
||||
}
|
||||
|
||||
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) child.getLayoutParams();
|
||||
lp.resolveLayoutDirection(layoutDirection);
|
||||
|
||||
totalWeight += lp.weight;
|
||||
|
||||
@@ -992,8 +989,6 @@ public class LinearLayout extends ViewGroup {
|
||||
|
||||
int largestChildWidth = Integer.MIN_VALUE;
|
||||
|
||||
final int layoutDirection = getLayoutDirection();
|
||||
|
||||
// See how wide everyone is. Also remember max height.
|
||||
for (int i = 0; i < count; ++i) {
|
||||
final View child = getVirtualChildAt(i);
|
||||
@@ -1014,7 +1009,6 @@ public class LinearLayout extends ViewGroup {
|
||||
|
||||
final LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams)
|
||||
child.getLayoutParams();
|
||||
lp.resolveLayoutDirection(layoutDirection);
|
||||
|
||||
totalWeight += lp.weight;
|
||||
|
||||
|
||||
@@ -414,15 +414,12 @@ public class RelativeLayout extends ViewGroup {
|
||||
final boolean isWrapContentWidth = widthMode != MeasureSpec.EXACTLY;
|
||||
final boolean isWrapContentHeight = heightMode != MeasureSpec.EXACTLY;
|
||||
|
||||
final int layoutDirection = getLayoutDirection();
|
||||
|
||||
View[] views = mSortedHorizontalChildren;
|
||||
int count = views.length;
|
||||
for (int i = 0; i < count; i++) {
|
||||
View child = views[i];
|
||||
if (child.getVisibility() != GONE) {
|
||||
LayoutParams params = (LayoutParams) child.getLayoutParams();
|
||||
params.resolveLayoutDirection(layoutDirection);
|
||||
|
||||
applyHorizontalSizeRules(params, myWidth);
|
||||
measureChildHorizontal(child, params, myWidth, myHeight);
|
||||
@@ -486,6 +483,8 @@ public class RelativeLayout extends ViewGroup {
|
||||
}
|
||||
}
|
||||
|
||||
final int layoutDirection = getLayoutDirection();
|
||||
|
||||
if (isWrapContentWidth) {
|
||||
// Width already has left padding in it since it was calculated by looking at
|
||||
// the right of each child view
|
||||
@@ -730,7 +729,6 @@ public class RelativeLayout extends ViewGroup {
|
||||
|
||||
final int layoutDirection = getLayoutDirection();
|
||||
int[] rules = params.getRules(layoutDirection);
|
||||
params.resolveLayoutDirection(layoutDirection);
|
||||
|
||||
if (params.mLeft < 0 && params.mRight >= 0) {
|
||||
// Right is fixed, but left varies
|
||||
@@ -984,7 +982,6 @@ public class RelativeLayout extends ViewGroup {
|
||||
if (child.getVisibility() != GONE) {
|
||||
RelativeLayout.LayoutParams st =
|
||||
(RelativeLayout.LayoutParams) child.getLayoutParams();
|
||||
st.resolveLayoutDirection(getLayoutDirection());
|
||||
child.layout(st.mLeft, st.mTop, st.mRight, st.mBottom);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -329,13 +329,11 @@ public class ScrollView extends FrameLayout {
|
||||
return;
|
||||
}
|
||||
|
||||
final int layoutDirection = getLayoutDirection();
|
||||
if (getChildCount() > 0) {
|
||||
final View child = getChildAt(0);
|
||||
int height = getMeasuredHeight();
|
||||
if (child.getMeasuredHeight() < height) {
|
||||
final FrameLayout.LayoutParams lp = (LayoutParams) child.getLayoutParams();
|
||||
lp.resolveLayoutDirection(layoutDirection);
|
||||
|
||||
int childWidthMeasureSpec = getChildMeasureSpec(widthMeasureSpec,
|
||||
mPaddingLeft + mPaddingRight, lp.width);
|
||||
|
||||
@@ -192,9 +192,7 @@ public class TableRow extends LinearLayout {
|
||||
int widthMeasureSpec, int totalWidth,
|
||||
int heightMeasureSpec, int totalHeight) {
|
||||
if (mConstrainedColumnWidths != null) {
|
||||
final int layoutDirection = getLayoutDirection();
|
||||
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
|
||||
lp.resolveLayoutDirection(layoutDirection);
|
||||
|
||||
int measureMode = MeasureSpec.EXACTLY;
|
||||
int columnWidth = 0;
|
||||
@@ -228,6 +226,7 @@ public class TableRow extends LinearLayout {
|
||||
final int childWidth = child.getMeasuredWidth();
|
||||
lp.mOffset[LayoutParams.LOCATION_NEXT] = columnWidth - childWidth;
|
||||
|
||||
final int layoutDirection = getLayoutDirection();
|
||||
final int absoluteGravity = Gravity.getAbsoluteGravity(gravity, layoutDirection);
|
||||
switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
|
||||
case Gravity.LEFT:
|
||||
@@ -293,13 +292,11 @@ public class TableRow extends LinearLayout {
|
||||
}
|
||||
|
||||
final int[] columnWidths = mColumnWidths;
|
||||
final int layoutDirection = getLayoutDirection();
|
||||
|
||||
for (int i = 0; i < numColumns; i++) {
|
||||
final View child = getVirtualChildAt(i);
|
||||
if (child != null && child.getVisibility() != GONE) {
|
||||
final LayoutParams layoutParams = (LayoutParams) child.getLayoutParams();
|
||||
layoutParams.resolveLayoutDirection(layoutDirection);
|
||||
if (layoutParams.span == 1) {
|
||||
int spec;
|
||||
switch (layoutParams.width) {
|
||||
|
||||
@@ -343,11 +343,9 @@ public class ActionBarContextView extends AbsActionBarView implements AnimatorLi
|
||||
final int height = maxHeight - verticalPadding;
|
||||
final int childSpecHeight = MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST);
|
||||
|
||||
final int layoutDirection = getLayoutDirection();
|
||||
if (mClose != null) {
|
||||
availableWidth = measureChildView(mClose, availableWidth, childSpecHeight, 0);
|
||||
MarginLayoutParams lp = (MarginLayoutParams) mClose.getLayoutParams();
|
||||
lp.resolveLayoutDirection(layoutDirection);
|
||||
availableWidth -= lp.leftMargin + lp.rightMargin;
|
||||
}
|
||||
|
||||
|
||||
@@ -946,9 +946,6 @@ public class ActionBarView extends AbsActionBarView {
|
||||
final ActionBar.LayoutParams ablp = lp instanceof ActionBar.LayoutParams ?
|
||||
(ActionBar.LayoutParams) lp : null;
|
||||
|
||||
final int layoutDirection = getLayoutDirection();
|
||||
lp.resolveLayoutDirection(layoutDirection);
|
||||
|
||||
int horizontalMargin = 0;
|
||||
int verticalMargin = 0;
|
||||
if (ablp != null) {
|
||||
@@ -1099,9 +1096,8 @@ public class ActionBarView extends AbsActionBarView {
|
||||
customView = mCustomNavView;
|
||||
}
|
||||
if (customView != null) {
|
||||
ViewGroup.LayoutParams lp = customView.getLayoutParams();
|
||||
final int layoutDirection = getLayoutDirection();
|
||||
lp.resolveLayoutDirection(layoutDirection);
|
||||
ViewGroup.LayoutParams lp = customView.getLayoutParams();
|
||||
final ActionBar.LayoutParams ablp = lp instanceof ActionBar.LayoutParams ?
|
||||
(ActionBar.LayoutParams) lp : null;
|
||||
final int gravity = ablp != null ? ablp.gravity : DEFAULT_CUSTOM_GRAVITY;
|
||||
@@ -1339,15 +1335,11 @@ public class ActionBarView extends AbsActionBarView {
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
measureChildWithMargins(mUpView, widthMeasureSpec, 0, heightMeasureSpec, 0);
|
||||
// measureChildWithMargins() has triggered layout params resolution, so no need
|
||||
// to do it now
|
||||
final LayoutParams upLp = (LayoutParams) mUpView.getLayoutParams();
|
||||
mUpWidth = upLp.leftMargin + mUpView.getMeasuredWidth() + upLp.rightMargin;
|
||||
int width = mUpView.getVisibility() == GONE ? 0 : mUpWidth;
|
||||
int height = upLp.topMargin + mUpView.getMeasuredHeight() + upLp.bottomMargin;
|
||||
measureChildWithMargins(mIconView, widthMeasureSpec, width, heightMeasureSpec, 0);
|
||||
// measureChildWithMargins() has triggered layout params resolution, so no need
|
||||
// to do it now
|
||||
final LayoutParams iconLp = (LayoutParams) mIconView.getLayoutParams();
|
||||
width += iconLp.leftMargin + mIconView.getMeasuredWidth() + iconLp.rightMargin;
|
||||
height = Math.max(height,
|
||||
@@ -1387,12 +1379,10 @@ public class ActionBarView extends AbsActionBarView {
|
||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||
final int vCenter = (b - t) / 2;
|
||||
final boolean isLayoutRtl = isLayoutRtl();
|
||||
final int layoutDirection = getLayoutDirection();
|
||||
final int width = getWidth();
|
||||
int upOffset = 0;
|
||||
if (mUpView.getVisibility() != GONE) {
|
||||
final LayoutParams upLp = (LayoutParams) mUpView.getLayoutParams();
|
||||
upLp.resolveLayoutDirection(layoutDirection);
|
||||
final int upHeight = mUpView.getMeasuredHeight();
|
||||
final int upWidth = mUpView.getMeasuredWidth();
|
||||
upOffset = upLp.leftMargin + upWidth + upLp.rightMargin;
|
||||
@@ -1413,7 +1403,6 @@ public class ActionBarView extends AbsActionBarView {
|
||||
}
|
||||
|
||||
final LayoutParams iconLp = (LayoutParams) mIconView.getLayoutParams();
|
||||
iconLp.resolveLayoutDirection(layoutDirection);
|
||||
final int iconHeight = mIconView.getMeasuredHeight();
|
||||
final int iconWidth = mIconView.getMeasuredWidth();
|
||||
final int hCenter = (r - l) / 2;
|
||||
|
||||
Reference in New Issue
Block a user