private void startScaleDownReturnToStartAnimation( int from, Animation.AnimationListener listener) { this.mFrom = from; if (isAlphaUsedForScale()) this.mStartingScale = this.mProgress.getAlpha(); else { this.mStartingScale = ViewCompat.getScaleX(this.mCircleView); } this.mScaleDownToStartAnimation = new Animation() { public void applyTransformation(float interpolatedTime, Transformation t) { float targetScale = MySwipeRefreshLayout.this.mStartingScale + -MySwipeRefreshLayout.this.mStartingScale * interpolatedTime; MySwipeRefreshLayout.this.setAnimationProgress(targetScale); MySwipeRefreshLayout.this.moveToStart(interpolatedTime); } }; this.mScaleDownToStartAnimation.setDuration(150L); if (listener != null) { this.mCircleView.setAnimationListener(listener); } this.mCircleView.clearAnimation(); this.mCircleView.startAnimation(this.mScaleDownToStartAnimation); }
private void startScaleDownReturnToStartAnimation( int from, Animation.AnimationListener listener) { mFrom = from; if (isAlphaUsedForScale()) { mStartingScale = mProgress.getAlpha(); } else { mStartingScale = ViewCompat.getScaleX(mCircleView); } mScaleDownToStartAnimation = new Animation() { @Override public void applyTransformation(float interpolatedTime, Transformation t) { float targetScale = (mStartingScale + (-mStartingScale * interpolatedTime)); setAnimationProgress(targetScale); moveToStart(interpolatedTime); } }; mScaleDownToStartAnimation.setDuration(SCALE_DOWN_DURATION); if (listener != null) { mCircleView.setAnimationListener(listener); } mCircleView.clearAnimation(); mCircleView.startAnimation(mScaleDownToStartAnimation); }