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

Commit ff18d86c authored by shepshapard's avatar shepshapard
Browse files

Improved padding code comments in View.java

This was done in preparation for making changes related to
@UnsupportedAppUsage while trying to understand the semantics
of certain fields and the methods that use or modify them.

Bug: 123768420
Bug: 123768921
Test: No code changes.

Change-Id: I449be366906100c385ee610ce33953ddf0fb4ef0
parent bdda90fc
Loading
Loading
Loading
Loading
+25 −17
Original line number Diff line number Diff line
@@ -4250,32 +4250,32 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    protected int mScrollY;
    /**
     * The left padding in pixels, that is the distance in pixels between the
     * left edge of this view and the left edge of its content.
     * The final computed left padding in pixels that is used for drawing. This is the distance in
     * pixels between the left edge of this view and the left edge of its content.
     * {@hide}
     */
    @ViewDebug.ExportedProperty(category = "padding")
    @UnsupportedAppUsage
    protected int mPaddingLeft = 0;
    /**
     * The right padding in pixels, that is the distance in pixels between the
     * right edge of this view and the right edge of its content.
     * The final computed right padding in pixels that is used for drawing. This is the distance in
     * pixels between the right edge of this view and the right edge of its content.
     * {@hide}
     */
    @ViewDebug.ExportedProperty(category = "padding")
    @UnsupportedAppUsage
    protected int mPaddingRight = 0;
    /**
     * The top padding in pixels, that is the distance in pixels between the
     * top edge of this view and the top edge of its content.
     * The final computed top padding in pixels that is used for drawing. This is the distance in
     * pixels between the top edge of this view and the top edge of its content.
     * {@hide}
     */
    @ViewDebug.ExportedProperty(category = "padding")
    @UnsupportedAppUsage
    protected int mPaddingTop;
    /**
     * The bottom padding in pixels, that is the distance in pixels between the
     * bottom edge of this view and the bottom edge of its content.
     * The final computed bottom padding in pixels that is used for drawing. This is the distance in
     * pixels between the bottom edge of this view and the bottom edge of its content.
     * {@hide}
     */
    @ViewDebug.ExportedProperty(category = "padding")
@@ -4327,7 +4327,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    private MatchIdPredicate mMatchIdPredicate;
    /**
     * Cache the paddingRight set by the user to append to the scrollbar's size.
     * The right padding after RTL resolution, but before taking account of scroll bars.
     *
     * @hide
     */
@@ -4335,7 +4335,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    protected int mUserPaddingRight;
    /**
     * Cache the paddingBottom set by the user to append to the scrollbar's size.
     * The resolved bottom padding before taking account of scroll bars.
     *
     * @hide
     */
@@ -4343,7 +4343,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    protected int mUserPaddingBottom;
    /**
     * Cache the paddingLeft set by the user to append to the scrollbar's size.
     * The left padding after RTL resolution, but before taking account of scroll bars.
     *
     * @hide
     */
@@ -4365,14 +4365,16 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    int mUserPaddingEnd;
    /**
     * Cache initial left padding.
     * The left padding as set by a setter method, a background's padding, or via XML property
     * resolution. This value is the padding before LTR resolution or taking account of scrollbars.
     *
     * @hide
     */
    int mUserPaddingLeftInitial;
    /**
     * Cache initial right padding.
     * The right padding as set by a setter method, a background's padding, or via XML property
     * resolution. This value is the padding before LTR resolution or taking account of scrollbars.
     *
     * @hide
     */
@@ -4384,12 +4386,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    private static final int UNDEFINED_PADDING = Integer.MIN_VALUE;
    /**
     * Cache if a left padding has been defined
     * Cache if a left padding has been defined explicitly via padding, horizontal padding,
     * or leftPadding in XML, or by setPadding(...) or setRelativePadding(...)
     */
    private boolean mLeftPaddingDefined = false;
    /**
     * Cache if a right padding has been defined
     * Cache if a right padding has been defined explicitly via padding, horizontal padding,
     * or rightPadding in XML, or by setPadding(...) or setRelativePadding(...)
     */
    private boolean mRightPaddingDefined = false;
@@ -5759,7 +5763,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        setOverScrollMode(overScrollMode);
        // Cache start/end user padding as we cannot fully resolve padding here (we dont have yet
        // Cache start/end user padding as we cannot fully resolve padding here (we don't have yet
        // the resolved layout direction). Those cached values will be used later during padding
        // resolution.
        mUserPaddingStart = startPadding;
@@ -5774,6 +5778,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        mLeftPaddingDefined = leftPaddingDefined;
        mRightPaddingDefined = rightPaddingDefined;
        // Valid paddingHorizontal/paddingVertical beats leftPadding, rightPadding, topPadding,
        // bottomPadding, and padding set by background.  Valid padding beats everything.
        if (padding >= 0) {
            leftPadding = padding;
            topPadding = padding;
@@ -5826,6 +5832,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
            }
        }
        // mPaddingTop and mPaddingBottom may have been set by setBackground(Drawable) so must pass
        // them on if topPadding or bottomPadding are not valid.
        internalSetPadding(
                mUserPaddingLeftInitial,
                topPadding >= 0 ? topPadding : mPaddingTop,