Constructors Summary |
---|
InsetDrawable()
/*package*/
this(null);
|
public InsetDrawable(Drawable drawable, int inset)
this(drawable, inset, inset, inset, inset);
|
private InsetDrawable(InsetState state)
mInsetState = new InsetState(state, this);
|
public InsetDrawable(Drawable drawable, int insetLeft, int insetTop, int insetRight, int insetBottom)
this(null);
mInsetState.mDrawable = drawable;
mInsetState.mInsetLeft = insetLeft;
mInsetState.mInsetTop = insetTop;
mInsetState.mInsetRight = insetRight;
mInsetState.mInsetBottom = insetBottom;
if (drawable != null) {
drawable.setCallback(this);
}
|
Methods Summary |
---|
public void | draw(Canvas canvas)
mInsetState.mDrawable.draw(canvas);
|
public int | getChangingConfigurations()
return super.getChangingConfigurations()
| mInsetState.mChangingConfigurations
| mInsetState.mDrawable.getChangingConfigurations();
|
public ConstantState | getConstantState()
if (mInsetState.canConstantState()) {
mInsetState.mChangingConfigurations = super.getChangingConfigurations();
return mInsetState;
}
return null;
|
public int | getIntrinsicHeight()
return mInsetState.mDrawable.getIntrinsicHeight();
|
public int | getIntrinsicWidth()
return mInsetState.mDrawable.getIntrinsicWidth();
|
public int | getOpacity()
return mInsetState.mDrawable.getOpacity();
|
public boolean | getPadding(Rect padding)
boolean pad = mInsetState.mDrawable.getPadding(padding);
padding.left += mInsetState.mInsetLeft;
padding.right += mInsetState.mInsetRight;
padding.top += mInsetState.mInsetTop;
padding.bottom += mInsetState.mInsetBottom;
if (pad || (mInsetState.mInsetLeft | mInsetState.mInsetRight |
mInsetState.mInsetTop | mInsetState.mInsetBottom) != 0) {
return true;
} else {
return false;
}
|
public void | inflate(android.content.res.Resources r, org.xmlpull.v1.XmlPullParser parser, android.util.AttributeSet attrs)
int type;
TypedArray a = r.obtainAttributes(attrs,
com.android.internal.R.styleable.InsetDrawable);
super.inflateWithAttributes(r, parser, a,
com.android.internal.R.styleable.InsetDrawable_visible);
int drawableRes = a.getResourceId(com.android.internal.R.styleable.
InsetDrawable_drawable, 0);
int inLeft = a.getDimensionPixelOffset(com.android.internal.R.styleable.
InsetDrawable_insetLeft, 0);
int inTop = a.getDimensionPixelOffset(com.android.internal.R.styleable.
InsetDrawable_insetTop, 0);
int inRight = a.getDimensionPixelOffset(com.android.internal.R.styleable.
InsetDrawable_insetRight, 0);
int inBottom = a.getDimensionPixelOffset(com.android.internal.R.styleable.
InsetDrawable_insetBottom, 0);
a.recycle();
Drawable dr;
if (drawableRes != 0) {
dr = r.getDrawable(drawableRes);
} else {
while ((type=parser.next()) == XmlPullParser.TEXT) {
}
if (type != XmlPullParser.START_TAG) {
throw new XmlPullParserException(
parser.getPositionDescription()
+ ": <inset> tag requires a 'drawable' attribute or "
+ "child tag defining a drawable");
}
dr = Drawable.createFromXmlInner(r, parser, attrs);
}
if (dr == null) {
Log.w("drawable", "No drawable specified for <inset>");
}
mInsetState.mDrawable = dr;
mInsetState.mInsetLeft = inLeft;
mInsetState.mInsetRight = inRight;
mInsetState.mInsetTop = inTop;
mInsetState.mInsetBottom = inBottom;
if (dr != null) {
dr.setCallback(this);
}
|
public void | invalidateDrawable(Drawable who)
if (mCallback != null) {
mCallback.invalidateDrawable(this);
}
|
public boolean | isStateful()
return mInsetState.mDrawable.isStateful();
|
public Drawable | mutate()
if (!mMutated && super.mutate() == this) {
mInsetState.mDrawable.mutate();
mMutated = true;
}
return this;
|
protected void | onBoundsChange(Rect bounds)
final Rect r = mTmpRect;
r.set(bounds);
r.left += mInsetState.mInsetLeft;
r.top += mInsetState.mInsetTop;
r.right -= mInsetState.mInsetRight;
r.bottom -= mInsetState.mInsetBottom;
mInsetState.mDrawable.setBounds(r.left, r.top, r.right, r.bottom);
|
protected boolean | onStateChange(int[] state)
boolean changed = mInsetState.mDrawable.setState(state);
onBoundsChange(getBounds());
return changed;
|
public void | scheduleDrawable(Drawable who, java.lang.Runnable what, long when)
if (mCallback != null) {
mCallback.scheduleDrawable(this, what, when);
}
|
public void | setAlpha(int alpha)
mInsetState.mDrawable.setAlpha(alpha);
|
public void | setColorFilter(ColorFilter cf)
mInsetState.mDrawable.setColorFilter(cf);
|
public boolean | setVisible(boolean visible, boolean restart)
mInsetState.mDrawable.setVisible(visible, restart);
return super.setVisible(visible, restart);
|
public void | unscheduleDrawable(Drawable who, java.lang.Runnable what)
if (mCallback != null) {
mCallback.unscheduleDrawable(this, what);
}
|