FileDocCategorySizeDatePackage
TextViewWithCircularIndicator.javaAPI DocAndroid 5.1 API2797Thu Mar 12 22:22:50 GMT 2015com.android.datetimepicker.date

TextViewWithCircularIndicator

public class TextViewWithCircularIndicator extends android.widget.TextView
A text view which, when pressed or activated, displays a blue circle around the text.

Fields Summary
private static final int
SELECTED_CIRCLE_ALPHA
android.graphics.Paint
mCirclePaint
private final int
mRadius
private final int
mCircleColor
private final String
mItemIsSelectedText
private boolean
mDrawCircle
Constructors Summary
public TextViewWithCircularIndicator(android.content.Context context, android.util.AttributeSet attrs)


         
        super(context, attrs);
        Resources res = context.getResources();
        mCircleColor = res.getColor(R.color.blue);
        mRadius = res.getDimensionPixelOffset(R.dimen.month_select_circle_radius);
        mItemIsSelectedText = context.getResources().getString(R.string.item_is_selected);

        init();
    
Methods Summary
public voiddrawIndicator(boolean drawCircle)

        mDrawCircle = drawCircle;
    
public java.lang.CharSequencegetContentDescription()

        CharSequence itemText = getText();
        if (mDrawCircle) {
            return String.format(mItemIsSelectedText, itemText);
        } else {
            return itemText;
        }
    
private voidinit()

        mCirclePaint.setFakeBoldText(true);
        mCirclePaint.setAntiAlias(true);
        mCirclePaint.setColor(mCircleColor);
        mCirclePaint.setTextAlign(Align.CENTER);
        mCirclePaint.setStyle(Style.FILL);
        mCirclePaint.setAlpha(SELECTED_CIRCLE_ALPHA);
    
public voidonDraw(android.graphics.Canvas canvas)

        super.onDraw(canvas);
        if (mDrawCircle) {
            final int width = getWidth();
            final int height = getHeight();
            int radius = Math.min(width, height) / 2;
            canvas.drawCircle(width / 2, height / 2, radius, mCirclePaint);
        }