Methods Summary |
---|
public void | draw(android.graphics.Canvas canvas)
canvas.drawRoundRect(mBoundsF, mRadius, mRadius, mPaint);
|
public int | getOpacity()
return PixelFormat.TRANSLUCENT;
|
public void | getOutline(android.graphics.Outline outline)
outline.setRoundRect(mBoundsI, mRadius);
|
float | getPadding()
return mPadding;
|
public float | getRadius()
return mRadius;
|
protected void | onBoundsChange(android.graphics.Rect bounds)
super.onBoundsChange(bounds);
updateBounds(bounds);
|
public void | setAlpha(int alpha)
// not supported because older versions do not support
|
public void | setColor(int color)
mPaint.setColor(color);
invalidateSelf();
|
public void | setColorFilter(android.graphics.ColorFilter cf)
// not supported because older versions do not support
|
void | setPadding(float padding, boolean insetForPadding, boolean insetForRadius)
if (padding == mPadding && mInsetForPadding == insetForPadding &&
mInsetForRadius == insetForRadius) {
return;
}
mPadding = padding;
mInsetForPadding = insetForPadding;
mInsetForRadius = insetForRadius;
updateBounds(null);
invalidateSelf();
|
void | setRadius(float radius)
if (radius == mRadius) {
return;
}
mRadius = radius;
updateBounds(null);
invalidateSelf();
|
private void | updateBounds(android.graphics.Rect bounds)
if (bounds == null) {
bounds = getBounds();
}
mBoundsF.set(bounds.left, bounds.top, bounds.right, bounds.bottom);
mBoundsI.set(bounds);
if (mInsetForPadding) {
float vInset = calculateVerticalPadding(mPadding, mRadius, mInsetForRadius);
float hInset = calculateHorizontalPadding(mPadding, mRadius, mInsetForRadius);
mBoundsI.inset((int) Math.ceil(hInset), (int) Math.ceil(vInset));
// to make sure they have same bounds.
mBoundsF.set(mBoundsI);
}
|