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

Commit 7d3c690e authored by Fabrice Di Meglio's avatar Fabrice Di Meglio Committed by Android (Google) Code Review
Browse files

Merge "Improve RTL APIs"

parents 2900116e dd3ef2c5
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -23344,10 +23344,12 @@ package android.view {
    method protected void onLayout(boolean, int, int, int, int);
    method protected void onMeasure(int, int);
    method protected void onOverScrolled(int, int, boolean, boolean);
    method public void onPaddingChanged(int);
    method public void onPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent);
    method public void onResetResolvedTextDirection();
    method public void onResolvePadding(int);
    method public void onResolveTextDirection();
    method public void onResolvedLayoutDirectionChanged();
    method public void onResolvedLayoutDirectionReset();
    method public void onResolvedTextDirectionChanged();
    method public void onResolvedTextDirectionReset();
    method protected void onRestoreInstanceState(android.os.Parcelable);
    method protected android.os.Parcelable onSaveInstanceState();
    method protected void onScrollChanged(int, int, int, int);
+36 −16
Original line number Diff line number Diff line
@@ -9598,10 +9598,19 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
        // Set to resolved
        mPrivateFlags2 |= LAYOUT_DIRECTION_RESOLVED;
        onResolvedLayoutDirectionChanged();
    }
    /**
     * Force padding depending on layout direction.
     * Called when layout direction has been resolved.
     *
     * The default implementation does nothing.
     */
    public void onResolvedLayoutDirectionChanged() {
    }
    /**
     * Resolve padding depending on layout direction.
     */
    public void resolvePadding() {
        // If the user specified the absolute padding (either with android:padding or
@@ -9645,7 +9654,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
        mUserPaddingBottom = (mUserPaddingBottom >= 0) ? mUserPaddingBottom : mPaddingBottom;
        recomputePadding();
        onResolvePadding(resolvedLayoutDirection);
        onPaddingChanged(resolvedLayoutDirection);
    }
    /**
@@ -9656,7 +9665,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
     * @param layoutDirection the direction of the layout
     *
     */
    public void onResolvePadding(int layoutDirection) {
    public void onPaddingChanged(int layoutDirection) {
    }
    /**
@@ -9674,19 +9683,28 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
    }
    /**
     * Reset the resolved layout direction.
     *
     * Subclasses need to override this method to clear cached information that depends on the
     * resolved layout direction, or to inform child views that inherit their layout direction.
     * Overrides must also call the superclass implementation at the start of their implementation.
     * Reset the resolved layout direction. Will call {@link View#onResolvedLayoutDirectionReset}
     * when reset is done.
     */
    public void resetResolvedLayoutDirection() {
        // Reset the current View resolution
        mPrivateFlags2 &= ~LAYOUT_DIRECTION_RESOLVED;
        onResolvedLayoutDirectionReset();
        // Reset also the text direction
        resetResolvedTextDirection();
    }
    /**
     * Called during reset of resolved layout direction.
     *
     * Subclasses need to override this method to clear cached information that depends on the
     * resolved layout direction, or to inform child views that inherit their layout direction.
     *
     * The default implementation does nothing.
     */
    public void onResolvedLayoutDirectionReset() {
    }
    /**
     * Check if a Locale uses an RTL script.
     *
@@ -14137,8 +14155,8 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
    }
    /**
     * Resolve the text direction. Will call {@link View#onResolveTextDirection()} when resolution
     * is done.
     * Resolve the text direction. Will call {@link View#onResolvedTextDirectionChanged} when
     * resolution is done.
     */
    public void resolveTextDirection() {
        if (mResolvedTextDirection != TEXT_DIRECTION_INHERIT) {
@@ -14152,24 +14170,26 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
        } else {
            mResolvedTextDirection = TEXT_DIRECTION_FIRST_STRONG;
        }
        onResolveTextDirection();
        onResolvedTextDirectionChanged();
    }
    /**
     * Called when text direction has been resolved. Subclasses that care about text direction
     * resolution should override this method. The default implementation does nothing.
     * resolution should override this method.
     *
     * The default implementation does nothing.
     */
    public void onResolveTextDirection() {
    public void onResolvedTextDirectionChanged() {
    }
    /**
     * Reset resolved text direction. Text direction can be resolved with a call to
     * getResolvedTextDirection(). Will call {@link View#onResetResolvedTextDirection()} when
     * getResolvedTextDirection(). Will call {@link View#onResolvedTextDirectionReset} when
     * reset is done.
     */
    public void resetResolvedTextDirection() {
        mResolvedTextDirection = TEXT_DIRECTION_INHERIT;
        onResetResolvedTextDirection();
        onResolvedTextDirectionReset();
    }
    /**
@@ -14177,7 +14197,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
     * override this method and do a reset of the text direction of their children. The default
     * implementation does nothing.
     */
    public void onResetResolvedTextDirection() {
    public void onResolvedTextDirectionReset() {
    }
    //
+2 −4
Original line number Diff line number Diff line
@@ -4920,9 +4920,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
    }

    @Override
    public void resetResolvedLayoutDirection() {
        super.resetResolvedLayoutDirection();

    public void onResolvedLayoutDirectionReset() {
        // Take care of resetting the children resolution too
        final int count = getChildCount();
        for (int i = 0; i < count; i++) {
@@ -4934,7 +4932,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
    }

    @Override
    public void onResetResolvedTextDirection() {
    public void onResolvedTextDirectionReset() {
        // Take care of resetting the children resolution too
        final int count = getChildCount();
        for (int i = 0; i < count; i++) {
+1 −1
Original line number Diff line number Diff line
@@ -143,7 +143,7 @@ public class CheckedTextView extends TextView implements Checkable {
    }

    @Override
    public void onResolvePadding(int layoutDirection) {
    public void onPaddingChanged(int layoutDirection) {
        int newPadding = (mCheckMarkDrawable != null) ?
                mCheckMarkWidth + mBasePadding : mBasePadding;
        mNeedRequestlayout |= (mPaddingRight != newPadding);
+1 −1
Original line number Diff line number Diff line
@@ -8715,7 +8715,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
    }

    @Override
    public void onResolveTextDirection() {
    public void onResolvedTextDirectionChanged() {
        if (hasPasswordTransformationMethod()) {
            // TODO: take care of the content direction to show the password text and dots justified
            // to the left or to the right