Java Code Examples for android.text.TextPaint#getAlpha()
The following examples show how to use
android.text.TextPaint#getAlpha() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RtlMaterialSpinner.java From RTLMaterialSpinner with Apache License 2.0 | 6 votes |
private void initPaintObjects() { paint = new Paint(Paint.ANTI_ALIAS_FLAG); textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); textPaint.setTextSize(hintTextSize); if (typeface != null) { textPaint.setTypeface(typeface); } textPaint.setColor(baseColor); baseAlpha = textPaint.getAlpha(); selectorPath = new Path(); selectorPath.setFillType(Path.FillType.EVEN_ODD); selectorPoints = new Point[3]; for (int i = 0; i < 3; i++) { selectorPoints[i] = new Point(); } }
Example 2
Source File: MaterialSpinner.java From XERUNG with Apache License 2.0 | 6 votes |
private void initPaintObjects() { int labelTextSize = getResources().getDimensionPixelSize(R.dimen.label_text_size); paint = new Paint(Paint.ANTI_ALIAS_FLAG); textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); textPaint.setTextSize(labelTextSize); if (typeface != null) { textPaint.setTypeface(typeface); } textPaint.setColor(baseColor); baseAlpha = textPaint.getAlpha(); selectorPath = new Path(); selectorPath.setFillType(Path.FillType.EVEN_ODD); selectorPoints = new Point[3]; for (int i = 0; i < 3; i++) { selectorPoints[i] = new Point(); } }
Example 3
Source File: MaterialSpinner.java From XERUNG with Apache License 2.0 | 6 votes |
private void initPaintObjects() { int labelTextSize = getResources().getDimensionPixelSize(R.dimen.label_text_size); paint = new Paint(Paint.ANTI_ALIAS_FLAG); textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); textPaint.setTextSize(labelTextSize); if (typeface != null) { textPaint.setTypeface(typeface); } textPaint.setColor(baseColor); baseAlpha = textPaint.getAlpha(); selectorPath = new Path(); selectorPath.setFillType(Path.FillType.EVEN_ODD); selectorPoints = new Point[3]; for (int i = 0; i < 3; i++) { selectorPoints[i] = new Point(); } }
Example 4
Source File: MaterialSpinner.java From MaterialSpinner with Apache License 2.0 | 6 votes |
private void initPaintObjects() { int labelTextSize = getResources().getDimensionPixelSize(R.dimen.label_text_size); paint = new Paint(Paint.ANTI_ALIAS_FLAG); textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); textPaint.setTextSize(labelTextSize); if (typeface != null) { textPaint.setTypeface(typeface); } textPaint.setColor(baseColor); baseAlpha = textPaint.getAlpha(); selectorPath = new Path(); selectorPath.setFillType(Path.FillType.EVEN_ODD); selectorPoints = new Point[3]; for (int i = 0; i < 3; i++) { selectorPoints[i] = new Point(); } }
Example 5
Source File: TextProgressBar.java From Qiitanium with MIT License | 6 votes |
private TextProgressDrawable(Builder builder) { mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); mTextPaint.setStyle(Paint.Style.FILL); mTextPaint.setColor(builder.mTextColor); mTextPaint.setTextSize(builder.mTextSize); Paint.FontMetrics fm = mTextPaint.getFontMetrics(); mText = builder.mText; mTextHeight = Math.round(fm.descent - fm.ascent); mTextWidth = Math.round(mTextPaint.measureText(mText, 0, mText.length())); mMaxAlpha = mTextPaint.getAlpha(); mFBounds = new Rect(); mAlphaAnimator = ValueAnimator.ofFloat(1f, 0f, 1f); mAlphaAnimator.setDuration(builder.mDuration); mAlphaAnimator.setRepeatCount(ValueAnimator.INFINITE); mAlphaAnimator.addUpdateListener(this); }
Example 6
Source File: PasswordEntry.java From android-proguards with Apache License 2.0 | 5 votes |
/** * Progress through the morph: 0 = character, 1 = • */ void draw(Canvas canvas, TextPaint paint, CharSequence password, int index, float charWidth, float progress) { int alpha = paint.getAlpha(); float x = charWidth * index; // draw the character canvas.save(); float textScale = lerp(1f, textToMaskScale, progress); // scale character: shrinks to/grows from the mask's height canvas.scale(textScale, textScale, x + bounds.exactCenterX(), bounds.exactCenterY()); // cross fade between the character/mask paint.setAlpha((int) lerp(alpha, 0, progress)); // vertically move the character center toward/from the mask center canvas.drawText(password, index, index + 1, x, lerp(0f, textOffsetY, progress) / textScale, paint); canvas.restore(); // draw the mask canvas.save(); float maskScale = lerp(maskToTextScale, 1f, progress); // scale the mask: down from/up to the character width canvas.scale(maskScale, maskScale, x + bounds.exactCenterX(), bounds.exactCenterY()); // cross fade between the mask/character paint.setAlpha((int) AnimUtils.lerp(0, alpha, progress)); // vertically move the mask center from/toward the character center canvas.drawText(PASSWORD_MASK, 0, 1, x, -lerp(textOffsetY, 0f, progress), paint); canvas.restore(); // restore the paint to how we found it paint.setAlpha(alpha); }