BulletSpanpublic class BulletSpan extends Object implements LeadingMarginSpan, android.text.ParcelableSpan
Fields Summary |
---|
private final int | mGapWidth | private final boolean | mWantColor | private final int | mColor | private static final int | BULLET_RADIUS | public static final int | STANDARD_GAP_WIDTH |
Constructors Summary |
---|
public BulletSpan()
mGapWidth = STANDARD_GAP_WIDTH;
mWantColor = false;
mColor = 0;
| public BulletSpan(int gapWidth)
mGapWidth = gapWidth;
mWantColor = false;
mColor = 0;
| public BulletSpan(int gapWidth, int color)
mGapWidth = gapWidth;
mWantColor = true;
mColor = color;
| public BulletSpan(android.os.Parcel src)
mGapWidth = src.readInt();
mWantColor = src.readInt() != 0;
mColor = src.readInt();
|
Methods Summary |
---|
public int | describeContents()
return 0;
| public void | drawLeadingMargin(android.graphics.Canvas c, android.graphics.Paint p, int x, int dir, int top, int baseline, int bottom, java.lang.CharSequence text, int start, int end, boolean first, android.text.Layout l)
if (((Spanned) text).getSpanStart(this) == start) {
Paint.Style style = p.getStyle();
int oldcolor = 0;
if (mWantColor) {
oldcolor = p.getColor();
p.setColor(mColor);
}
p.setStyle(Paint.Style.FILL);
c.drawCircle(x + dir * BULLET_RADIUS, (top + bottom) / 2.0f,
BULLET_RADIUS, p);
if (mWantColor) {
p.setColor(oldcolor);
}
p.setStyle(style);
}
| public int | getLeadingMargin(boolean first)
return 2 * BULLET_RADIUS + mGapWidth;
| public int | getSpanTypeId()
return TextUtils.BULLET_SPAN;
| public void | writeToParcel(android.os.Parcel dest, int flags)
dest.writeInt(mGapWidth);
dest.writeInt(mWantColor ? 1 : 0);
dest.writeInt(mColor);
|
|