/** * ============================================================================================= * The Animate * ============================================================================================= */ private void animateShowTitle(boolean show) { TitleProperty property; if (show) property = new TitleProperty(mAttributes); else { property = new TitleProperty(); property.mAlpha = 0; property.mTextSize = (int) getTextSize(); property.mPaddingLeft = getPaddingLeft(); property.mPaddingTop = getPaddingTop(); } if (isAttachWindow) { if (mAnimator == null) { mAnimator = ObjectAnimator.ofObject( this, TITLE_PROPERTY, new TitleEvaluator(mCurTitleProperty), property); mAnimator.setDuration(ANIMATION_DURATION); mAnimator.setInterpolator(ANIMATION_INTERPOLATOR); } else { mAnimator.cancel(); mAnimator.setObjectValues(property); } mAnimator.start(); } else { setTitleProperty(property); } }
/** * ============================================================================================= * The Animate * ============================================================================================= */ private void animateCheckedState(boolean newCheckedState) { AnimatorProperty property = new AnimatorProperty(); if (newCheckedState) { property.mSweepAngle = 360; property.mCircleColor = mCheckedPaintColor; } else { property.mSweepAngle = 0; property.mCircleColor = mUnCheckedPaintColor; } if (mAnimator == null) { mAnimator = ObjectAnimator.ofObject(this, ANIM_VALUE, new AnimatorEvaluator(mCurProperty), property); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) mAnimator.setAutoCancel(true); mAnimator.setDuration(ANIMATION_DURATION); mAnimator.setInterpolator(ANIMATION_INTERPOLATOR); } else { mAnimator.cancel(); mAnimator.setObjectValues(property); } mAnimator.start(); }