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

Commit 59c25cba authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 8218 into donut

* changes:
  DrawableContainer was not respecting the value returned by Drawable.getPadding(Rect).
parents 7228d0fd 5140141c
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -272,6 +272,8 @@ public class DrawableContainer extends Drawable implements Drawable.Callback {
        boolean     mCheckedConstantState;
        boolean     mCanConstantState;

        boolean     mPaddingChecked = false;

        DrawableContainerState(DrawableContainerState orig, DrawableContainer owner) {
            mOwner = owner;

@@ -334,6 +336,7 @@ public class DrawableContainer extends Drawable implements Drawable.Callback {
            mHaveStateful = false;

            mConstantPadding = null;
            mPaddingChecked = false;
            mComputedConstantSize = false;

            return pos;
@@ -359,22 +362,24 @@ public class DrawableContainer extends Drawable implements Drawable.Callback {
            if (mVariablePadding) {
                return null;
            }
            if (mConstantPadding != null) {
            if (mConstantPadding != null || mPaddingChecked) {
                return mConstantPadding;
            }

            final Rect r = new Rect(0, 0, 0, 0);
            Rect r = null;
            final Rect t = new Rect();
            final int N = getChildCount();
            final Drawable[] drawables = mDrawables;
            for (int i = 0; i < N; i++) {
                if (drawables[i].getPadding(t)) {
                    if (r == null) r = new Rect(0, 0, 0, 0);
                    if (t.left > r.left) r.left = t.left;
                    if (t.top > r.top) r.top = t.top;
                    if (t.right > r.right) r.right = t.right;
                    if (t.bottom > r.bottom) r.bottom = t.bottom;
                }
            }
            mPaddingChecked = true;
            return (mConstantPadding = r);
        }