Methods Summary |
---|
public void | draw(Canvas canvas)
if (mClipState.mDrawable.getLevel() == 0) {
return;
}
final Rect r = mTmpRect;
final Rect bounds = getBounds();
int level = getLevel();
int w = bounds.width();
final int iw = 0; //mClipState.mDrawable.getIntrinsicWidth();
if ((mClipState.mOrientation & HORIZONTAL) != 0) {
w -= (w - iw) * (10000 - level) / 10000;
}
int h = bounds.height();
final int ih = 0; //mClipState.mDrawable.getIntrinsicHeight();
if ((mClipState.mOrientation & VERTICAL) != 0) {
h -= (h - ih) * (10000 - level) / 10000;
}
Gravity.apply(mClipState.mGravity, w, h, bounds, r);
if (w > 0 && h > 0) {
canvas.save();
canvas.clipRect(r);
mClipState.mDrawable.draw(canvas);
canvas.restore();
}
|
public int | getChangingConfigurations()
return super.getChangingConfigurations()
| mClipState.mChangingConfigurations
| mClipState.mDrawable.getChangingConfigurations();
|
public ConstantState | getConstantState()
if (mClipState.canConstantState()) {
mClipState.mChangingConfigurations = super.getChangingConfigurations();
return mClipState;
}
return null;
|
public int | getIntrinsicHeight()
return mClipState.mDrawable.getIntrinsicHeight();
|
public int | getIntrinsicWidth()
return mClipState.mDrawable.getIntrinsicWidth();
|
public int | getOpacity()
return mClipState.mDrawable.getOpacity();
|
public boolean | getPadding(Rect padding)
// XXX need to adjust padding!
return mClipState.mDrawable.getPadding(padding);
|
public void | inflate(android.content.res.Resources r, org.xmlpull.v1.XmlPullParser parser, android.util.AttributeSet attrs)
super.inflate(r, parser, attrs);
int type;
TypedArray a = r.obtainAttributes(attrs, com.android.internal.R.styleable.ClipDrawable);
int orientation = a.getInt(
com.android.internal.R.styleable.ClipDrawable_clipOrientation,
HORIZONTAL);
int g = a.getInt(com.android.internal.R.styleable.ClipDrawable_gravity, Gravity.LEFT);
Drawable dr = a.getDrawable(com.android.internal.R.styleable.ClipDrawable_drawable);
a.recycle();
final int outerDepth = parser.getDepth();
while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
&& (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
if (type != XmlPullParser.START_TAG) {
continue;
}
dr = Drawable.createFromXmlInner(r, parser, attrs);
}
if (dr == null) {
throw new IllegalArgumentException("No drawable specified for <clip>");
}
mClipState.mDrawable = dr;
mClipState.mOrientation = orientation;
mClipState.mGravity = g;
dr.setCallback(this);
|
public void | invalidateDrawable(Drawable who)
if (mCallback != null) {
mCallback.invalidateDrawable(this);
}
|
public boolean | isStateful()
return mClipState.mDrawable.isStateful();
|
protected void | onBoundsChange(Rect bounds)
mClipState.mDrawable.setBounds(bounds);
|
protected boolean | onLevelChange(int level)
mClipState.mDrawable.setLevel(level);
invalidateSelf();
return true;
|
protected boolean | onStateChange(int[] state)
return mClipState.mDrawable.setState(state);
|
public void | scheduleDrawable(Drawable who, java.lang.Runnable what, long when)
if (mCallback != null) {
mCallback.scheduleDrawable(this, what, when);
}
|
public void | setAlpha(int alpha)
mClipState.mDrawable.setAlpha(alpha);
|
public void | setColorFilter(ColorFilter cf)
mClipState.mDrawable.setColorFilter(cf);
|
public boolean | setVisible(boolean visible, boolean restart)
mClipState.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);
}
|