Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7f86c806 authored by Fabrice Di Meglio's avatar Fabrice Di Meglio
Browse files

Fix View reset of layoutDirection and textDirection

- do it in onDetachedFromWindow()
- make naming consistent too
- update unit tests

Change-Id: I320fcdbf75166bae793c4409e7344608b696667f
parent f81673d7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -22740,7 +22740,7 @@ package android.view {
    method public void requestDisallowInterceptTouchEvent(boolean);
    method public boolean requestSendAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent);
    method public void requestTransparentRegion(android.view.View);
    method protected void resetLayoutDirectionResolution();
    method protected void resetResolvedLayoutDirection();
    method public void scheduleLayoutAnimation();
    method public void setAddStatesFromChildren(boolean);
    method public void setAlwaysDrawnWithCacheEnabled(boolean);
@@ -26417,7 +26417,7 @@ package android.widget {
    method protected void onTextChanged(java.lang.CharSequence, int, int, int);
    method public boolean onTextContextMenuItem(int);
    method public void removeTextChangedListener(android.text.TextWatcher);
    method protected void resetLayoutDirectionResolution();
    method protected void resetResolvedLayoutDirection();
    method public void setAllCaps(boolean);
    method public final void setAutoLinkMask(int);
    method public void setCompoundDrawablePadding(int);
+5 −4
Original line number Diff line number Diff line
@@ -4474,7 +4474,7 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit
    @RemotableViewMethod
    public void setLayoutDirection(int layoutDirection) {
        if (getLayoutDirection() != layoutDirection) {
            resetLayoutDirectionResolution();
            resetResolvedLayoutDirection();
            // Setting the flag will also request a layout.
            setFlags(layoutDirection, LAYOUT_DIRECTION_MASK);
        }
@@ -9043,10 +9043,8 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit
            mPrivateFlags &= ~AWAKEN_SCROLL_BARS_ON_ATTACH;
        }
        jumpDrawablesToCurrentState();
        resetLayoutDirectionResolution();
        resolveLayoutDirectionIfNeeded();
        resolvePadding();
        resetResolvedTextDirection();
        resolveTextDirection();
        if (isFocused()) {
            InputMethodManager imm = InputMethodManager.peekInstance();
@@ -9143,7 +9141,7 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit
     *
     * @hide
     */
    protected void resetLayoutDirectionResolution() {
    protected void resetResolvedLayoutDirection() {
        // Reset the current View resolution
        mPrivateFlags2 &= ~LAYOUT_DIRECTION_RESOLVED;
    }
@@ -9190,6 +9188,9 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit
        }

        mCurrentAnimation = null;

        resetResolvedLayoutDirection();
        resetResolvedTextDirection();
    }

    /**
+3 −3
Original line number Diff line number Diff line
@@ -4999,15 +4999,15 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
    }

    @Override
    protected void resetLayoutDirectionResolution() {
        super.resetLayoutDirectionResolution();
    protected void resetResolvedLayoutDirection() {
        super.resetResolvedLayoutDirection();

        // 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();
                child.resetResolvedLayoutDirection();
            }
        }
    }
+2 −2
Original line number Diff line number Diff line
@@ -5571,8 +5571,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
    }

    @Override
    protected void resetLayoutDirectionResolution() {
        super.resetLayoutDirectionResolution();
    protected void resetResolvedLayoutDirection() {
        super.resetResolvedLayoutDirection();

        if (mLayoutAlignment != null &&
                (mTextAlign == TextAlign.VIEW_START ||
+7 −0
Original line number Diff line number Diff line
@@ -1051,6 +1051,13 @@
            </intent-filter>
        </activity>

        <activity android:name="android.widget.TextViewTestActivity" android:label="TextViewTestActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
            </intent-filter>
        </activity>



        <!-- Activity-level metadata -->
Loading