FileDocCategorySizeDatePackage
BulletSpan.javaAPI DocAndroid 1.5 API2914Wed May 06 22:41:56 BST 2009android.text.style

BulletSpan

public 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 intdescribeContents()

        return 0;
    
public voiddrawLeadingMargin(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 intgetLeadingMargin(boolean first)

        return 2 * BULLET_RADIUS + mGapWidth;
    
public intgetSpanTypeId()

        return TextUtils.BULLET_SPAN;
    
public voidwriteToParcel(android.os.Parcel dest, int flags)

        dest.writeInt(mGapWidth);
        dest.writeInt(mWantColor ? 1 : 0);
        dest.writeInt(mColor);