@Override protected boolean onStateChange(int[] state) { mEnable = ViewUtil.hasState(state, android.R.attr.state_enabled); int color = mColorStateList.getColorForState(state, mCurColor); if (mCurColor != color) { if (!mInEditMode && mAnimEnable && mEnable && mAnimDuration > 0) { mPrevColor = isRunning() ? mPrevColor : mCurColor; mCurColor = color; start(); } else { mPrevColor = color; mCurColor = color; invalidateSelf(); } return true; } else if (!isRunning()) mPrevColor = color; return false; }
public void applyStyle(int resId) { ViewUtil.applyStyle(this, resId); applyStyle(getContext(), null, 0, resId); }