Java Code Examples for android.text.TextPaint.setFlags()

The following are Jave code examples for showing how to use setFlags() of the android.text.TextPaint class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: SunmiUI   File: FadingEdgeView.java   Source Code and License Vote up 6 votes
private void init(AttributeSet attrs, int defStyle) {

        setWillNotDraw(false);
        // Load attributes
        final TypedArray a = getContext().obtainStyledAttributes(
                attrs, R.styleable.FadingEdgeView, defStyle, 0);


        a.recycle();

        // Set up a default TextPaint object
        mTextPaint = new TextPaint();
        mTextPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
        mTextPaint.setTextAlign(Paint.Align.LEFT);

        // Update TextPaint and text measurements from attributes
        invalidateTextPaintAndMeasurements();
    }
 
Example 2
Project: Neuronizer   File: TypefaceSpan.java   Source Code and License Vote up 5 votes
@Override
public void updateMeasureState(TextPaint p) {
    p.setTypeface(mTypeface);

    // Note: This flag is required for proper typeface rendering
    p.setFlags(p.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}
 
Example 3
Project: Neuronizer   File: TypefaceSpan.java   Source Code and License Vote up 5 votes
@Override
public void updateDrawState(TextPaint tp) {
    tp.setTypeface(mTypeface);

    // Note: This flag is required for proper typeface rendering
    tp.setFlags(tp.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}
 
Example 4
Project: airgram   File: TypefaceSpan.java   Source Code and License Vote up 5 votes
@Override
public void updateMeasureState(TextPaint p) {
    if (mTypeface != null) {
        p.setTypeface(mTypeface);
    }
    if (textSize != 0) {
        p.setTextSize(textSize);
    }
    p.setFlags(p.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}
 
Example 5
Project: airgram   File: TypefaceSpan.java   Source Code and License Vote up 5 votes
@Override
public void updateDrawState(TextPaint tp) {
    if (mTypeface != null) {
        tp.setTypeface(mTypeface);
    }
    if (textSize != 0) {
        tp.setTextSize(textSize);
    }
    if (color != 0) {
        tp.setColor(color);
    }
    tp.setFlags(tp.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}
 
Example 6
Project: MultiContactPicker   File: RoundLetterView.java   Source Code and License Vote up 5 votes
private void init(AttributeSet attrs, int defStyle) {
    final TypedArray a = getContext().obtainStyledAttributes(
            attrs, R.styleable.RoundedLetterView, defStyle, 0);

    if(a.hasValue(R.styleable.RoundedLetterView_rlv_titleText)){
        mTitleText = a.getString(R.styleable.RoundedLetterView_rlv_titleText);
    }

    mTitleColor = a.getColor(R.styleable.RoundedLetterView_rlv_titleColor,DEFAULT_TITLE_COLOR);
    mBackgroundColor = a.getColor(R.styleable.RoundedLetterView_rlv_backgroundColorValue,DEFAULT_BACKGROUND_COLOR);

    mTitleSize = a.getDimension(R.styleable.RoundedLetterView_rlv_titleSize,DEFAULT_TITLE_SIZE);
    a.recycle();

    //Title TextPaint
    mTitleTextPaint = new TextPaint();
    mTitleTextPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
    mTitleTextPaint.setTypeface(mFont);
    mTitleTextPaint.setTextAlign(Paint.Align.CENTER);
    mTitleTextPaint.setLinearText(true);
    mTitleTextPaint.setColor(mTitleColor);
    mTitleTextPaint.setTextSize(mTitleSize);

    //Background Paint
    mBackgroundPaint = new Paint();
    mBackgroundPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
    mBackgroundPaint.setStyle(Paint.Style.FILL);
    mBackgroundPaint.setColor(mBackgroundColor);

    mInnerRectF = new RectF();
}
 
Example 7
Project: MuslimMateAndroid   File: TypefaceSpan.java   Source Code and License Vote up 5 votes
@Override
public void updateMeasureState(TextPaint p) {
	p.setTypeface(mTypeface);

	// Note: This flag is required for proper typeface rendering
	p.setFlags(p.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}
 
Example 8
Project: MuslimMateAndroid   File: TypefaceSpan.java   Source Code and License Vote up 5 votes
@Override
public void updateDrawState(TextPaint tp) {
	tp.setTypeface(mTypeface);

	// Note: This flag is required for proper typeface rendering
	tp.setFlags(tp.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}
 
Example 9
Project: asset-font-views   File: AssetFontSpan.java   Source Code and License Vote up 5 votes
@Override
public void updateMeasureState(TextPaint p) {
    p.setTypeface(mTypeface);

    // Note: This flag is required for proper typeface rendering
    p.setFlags(p.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}
 
Example 10
Project: asset-font-views   File: AssetFontSpan.java   Source Code and License Vote up 5 votes
@Override
public void updateDrawState(TextPaint tp) {
    tp.setTypeface(mTypeface);

    // Note: This flag is required for proper typeface rendering
    tp.setFlags(tp.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}
 
Example 11
Project: PlusGram   File: TypefaceSpan.java   Source Code and License Vote up 5 votes
@Override
public void updateMeasureState(TextPaint p) {
    if (mTypeface != null) {
        p.setTypeface(mTypeface);
    }
    if (textSize != 0) {
        p.setTextSize(textSize);
    }
    p.setFlags(p.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}
 
Example 12
Project: PlusGram   File: TypefaceSpan.java   Source Code and License Vote up 5 votes
@Override
public void updateDrawState(TextPaint tp) {
    if (mTypeface != null) {
        tp.setTypeface(mTypeface);
    }
    if (textSize != 0) {
        tp.setTextSize(textSize);
    }
    if (color != 0) {
        tp.setColor(color);
    }
    tp.setFlags(tp.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}
 
Example 13
Project: TaBeTa   File: FrameLayoutWithHole.java   Source Code and License Vote up 5 votes
private void init(AttributeSet attrs, int defStyle) {
        // Load attributes
//        final TypedArray a = getContext().obtainStyledAttributes(
//                attrs, FrameLayoutWithHole, defStyle, 0);
//
//
//        a.recycle();
        setWillNotDraw(false);
        // Set up a default TextPaint object
        mTextPaint = new TextPaint();
        mTextPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
        mTextPaint.setTextAlign(Paint.Align.LEFT);

        Point size = new Point();
        size.x = mActivity.getResources().getDisplayMetrics().widthPixels;
        size.y = mActivity.getResources().getDisplayMetrics().heightPixels;

        mEraserBitmap = Bitmap.createBitmap(size.x, size.y, Bitmap.Config.ARGB_8888);
        mEraserCanvas = new Canvas(mEraserBitmap);

        mPaint = new Paint();
        mPaint.setColor(0xcc000000);
        transparentPaint = new Paint();
        transparentPaint.setColor(getResources().getColor(android.R.color.transparent));
        transparentPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));

        mEraser = new Paint();
        mEraser.setColor(0xFFFFFFFF);
        mEraser.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
        mEraser.setFlags(Paint.ANTI_ALIAS_FLAG);

        Log.d("tourguide","getHeight: "+ size.y);
        Log.d("tourguide","getWidth: " + size.x);

    }
 
Example 14
Project: Veggietizer   File: TypefaceSpan.java   Source Code and License Vote up 5 votes
@Override
public void updateDrawState(TextPaint tp) {
    tp.setTypeface(mTypeface);

    // Note: This flag is required for proper typeface rendering
    tp.setFlags(tp.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}
 
Example 15
Project: RLibrary   File: RTextView.java   Source Code and License Vote up 5 votes
public void addPaintFlags(TextPaint paint, boolean add, int flat) {
    if (add) {
        paint.setFlags(paint.getFlags() | flat);
    } else {
        paint.setFlags(paint.getFlags() & ~flat);
    }
}
 
Example 16
Project: shapeletter   File: ShapeLetter.java   Source Code and License Vote up 5 votes
private void init(AttributeSet attrs, int defStyle) {
    final TypedArray a = getContext().obtainStyledAttributes(
            attrs, R.styleable.ShapeLetter, defStyle, 0);

    if(a.hasValue(R.styleable.ShapeLetter_letter)){
        mTitleText = a.getString(R.styleable.ShapeLetter_letter);
    }

    mShape = a.getInteger(R.styleable.ShapeLetter_shape,DEFAULT_SHAPE);


    mTitleColor = a.getColor(R.styleable.ShapeLetter_letter_color, DEFAULT_LETTER_COLOR);
    mBackgroundColor = a.getColor(R.styleable.ShapeLetter_shape_color, DEFAULT_SHAPE_COLOR);
    mTitleSize = a.getDimension(R.styleable.ShapeLetter_letter_size, DEFAULT_LETTER_SIZE);
    a.recycle();

    //Title TextPaint
    mTitleTextPaint = new TextPaint();
    mTitleTextPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
    mTitleTextPaint.setTypeface(mFont);
    mTitleTextPaint.setTextAlign(Paint.Align.CENTER);
    mTitleTextPaint.setLinearText(true);
    mTitleTextPaint.setColor(mTitleColor);
    mTitleTextPaint.setTextSize(mTitleSize);

    //Background Paint
    mBackgroundPaint = new Paint();
    mBackgroundPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
    mBackgroundPaint.setStyle(Paint.Style.FILL);
    mBackgroundPaint.setColor(mBackgroundColor);

    mInnerRectF = new RectF();
}
 
Example 17
Project: GitHub   File: TypefaceHelper.java   Source Code and License Vote up 4 votes
@Override public void updateMeasureState(TextPaint p) {
	p.setTypeface(typeface);
	p.setFlags(p.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}
 
Example 18
Project: GitHub   File: TypefaceHelper.java   Source Code and License Vote up 4 votes
@Override public void updateDrawState(TextPaint tp) {
	tp.setTypeface(typeface);
	tp.setFlags(tp.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}
 
Example 19
Project: HutHelper   File: DateLineView.java   Source Code and License Vote up 4 votes
public DateLineView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    this.context = context;
    //虚线
    linePaint = new Paint();
    linePaint.setFlags(Paint.ANTI_ALIAS_FLAG);
    linePaint.setStyle(Paint.Style.STROKE);
    linePaint.setColor(Color.WHITE);
    linePaint.setStrokeWidth(3);
    DashPathEffect effect = new DashPathEffect(new float[]{8, 8}, 0);
    linePaint.setPathEffect(effect);

    //文本
    textPaint = new TextPaint();
    textPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
    textPaint.setTextSize(DensityUtils.sp2px(context, 10));
    textPaint.setColor(Color.WHITE);

    //圆点
    circlePaint = new Paint();
    circlePaint.setFlags(Paint.ANTI_ALIAS_FLAG);
    circlePaint.setStyle(Paint.Style.FILL);
    circlePaint.setColor(Color.WHITE);

    timeAxisList = new ArrayList<>();
    TimeAxis day = new TimeAxis();
    day.setDate("2017.09.12");
    day.setName("端午");
    day.setDays(0);
    timeAxisList.add(day);
    day = new TimeAxis();
    day.setDate("2017.09.12");
    day.setName("毕业");
    day.setDays(10);
    timeAxisList.add(day);
    day = new TimeAxis();
    day.setDate("2017.09.12");
    day.setName("实习");
    day.setDays(11);
    timeAxisList.add(day);
    day = new TimeAxis();
    day.setDate("2017.09.12");
    day.setName("暑假");
    day.setDays(17);
    timeAxisList.add(day);
}
 
Example 20
Project: snippety   File: TextTypefaceSpan.java   Source Code and License Vote up 4 votes
@Override public void updateDrawState(TextPaint tp) {
	tp.setTypeface(typeface);
	tp.setFlags(tp.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}