am ec139240: Merge "Fix bug #7325234 LayoutParams are not resolved correctly (Settings apps looks broken on Manta in Arabic)" into jb-mr1-dev
* commit 'ec139240480702e80cd56c0309394f7549a993f3': Fix bug #7325234 LayoutParams are not resolved correctly (Settings apps looks broken on Manta in Arabic)
This commit is contained in:
@@ -4817,6 +4817,8 @@ 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,11 +304,16 @@ 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,
|
||||
|
||||
@@ -414,12 +414,15 @@ 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);
|
||||
@@ -483,8 +486,6 @@ 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
|
||||
|
||||
@@ -329,11 +329,13 @@ 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,7 +192,9 @@ 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;
|
||||
@@ -226,7 +228,6 @@ 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:
|
||||
@@ -292,11 +293,13 @@ 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,9 +343,11 @@ 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,6 +946,9 @@ 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) {
|
||||
@@ -1096,9 +1099,9 @@ public class ActionBarView extends AbsActionBarView {
|
||||
customView = mCustomNavView;
|
||||
}
|
||||
if (customView != null) {
|
||||
final int resolvedLayoutDirection = getLayoutDirection();
|
||||
ViewGroup.LayoutParams lp = customView.getLayoutParams();
|
||||
lp.resolveLayoutDirection(resolvedLayoutDirection);
|
||||
final int layoutDirection = getLayoutDirection();
|
||||
lp.resolveLayoutDirection(layoutDirection);
|
||||
final ActionBar.LayoutParams ablp = lp instanceof ActionBar.LayoutParams ?
|
||||
(ActionBar.LayoutParams) lp : null;
|
||||
final int gravity = ablp != null ? ablp.gravity : DEFAULT_CUSTOM_GRAVITY;
|
||||
@@ -1139,7 +1142,7 @@ public class ActionBarView extends AbsActionBarView {
|
||||
}
|
||||
|
||||
int xpos = 0;
|
||||
switch (Gravity.getAbsoluteGravity(hgravity, resolvedLayoutDirection)) {
|
||||
switch (Gravity.getAbsoluteGravity(hgravity, layoutDirection)) {
|
||||
case Gravity.CENTER_HORIZONTAL:
|
||||
xpos = ((mRight - mLeft) - navWidth) / 2;
|
||||
break;
|
||||
@@ -1336,11 +1339,15 @@ 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,
|
||||
|
||||
Reference in New Issue
Block a user