@Override public boolean isStateful() { return mBorderColor.isStateful(); }
boolean isStateful() { return mColors != null && mColors.isStateful(); }
@Override public boolean isStateful() { return mTintList != null && mTintList.isStateful(); }
@Override public boolean isStateful() { return (mTrackStateList.isStateful() || mScrubberStateList.isStateful() || mThumbStateList.isStateful()) || super.isStateful(); }
@Override public boolean isStateful() { return super.isStateful() || (mTint != null && mTint.isStateful()); }
@Override public boolean isStateful() { return (mColorStateList.isStateful()) || super.isStateful(); }
@Override public boolean isStateful() { return super.isStateful() || (mTint != null && mTint.isStateful()); }
@Override public boolean isStateful() { return (mColorStateList.isStateful()) || super.isStateful(); }
@Override protected void drawableStateChanged() { super.drawableStateChanged(); if (tint != null && tint.isStateful()) { updateTintColor(); } }
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 boolean isStateful() { return mBorderColor.isStateful(); }
@Override public boolean isStateful() { return mTintList != null && mTintList.isStateful(); }
private boolean isStateful() { return (mCollapsedTextColor != null && mCollapsedTextColor.isStateful()) || (mExpandedTextColor != null && mExpandedTextColor.isStateful()); }
@Override public boolean isStateful() { return mTint != null && mTint.isStateful(); }
public static ColorStateList getThemeColorStateList(Context context, ColorStateList origin) { if (origin == null) return null; if (origin.isStateful()) { TintInfo tintInfo = parseColorStateList(origin); if (tintInfo == null || tintInfo.isInvalid()) { return origin; } int[] newColors; int[][] newStates; int index = 0; boolean hasDisableColor = StateSet.stateSetMatches(tintInfo.mTintStates[0], DISABLED_STATE_SET); if (!hasDisableColor) { newStates = new int[tintInfo.mTintStates.length + 1][]; newColors = new int[tintInfo.mTintStates.length + 1]; newStates[index] = DISABLED_STATE_SET; newColors[index] = getDisabledThemeAttrColor(context, R.attr.themeColorSecondary); index++; } else { newStates = new int[tintInfo.mTintStates.length][]; newColors = new int[tintInfo.mTintStates.length]; } for (int i = 0; i < tintInfo.mTintStates.length; i++) { newStates[index] = tintInfo.mTintStates[i]; newColors[index] = replaceColor(context, tintInfo.mTintColors[i]); index++; } return new ColorStateList(newStates, newColors); } return ColorStateList.valueOf(replaceColor(context, origin.getDefaultColor())); }
/** * Updates the text colors based on the drawable state. * * @param drawableState The current drawable state of the View holding this layout * @return This {@link TextLayoutBuilder} instance */ public TextLayoutBuilder setDrawableState(int[] drawableState) { mParams.createNewPaintIfNeeded(); mParams.paint.drawableState = drawableState; if (mParams.color != null && mParams.color.isStateful()) { int color = mParams.color.getColorForState(drawableState, 0); mParams.paint.setColor(color); mSavedLayout = null; } return this; }
@Override protected void drawableStateChanged() { super.drawableStateChanged(); // autostart if(getDrawable().getCurrent() instanceof Animatable) { Animatable animatable = (Animatable) getDrawable().getCurrent(); if(!animatable.isRunning()) animatable.start(); } if (tint != null && tint.isStateful()) { setColorFilter(tint.getColorForState(getDrawableState(), 0)); } }
@Override public boolean isStateful() { return (mTint != null && mTint.isStateful()) || (mBackground != null && mBackground.isStateful()) || super.isStateful(); }
@Override public boolean isStateful() { return (mFillColors != null && mFillColors.isStateful()) || (mStrokeColors != null && mStrokeColors.isStateful()) || super.isStateful(); }
@Nullable protected static ColorStateList withDisabled(@Nullable ColorStateList csl, @NonNull Context context) { if (csl != null && !csl.isStateful()) { int color = csl.getDefaultColor(); int disabledAplha = (int) (Util.resolveFloat(context, android.R.attr.disabledAlpha, 0.5f) * 255); csl = Util.withDisabled(color, disabledAplha); } return csl; }