Merge change 8218 into donut
* changes: DrawableContainer was not respecting the value returned by Drawable.getPadding(Rect).
This commit is contained in:
@@ -272,6 +272,8 @@ public class DrawableContainer extends Drawable implements Drawable.Callback {
|
|||||||
boolean mCheckedConstantState;
|
boolean mCheckedConstantState;
|
||||||
boolean mCanConstantState;
|
boolean mCanConstantState;
|
||||||
|
|
||||||
|
boolean mPaddingChecked = false;
|
||||||
|
|
||||||
DrawableContainerState(DrawableContainerState orig, DrawableContainer owner) {
|
DrawableContainerState(DrawableContainerState orig, DrawableContainer owner) {
|
||||||
mOwner = owner;
|
mOwner = owner;
|
||||||
|
|
||||||
@@ -334,6 +336,7 @@ public class DrawableContainer extends Drawable implements Drawable.Callback {
|
|||||||
mHaveStateful = false;
|
mHaveStateful = false;
|
||||||
|
|
||||||
mConstantPadding = null;
|
mConstantPadding = null;
|
||||||
|
mPaddingChecked = false;
|
||||||
mComputedConstantSize = false;
|
mComputedConstantSize = false;
|
||||||
|
|
||||||
return pos;
|
return pos;
|
||||||
@@ -359,22 +362,24 @@ public class DrawableContainer extends Drawable implements Drawable.Callback {
|
|||||||
if (mVariablePadding) {
|
if (mVariablePadding) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (mConstantPadding != null) {
|
if (mConstantPadding != null || mPaddingChecked) {
|
||||||
return mConstantPadding;
|
return mConstantPadding;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Rect r = new Rect(0, 0, 0, 0);
|
Rect r = null;
|
||||||
final Rect t = new Rect();
|
final Rect t = new Rect();
|
||||||
final int N = getChildCount();
|
final int N = getChildCount();
|
||||||
final Drawable[] drawables = mDrawables;
|
final Drawable[] drawables = mDrawables;
|
||||||
for (int i = 0; i < N; i++) {
|
for (int i = 0; i < N; i++) {
|
||||||
if (drawables[i].getPadding(t)) {
|
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.left > r.left) r.left = t.left;
|
||||||
if (t.top > r.top) r.top = t.top;
|
if (t.top > r.top) r.top = t.top;
|
||||||
if (t.right > r.right) r.right = t.right;
|
if (t.right > r.right) r.right = t.right;
|
||||||
if (t.bottom > r.bottom) r.bottom = t.bottom;
|
if (t.bottom > r.bottom) r.bottom = t.bottom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mPaddingChecked = true;
|
||||||
return (mConstantPadding = r);
|
return (mConstantPadding = r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user