use of android.graphics.ColorFilter in project ElasticDownload by Tibolte.
the class VectorDrawable method draw.
@Override
public void draw(Canvas canvas) {
final Rect bounds = getBounds();
if (bounds.width() == 0 || bounds.height() == 0) {
// too small to draw
return;
}
final int saveCount = canvas.save();
final boolean needMirroring = needMirroring();
canvas.translate(bounds.left, bounds.top);
if (needMirroring) {
canvas.translate(bounds.width(), 0);
canvas.scale(-1.0f, 1.0f);
}
// Color filters always override tint filters.
final ColorFilter colorFilter = mColorFilter == null ? mTintFilter : mColorFilter;
if (!mAllowCaching) {
// AnimatedVectorDrawable
if (!mVectorState.hasTranslucentRoot()) {
mVectorState.mVPathRenderer.draw(canvas, bounds.width(), bounds.height(), colorFilter);
} else {
mVectorState.createCachedBitmapIfNeeded(bounds);
mVectorState.updateCachedBitmap(bounds);
mVectorState.drawCachedBitmapWithRootAlpha(canvas, colorFilter);
}
} else {
// Static Vector Drawable case.
mVectorState.createCachedBitmapIfNeeded(bounds);
if (!mVectorState.canReuseCache()) {
mVectorState.updateCachedBitmap(bounds);
mVectorState.updateCacheStates();
}
mVectorState.drawCachedBitmapWithRootAlpha(canvas, colorFilter);
}
canvas.restoreToCount(saveCount);
}
use of android.graphics.ColorFilter in project AndroidChromium by JackyAndroid.
the class CardUnmaskPrompt method setInputError.
/**
* Sets the error message on the cvc input.
* @param message The error message to show, or null if the error state should be cleared.
*/
private void setInputError(String message) {
mErrorMessage.setText(message);
mErrorMessage.setVisibility(message == null ? View.GONE : View.VISIBLE);
// Announcing twice in a row may cancel the first announcement.
if (message != null) {
mErrorMessage.announceForAccessibility(message);
}
// draw the TextInput.
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
return;
ColorFilter filter = null;
if (message != null) {
filter = new PorterDuffColorFilter(ApiCompatibilityUtils.getColor(mDialog.getContext().getResources(), R.color.input_underline_error_color), PorterDuff.Mode.SRC_IN);
}
// TODO(estade): it would be nicer if the error were specific enough to tell us which input
// was invalid.
updateColorForInput(mCardUnmaskInput, filter);
updateColorForInput(mMonthInput, filter);
updateColorForInput(mYearInput, filter);
}
use of android.graphics.ColorFilter in project Slide by ccrama.
the class BlendModeUtil method tintPaint.
private static void tintPaint(@NonNull final Paint paint, @ColorInt final int color, final BlendModeCompat mode) {
final ColorFilter filter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(color, mode);
paint.setColorFilter(filter);
}
use of android.graphics.ColorFilter in project Slide by ccrama.
the class BlendModeUtil method tintImageView.
private static void tintImageView(@NonNull final ImageView imageView, @ColorInt final int color, final BlendModeCompat mode) {
final ColorFilter filter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(color, mode);
imageView.setColorFilter(filter);
}
use of android.graphics.ColorFilter in project Slide by ccrama.
the class BlendModeUtil method tintDrawable.
private static void tintDrawable(@NonNull final Drawable drawable, @ColorInt final int color, final BlendModeCompat mode) {
final ColorFilter filter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(color, mode);
drawable.setColorFilter(filter);
}
Aggregations