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

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

Merge "Add View.onResolvePadding() as a public API"

parents b9345b94 ccb1562e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -23310,6 +23310,7 @@ package android.view {
    method protected void onMeasure(int, int);
    method protected void onOverScrolled(int, int, boolean, boolean);
    method public void onPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent);
    method public void onResolvePadding(int);
    method protected void onRestoreInstanceState(android.os.Parcelable);
    method protected android.os.Parcelable onSaveInstanceState();
    method protected void onScrollChanged(int, int, int, int);
@@ -23345,6 +23346,7 @@ package android.view {
    method public boolean requestRectangleOnScreen(android.graphics.Rect);
    method public boolean requestRectangleOnScreen(android.graphics.Rect, boolean);
    method protected void resetResolvedTextDirection();
    method public void resolvePadding();
    method public static int resolveSize(int, int);
    method public static int resolveSizeAndState(int, int, int);
    method protected void resolveTextDirection();
+18 −3
Original line number Diff line number Diff line
@@ -9580,14 +9580,15 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
    }
    /**
     * @hide
     * Force padding depending on layout direction.
     */
    protected void resolvePadding() {
    public void resolvePadding() {
        // If the user specified the absolute padding (either with android:padding or
        // android:paddingLeft/Top/Right/Bottom), use this padding, otherwise
        // use the default padding or the padding from the background drawable
        // (stored at this point in mPadding*)
        switch (getResolvedLayoutDirection()) {
        int resolvedLayoutDirection = getResolvedLayoutDirection();
        switch (resolvedLayoutDirection) {
            case LAYOUT_DIRECTION_RTL:
                // Start user padding override Right user padding. Otherwise, if Right user
                // padding is not defined, use the default Right padding. If Right user padding
@@ -9623,6 +9624,20 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
        mUserPaddingBottom = (mUserPaddingBottom >= 0) ? mUserPaddingBottom : mPaddingBottom;
        recomputePadding();
        onResolvePadding(resolvedLayoutDirection);
    }
    /**
     * Resolve padding depending on the layout direction. Subclasses that care about
     * padding resolution should override this method. The default implementation does
     * nothing.
     *
     * @param layoutDirection the direction of the layout
     *
     * {@link View#LAYOUT_DIRECTION_LTR}
     * {@link View#LAYOUT_DIRECTION_RTL}
     */
    public void onResolvePadding(int layoutDirection) {
    }
    /**
+1 −5
Original line number Diff line number Diff line
@@ -142,12 +142,8 @@ public class CheckedTextView extends TextView implements Checkable {
        resolvePadding();
    }

    /**
     * @hide
     */
    @Override
    protected void resolvePadding() {
        super.resolvePadding();
    public void onResolvePadding(int layoutDirection) {
        int newPadding = (mCheckMarkDrawable != null) ?
                mCheckMarkWidth + mBasePadding : mBasePadding;
        mNeedRequestlayout |= (mPaddingRight != newPadding);