Loading core/java/android/view/View.java +10 −3 Original line number Diff line number Diff line Loading @@ -4345,20 +4345,26 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit } /** * Set the layout direction for this view. * Set the layout direction for this view. This will propagate a reset of layout direction * resolution to the view's children and resolve layout direction for this view. * * @param layoutDirection One of {@link #LAYOUT_DIRECTION_LTR}, * {@link #LAYOUT_DIRECTION_RTL}, * {@link #LAYOUT_DIRECTION_INHERIT} or * {@link #LAYOUT_DIRECTION_LOCALE}. * * @attr ref android.R.styleable#View_layoutDirection * * @hide */ @RemotableViewMethod public void setLayoutDirection(int layoutDirection) { if (getLayoutDirection() != layoutDirection) { resetLayoutDirectionResolution(); // Setting the flag will also request a layout. setFlags(layoutDirection, LAYOUT_DIRECTION_MASK); } } /** * Returns the resolved layout direction for this view. Loading Loading @@ -8988,7 +8994,8 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit /** * Reset the resolved layout direction by clearing the corresponding flag */ private void resetLayoutDirectionResolution() { void resetLayoutDirectionResolution() { // Reset the current View resolution mPrivateFlags2 &= ~LAYOUT_DIRECTION_RESOLVED; } Loading core/java/android/view/ViewGroup.java +18 −0 Original line number Diff line number Diff line Loading @@ -4997,6 +4997,24 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager viewAncestor.requestTransitionStart(transition); } /** * This method will be called when we need to reset the layout direction resolution flag * */ @Override void resetLayoutDirectionResolution() { super.resetLayoutDirectionResolution(); // Take care of resetting the children resolution too final int count = getChildCount(); for (int i = 0; i < count; i++) { final View child = getChildAt(i); if (child.getLayoutDirection() == LAYOUT_DIRECTION_INHERIT) { child.resetLayoutDirectionResolution(); } } } /** * Return true if the pressed state should be delayed for children or descendants of this * ViewGroup. Generally, this should be done for containers that can scroll, such as a List. Loading Loading
core/java/android/view/View.java +10 −3 Original line number Diff line number Diff line Loading @@ -4345,20 +4345,26 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit } /** * Set the layout direction for this view. * Set the layout direction for this view. This will propagate a reset of layout direction * resolution to the view's children and resolve layout direction for this view. * * @param layoutDirection One of {@link #LAYOUT_DIRECTION_LTR}, * {@link #LAYOUT_DIRECTION_RTL}, * {@link #LAYOUT_DIRECTION_INHERIT} or * {@link #LAYOUT_DIRECTION_LOCALE}. * * @attr ref android.R.styleable#View_layoutDirection * * @hide */ @RemotableViewMethod public void setLayoutDirection(int layoutDirection) { if (getLayoutDirection() != layoutDirection) { resetLayoutDirectionResolution(); // Setting the flag will also request a layout. setFlags(layoutDirection, LAYOUT_DIRECTION_MASK); } } /** * Returns the resolved layout direction for this view. Loading Loading @@ -8988,7 +8994,8 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit /** * Reset the resolved layout direction by clearing the corresponding flag */ private void resetLayoutDirectionResolution() { void resetLayoutDirectionResolution() { // Reset the current View resolution mPrivateFlags2 &= ~LAYOUT_DIRECTION_RESOLVED; } Loading
core/java/android/view/ViewGroup.java +18 −0 Original line number Diff line number Diff line Loading @@ -4997,6 +4997,24 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager viewAncestor.requestTransitionStart(transition); } /** * This method will be called when we need to reset the layout direction resolution flag * */ @Override void resetLayoutDirectionResolution() { super.resetLayoutDirectionResolution(); // Take care of resetting the children resolution too final int count = getChildCount(); for (int i = 0; i < count; i++) { final View child = getChildAt(i); if (child.getLayoutDirection() == LAYOUT_DIRECTION_INHERIT) { child.resetLayoutDirectionResolution(); } } } /** * Return true if the pressed state should be delayed for children or descendants of this * ViewGroup. Generally, this should be done for containers that can scroll, such as a List. Loading