public int getBorderColor() { return mBorderColor.getDefaultColor(); }
@ColorInt public int getBorderColor() { return mBorderColor.getDefaultColor(); }
public TouchableUrlSpan(String url, ColorStateList textColor, int pressedBackgroundColor) { super(url); this.normalTextColor = textColor.getDefaultColor(); this.pressedTextColor = textColor.getColorForState(STATE_PRESSED, normalTextColor); this.pressedBackgroundColor = pressedBackgroundColor; }
int getColorForCurrentState() { if (mColors != null) { return getColorForCurrentState(mColors.getDefaultColor()); } else { return Color.TRANSPARENT; } }
/** * Set background color * * @param color the color to set */ public void setChipBackgroundColor(ColorStateList color) { mBackgroundColor = color; setChipBackgroundColor(color.getDefaultColor()); }
public void setSupportProgressTint(ColorStateList tint) { Log.e("themep", " set progress tint"); if (tint != null) { if (mProgressTintInfo == null) { mProgressTintInfo = new TintInfo(); } mProgressTintInfo.mHasTintList = true; mProgressTintInfo.mTintList = ColorStateList.valueOf(ThemeUtils.getColor(mView.getContext(), tint.getDefaultColor())); Log.e("themep", "color = " + ColorStateList.valueOf(ThemeUtils.getColor(mView.getContext(), tint.getDefaultColor())).getDefaultColor()); } applySupportProgressTint(); }
private void drawStroke(Canvas canvas) { strokePaint.setStrokeWidth(strokeWidth * 2); strokePaint.setColor(stroke.getColorForState(getDrawableState(), stroke.getDefaultColor())); cornersMask.setFillType(Path.FillType.WINDING); canvas.drawPath(cornersMask, strokePaint); }
public void updateTint() { if (colorFilter != null) { paint.setColorFilter(colorFilter); } else if (tint != null && tintMode != null) { paint.setColorFilter(new PorterDuffColorFilter(tint.getColorForState(getState(), tint.getDefaultColor()), tintMode)); } else { paint.setColorFilter(null); } }
private void setSupportIndeterminateTint(ColorStateList tint) { if (tint != null) { if (mIndeterminateTintInfo == null) { mIndeterminateTintInfo = new TintInfo(); } mIndeterminateTintInfo.mHasTintList = true; mIndeterminateTintInfo.mTintList = ColorStateList.valueOf(ThemeUtils.getColor(mView.getContext(), tint.getDefaultColor())); } applySupportIndeterminateTint(); }
private static PorterDuffColorFilter createTintFilter(Context context, ColorStateList tint, PorterDuff.Mode tintMode, final int[] state) { if (tint == null || tintMode == null) { return null; } final int color = ThemeUtils.replaceColor(context, tint.getColorForState(state, tint.getDefaultColor())); return getPorterDuffColorFilter(color, tintMode); }
public static int getDisabledThemeAttrColor(Context context, @AttrRes int attr) { final ColorStateList csl = getThemeAttrColorStateList(context, attr); if (csl != null && csl.isStateful()) { // If the CSL is stateful, we'll assume it has a disabled state and use it return csl.getColorForState(DISABLED_STATE_SET, csl.getDefaultColor()); } else { // Else, we'll generate the color using disabledAlpha from the theme final TypedValue tv = getTypedValue(); // Now retrieve the disabledAlpha value from the theme context.getTheme().resolveAttribute(android.R.attr.disabledAlpha, tv, true); final float disabledAlpha = tv.getFloat(); return getThemeAttrColor(context, attr, disabledAlpha); } }
@Override public void setOutlineSpotShadowColor(ColorStateList color) { spotShadowColor = color; if (Carbon.IS_PIE_OR_HIGHER) { super.setOutlineSpotShadowColor(color.getColorForState(getDrawableState(), color.getDefaultColor())); } else { spotShadowColorFilter = new PorterDuffColorFilter(color.getColorForState(getDrawableState(), color.getDefaultColor()), PorterDuff.Mode.MULTIPLY); setElevation(elevation); setTranslationZ(translationZ); } }
@Override public void setOutlineSpotShadowColor(ColorStateList color) { spotShadowColor = color; if (Carbon.IS_PIE_OR_HIGHER) { super.setOutlineSpotShadowColor(color.getColorForState(getDrawableState(), color.getDefaultColor())); } else { spotShadowColorFilter = new PorterDuffColorFilter(color.getColorForState(getDrawableState(), color.getDefaultColor()), PorterDuff.Mode.MULTIPLY); setElevation(elevation); setTranslationZ(translationZ); } }
@Override public void setOutlineSpotShadowColor(ColorStateList color) { spotShadowColor = color; if (Carbon.IS_PIE_OR_HIGHER) { super.setOutlineSpotShadowColor(color.getColorForState(getDrawableState(), color.getDefaultColor())); } else { spotShadowColorFilter = new PorterDuffColorFilter(color.getColorForState(getDrawableState(), color.getDefaultColor()), PorterDuff.Mode.MULTIPLY); setElevation(elevation); setTranslationZ(translationZ); } }
@Override public void setOutlineSpotShadowColor(ColorStateList color) { spotShadowColor = color; if (Carbon.IS_PIE_OR_HIGHER) { super.setOutlineSpotShadowColor(color.getColorForState(getDrawableState(), color.getDefaultColor())); } else { spotShadowColorFilter = new PorterDuffColorFilter(color.getColorForState(getDrawableState(), color.getDefaultColor()), PorterDuff.Mode.MULTIPLY); setElevation(elevation); setTranslationZ(translationZ); } }
private void updateBackgroundColor(int[] state){ int color = mBackgroundColors.getColorForState(state, mBackgroundColors.getDefaultColor()); if(mCurrentBackgroundColor != color){ mCurrentBackgroundColor = color; for(int i = 0; i < getChildCount(); i++){ CircleCheckedTextView child = (CircleCheckedTextView)getChildAt(i); child.setBackgroundColor(color); } invalidate(); } }
@Override public void setElevationShadowColor(ColorStateList shadowColor) { ambientShadowColor = spotShadowColor = shadowColor; ambientShadowColorFilter = spotShadowColorFilter = shadowColor != null ? new PorterDuffColorFilter(shadowColor.getColorForState(getDrawableState(), shadowColor.getDefaultColor()), PorterDuff.Mode.MULTIPLY) : Shadow.DEFAULT_FILTER; setElevation(elevation); setTranslationZ(translationZ); }
@Override public void setElevationShadowColor(ColorStateList shadowColor) { ambientShadowColor = spotShadowColor = shadowColor; ambientShadowColorFilter = spotShadowColorFilter = shadowColor != null ? new PorterDuffColorFilter(shadowColor.getColorForState(getDrawableState(), shadowColor.getDefaultColor()), PorterDuff.Mode.MULTIPLY) : Shadow.DEFAULT_FILTER; setElevation(elevation); setTranslationZ(translationZ); }
@Override protected void drawableStateChanged() { super.drawableStateChanged(); if (rippleDrawable != null && rippleDrawable.getStyle() != RippleDrawable.Style.Background) rippleDrawable.setState(getDrawableState()); if (stateAnimator != null) stateAnimator.setState(getDrawableState()); if (ambientShadow != null && ambientShadowColor != null) ambientShadowColorFilter = new PorterDuffColorFilter(ambientShadowColor.getColorForState(getDrawableState(), ambientShadowColor.getDefaultColor()), PorterDuff.Mode.MULTIPLY); if (spotShadow != null && spotShadowColor != null) spotShadowColorFilter = new PorterDuffColorFilter(spotShadowColor.getColorForState(getDrawableState(), spotShadowColor.getDefaultColor()), PorterDuff.Mode.MULTIPLY); }
@Override protected void drawableStateChanged() { super.drawableStateChanged(); if (rippleDrawable != null && rippleDrawable.getStyle() != RippleDrawable.Style.Background) rippleDrawable.setState(getDrawableState()); if (stateAnimator != null) stateAnimator.setState(getDrawableState()); if (ambientShadow != null && ambientShadowColor != null) ambientShadowColorFilter = new PorterDuffColorFilter(ambientShadowColor.getColorForState(getDrawableState(), ambientShadowColor.getDefaultColor()), PorterDuff.Mode.MULTIPLY); if (spotShadow != null && spotShadowColor != null) spotShadowColorFilter = new PorterDuffColorFilter(spotShadowColor.getColorForState(getDrawableState(), spotShadowColor.getDefaultColor()), PorterDuff.Mode.MULTIPLY); }