use of carbon.animation.AnimatedColorStateList in project Carbon by ZieIony.
the class CheckableDrawable method onStateChange.
@Override
protected boolean onStateChange(int[] states) {
boolean changed = false;
if (states != null) {
boolean newChecked = false;
boolean newIndeterminate = false;
boolean newEnabled = false;
for (int state : states) {
if (state == android.R.attr.state_checked)
newChecked = true;
if (state == R.attr.carbon_state_indeterminate)
newIndeterminate = true;
if (state == android.R.attr.state_enabled)
newEnabled = true;
}
CheckedState newCheckedState = newIndeterminate ? CheckedState.INDETERMINATE : newChecked ? CheckedState.CHECKED : CheckedState.UNCHECKED;
if (checkedState != newCheckedState) {
setChecked(newCheckedState);
changed = true;
}
if (enabled != newEnabled) {
setEnabled(newEnabled);
changed = true;
}
}
boolean result = super.onStateChange(states);
if (changed && tint != null && tint instanceof AnimatedColorStateList)
((AnimatedColorStateList) tint).setState(states);
return result && changed;
}
use of carbon.animation.AnimatedColorStateList in project Carbon by ZieIony.
the class Button method drawableStateChanged.
@Override
protected void drawableStateChanged() {
super.drawableStateChanged();
if (rippleDrawable != null && rippleDrawable.getStyle() != RippleDrawable.Style.Background)
rippleDrawable.setState(getDrawableState());
if (stateAnimator != null)
stateAnimator.setState(getDrawableState());
ColorStateList textColors = getTextColors();
if (textColors instanceof AnimatedColorStateList)
((AnimatedColorStateList) textColors).setState(getDrawableState());
if (tint != null && tint instanceof AnimatedColorStateList)
((AnimatedColorStateList) tint).setState(getDrawableState());
if (backgroundTint != null && backgroundTint instanceof AnimatedColorStateList)
((AnimatedColorStateList) backgroundTint).setState(getDrawableState());
if (shadow != null && shadowColor != null)
shadowColorFilter = new PorterDuffColorFilter(shadowColor.getColorForState(getDrawableState(), shadowColor.getDefaultColor()), PorterDuff.Mode.MULTIPLY);
}
use of carbon.animation.AnimatedColorStateList in project Carbon by ZieIony.
the class EditText method drawableStateChanged.
@Override
protected void drawableStateChanged() {
super.drawableStateChanged();
if (rippleDrawable != null && rippleDrawable.getStyle() != RippleDrawable.Style.Background)
rippleDrawable.setState(getDrawableState());
if (stateAnimator != null)
stateAnimator.setState(getDrawableState());
ColorStateList textColors = getTextColors();
if (textColors instanceof AnimatedColorStateList)
((AnimatedColorStateList) textColors).setState(getDrawableState());
if (tint != null && tint instanceof AnimatedColorStateList)
((AnimatedColorStateList) tint).setState(getDrawableState());
if (backgroundTint != null && backgroundTint instanceof AnimatedColorStateList)
((AnimatedColorStateList) backgroundTint).setState(getDrawableState());
}
use of carbon.animation.AnimatedColorStateList in project Carbon by ZieIony.
the class TextView method drawableStateChanged.
@Override
protected void drawableStateChanged() {
super.drawableStateChanged();
if (rippleDrawable != null && rippleDrawable.getStyle() != RippleDrawable.Style.Background)
rippleDrawable.setState(getDrawableState());
if (stateAnimator != null)
stateAnimator.setState(getDrawableState());
ColorStateList textColors = getTextColors();
if (textColors instanceof AnimatedColorStateList)
((AnimatedColorStateList) textColors).setState(getDrawableState());
if (tint != null && tint instanceof AnimatedColorStateList)
((AnimatedColorStateList) tint).setState(getDrawableState());
if (backgroundTint != null && backgroundTint instanceof AnimatedColorStateList)
((AnimatedColorStateList) backgroundTint).setState(getDrawableState());
}
Aggregations