Loading core/java/android/widget/RelativeLayout.java +5 −13 Original line number Diff line number Diff line Loading @@ -37,7 +37,6 @@ import android.view.Gravity; import android.view.View; import android.view.ViewDebug; import android.view.ViewGroup; import android.view.WindowManager; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.RemoteViews.RemoteView; Loading Loading @@ -221,13 +220,13 @@ public class RelativeLayout extends ViewGroup { // Some apps came to rely on them. :( private boolean mAllowBrokenMeasureSpecs = false; private int mDisplayWidth; // A default width used for RTL measure pass private static int DEFAULT_WIDTH = Integer.MAX_VALUE / 2; public RelativeLayout(Context context) { super(context); mAllowBrokenMeasureSpecs = context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.JELLY_BEAN_MR1; getDisplayWidth(); } public RelativeLayout(Context context, AttributeSet attrs) { Loading @@ -235,7 +234,6 @@ public class RelativeLayout extends ViewGroup { initFromAttributes(context, attrs); mAllowBrokenMeasureSpecs = context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.JELLY_BEAN_MR1; getDisplayWidth(); } public RelativeLayout(Context context, AttributeSet attrs, int defStyle) { Loading @@ -243,7 +241,6 @@ public class RelativeLayout extends ViewGroup { initFromAttributes(context, attrs); mAllowBrokenMeasureSpecs = context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.JELLY_BEAN_MR1; getDisplayWidth(); } private void initFromAttributes(Context context, AttributeSet attrs) { Loading @@ -253,11 +250,6 @@ public class RelativeLayout extends ViewGroup { a.recycle(); } private void getDisplayWidth() { WindowManager wm = (WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE); mDisplayWidth = wm.getDefaultDisplay().getWidth(); } @Override public boolean shouldDelayChildPressedState() { return false; Loading Loading @@ -451,12 +443,12 @@ public class RelativeLayout extends ViewGroup { // We need to know our size for doing the correct computation of children positioning in RTL // mode but there is no practical way to get it instead of running the code below. // So, instead of running the code twice, we just set the width to the "display width" // So, instead of running the code twice, we just set the width to a "default display width" // before the computation and then, as a last pass, we will update their real position with // an offset equals to "displayWidth - width". // an offset equals to "DEFAULT_WIDTH - width". final int layoutDirection = getLayoutDirection(); if (isLayoutRtl() && myWidth == -1) { myWidth = mDisplayWidth; myWidth = DEFAULT_WIDTH; } View[] views = mSortedHorizontalChildren; Loading Loading
core/java/android/widget/RelativeLayout.java +5 −13 Original line number Diff line number Diff line Loading @@ -37,7 +37,6 @@ import android.view.Gravity; import android.view.View; import android.view.ViewDebug; import android.view.ViewGroup; import android.view.WindowManager; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.RemoteViews.RemoteView; Loading Loading @@ -221,13 +220,13 @@ public class RelativeLayout extends ViewGroup { // Some apps came to rely on them. :( private boolean mAllowBrokenMeasureSpecs = false; private int mDisplayWidth; // A default width used for RTL measure pass private static int DEFAULT_WIDTH = Integer.MAX_VALUE / 2; public RelativeLayout(Context context) { super(context); mAllowBrokenMeasureSpecs = context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.JELLY_BEAN_MR1; getDisplayWidth(); } public RelativeLayout(Context context, AttributeSet attrs) { Loading @@ -235,7 +234,6 @@ public class RelativeLayout extends ViewGroup { initFromAttributes(context, attrs); mAllowBrokenMeasureSpecs = context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.JELLY_BEAN_MR1; getDisplayWidth(); } public RelativeLayout(Context context, AttributeSet attrs, int defStyle) { Loading @@ -243,7 +241,6 @@ public class RelativeLayout extends ViewGroup { initFromAttributes(context, attrs); mAllowBrokenMeasureSpecs = context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.JELLY_BEAN_MR1; getDisplayWidth(); } private void initFromAttributes(Context context, AttributeSet attrs) { Loading @@ -253,11 +250,6 @@ public class RelativeLayout extends ViewGroup { a.recycle(); } private void getDisplayWidth() { WindowManager wm = (WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE); mDisplayWidth = wm.getDefaultDisplay().getWidth(); } @Override public boolean shouldDelayChildPressedState() { return false; Loading Loading @@ -451,12 +443,12 @@ public class RelativeLayout extends ViewGroup { // We need to know our size for doing the correct computation of children positioning in RTL // mode but there is no practical way to get it instead of running the code below. // So, instead of running the code twice, we just set the width to the "display width" // So, instead of running the code twice, we just set the width to a "default display width" // before the computation and then, as a last pass, we will update their real position with // an offset equals to "displayWidth - width". // an offset equals to "DEFAULT_WIDTH - width". final int layoutDirection = getLayoutDirection(); if (isLayoutRtl() && myWidth == -1) { myWidth = mDisplayWidth; myWidth = DEFAULT_WIDTH; } View[] views = mSortedHorizontalChildren; Loading