use of android.animation.AnimatorListenerAdapter in project InstaMaterial by frogermcs.
the class SendingProgressView method setupDoneAnimators.
private void setupDoneAnimators() {
doneBgAnimator = ObjectAnimator.ofFloat(this, "currentDoneBgOffset", MAX_DONE_BG_OFFSET, 0).setDuration(300);
doneBgAnimator.setInterpolator(new DecelerateInterpolator());
checkmarkAnimator = ObjectAnimator.ofFloat(this, "currentCheckmarkOffset", MAX_DONE_IMG_OFFSET, 0).setDuration(300);
checkmarkAnimator.setInterpolator(new OvershootInterpolator());
checkmarkAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
changeState(STATE_FINISHED);
}
});
}
use of android.animation.AnimatorListenerAdapter in project LikeAnimation by frogermcs.
the class LikeButtonView method onClick.
@Override
public void onClick(View v) {
isChecked = !isChecked;
ivStar.setImageResource(isChecked ? R.drawable.ic_star_rate_on : R.drawable.ic_star_rate_off);
if (animatorSet != null) {
animatorSet.cancel();
}
if (isChecked) {
ivStar.animate().cancel();
ivStar.setScaleX(0);
ivStar.setScaleY(0);
vCircle.setInnerCircleRadiusProgress(0);
vCircle.setOuterCircleRadiusProgress(0);
vDotsView.setCurrentProgress(0);
animatorSet = new AnimatorSet();
ObjectAnimator outerCircleAnimator = ObjectAnimator.ofFloat(vCircle, CircleView.OUTER_CIRCLE_RADIUS_PROGRESS, 0.1f, 1f);
outerCircleAnimator.setDuration(250);
outerCircleAnimator.setInterpolator(DECCELERATE_INTERPOLATOR);
ObjectAnimator innerCircleAnimator = ObjectAnimator.ofFloat(vCircle, CircleView.INNER_CIRCLE_RADIUS_PROGRESS, 0.1f, 1f);
innerCircleAnimator.setDuration(200);
innerCircleAnimator.setStartDelay(200);
innerCircleAnimator.setInterpolator(DECCELERATE_INTERPOLATOR);
ObjectAnimator starScaleYAnimator = ObjectAnimator.ofFloat(ivStar, ImageView.SCALE_Y, 0.2f, 1f);
starScaleYAnimator.setDuration(350);
starScaleYAnimator.setStartDelay(250);
starScaleYAnimator.setInterpolator(OVERSHOOT_INTERPOLATOR);
ObjectAnimator starScaleXAnimator = ObjectAnimator.ofFloat(ivStar, ImageView.SCALE_X, 0.2f, 1f);
starScaleXAnimator.setDuration(350);
starScaleXAnimator.setStartDelay(250);
starScaleXAnimator.setInterpolator(OVERSHOOT_INTERPOLATOR);
ObjectAnimator dotsAnimator = ObjectAnimator.ofFloat(vDotsView, DotsView.DOTS_PROGRESS, 0, 1f);
dotsAnimator.setDuration(900);
dotsAnimator.setStartDelay(50);
dotsAnimator.setInterpolator(ACCELERATE_DECELERATE_INTERPOLATOR);
animatorSet.playTogether(outerCircleAnimator, innerCircleAnimator, starScaleYAnimator, starScaleXAnimator, dotsAnimator);
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationCancel(Animator animation) {
vCircle.setInnerCircleRadiusProgress(0);
vCircle.setOuterCircleRadiusProgress(0);
vDotsView.setCurrentProgress(0);
ivStar.setScaleX(1);
ivStar.setScaleY(1);
}
});
animatorSet.start();
}
}
use of android.animation.AnimatorListenerAdapter in project PaymentKit-Droid by brendanw.
the class CardIcon method flipToBack.
private void flipToBack() {
ViewUtils.setHardwareLayer(mFrontFace);
ObjectAnimator rotateFront = ObjectAnimator.ofFloat(mFrontFace, "scaleX", 1.0f, 0.0f);
rotateFront.setDuration(HALF_FLIP_DURATION);
ViewUtils.setHardwareLayer(mBackFace);
final ObjectAnimator rotateBack = ObjectAnimator.ofFloat(mBackFace, "scaleX", 0.0f, 1.0f);
rotateBack.setDuration(HALF_FLIP_DURATION);
rotateBack.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator anim) {
ViewUtils.setLayerTypeNone(mBackFace);
}
});
rotateFront.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator anim) {
alphaOut(mFrontFace);
ViewUtils.setLayerTypeNone(mFrontFace);
alphaIn(mBackFace);
rotateBack.start();
}
});
rotateFront.start();
}
use of android.animation.AnimatorListenerAdapter in project PaymentKit-Droid by brendanw.
the class CardIcon method flipToFront.
private void flipToFront() {
ViewUtils.setHardwareLayer(mBackFace);
ObjectAnimator rotateBackFace = ObjectAnimator.ofFloat(mBackFace, "scaleX", 1.0f, 0.0f);
rotateBackFace.setDuration(HALF_FLIP_DURATION);
ViewUtils.setLayerTypeNone(mFrontFace);
final ObjectAnimator rotateFrontFace = ObjectAnimator.ofFloat(mFrontFace, "scaleX", 0.0f, 1.0f);
rotateFrontFace.setDuration(HALF_FLIP_DURATION);
rotateFrontFace.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator anim) {
ViewUtils.setLayerTypeNone(mBackFace);
}
});
rotateBackFace.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator anim) {
alphaOut(mBackFace);
ViewUtils.setLayerTypeNone(mBackFace);
alphaIn(mFrontFace);
rotateFrontFace.start();
}
});
rotateBackFace.start();
}
use of android.animation.AnimatorListenerAdapter in project fresco by facebook.
the class AnimatedZoomableController method setTransformAnimated.
@SuppressLint("NewApi")
@Override
public void setTransformAnimated(final Matrix newTransform, long durationMs, @Nullable final Runnable onAnimationComplete) {
FLog.v(getLogTag(), "setTransformAnimated: duration %d ms", durationMs);
stopAnimation();
Preconditions.checkArgument(durationMs > 0);
Preconditions.checkState(!isAnimating());
setAnimating(true);
mValueAnimator.setDuration(durationMs);
getTransform().getValues(getStartValues());
newTransform.getValues(getStopValues());
mValueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
calculateInterpolation(getWorkingTransform(), (float) valueAnimator.getAnimatedValue());
AnimatedZoomableController.super.setTransform(getWorkingTransform());
}
});
mValueAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationCancel(Animator animation) {
FLog.v(getLogTag(), "setTransformAnimated: animation cancelled");
onAnimationStopped();
}
@Override
public void onAnimationEnd(Animator animation) {
FLog.v(getLogTag(), "setTransformAnimated: animation finished");
onAnimationStopped();
}
private void onAnimationStopped() {
if (onAnimationComplete != null) {
onAnimationComplete.run();
}
setAnimating(false);
getDetector().restartGesture();
}
});
mValueAnimator.start();
}
Aggregations