use of android.animation.AnimatorSet in project InstaMaterial by frogermcs.
the class FeedItemAnimator method animatePhotoLike.
private void animatePhotoLike(final FeedAdapter.CellFeedViewHolder holder) {
holder.vBgLike.setVisibility(View.VISIBLE);
holder.ivLike.setVisibility(View.VISIBLE);
holder.vBgLike.setScaleY(0.1f);
holder.vBgLike.setScaleX(0.1f);
holder.vBgLike.setAlpha(1f);
holder.ivLike.setScaleY(0.1f);
holder.ivLike.setScaleX(0.1f);
AnimatorSet animatorSet = new AnimatorSet();
ObjectAnimator bgScaleYAnim = ObjectAnimator.ofFloat(holder.vBgLike, "scaleY", 0.1f, 1f);
bgScaleYAnim.setDuration(200);
bgScaleYAnim.setInterpolator(DECCELERATE_INTERPOLATOR);
ObjectAnimator bgScaleXAnim = ObjectAnimator.ofFloat(holder.vBgLike, "scaleX", 0.1f, 1f);
bgScaleXAnim.setDuration(200);
bgScaleXAnim.setInterpolator(DECCELERATE_INTERPOLATOR);
ObjectAnimator bgAlphaAnim = ObjectAnimator.ofFloat(holder.vBgLike, "alpha", 1f, 0f);
bgAlphaAnim.setDuration(200);
bgAlphaAnim.setStartDelay(150);
bgAlphaAnim.setInterpolator(DECCELERATE_INTERPOLATOR);
ObjectAnimator imgScaleUpYAnim = ObjectAnimator.ofFloat(holder.ivLike, "scaleY", 0.1f, 1f);
imgScaleUpYAnim.setDuration(300);
imgScaleUpYAnim.setInterpolator(DECCELERATE_INTERPOLATOR);
ObjectAnimator imgScaleUpXAnim = ObjectAnimator.ofFloat(holder.ivLike, "scaleX", 0.1f, 1f);
imgScaleUpXAnim.setDuration(300);
imgScaleUpXAnim.setInterpolator(DECCELERATE_INTERPOLATOR);
ObjectAnimator imgScaleDownYAnim = ObjectAnimator.ofFloat(holder.ivLike, "scaleY", 1f, 0f);
imgScaleDownYAnim.setDuration(300);
imgScaleDownYAnim.setInterpolator(ACCELERATE_INTERPOLATOR);
ObjectAnimator imgScaleDownXAnim = ObjectAnimator.ofFloat(holder.ivLike, "scaleX", 1f, 0f);
imgScaleDownXAnim.setDuration(300);
imgScaleDownXAnim.setInterpolator(ACCELERATE_INTERPOLATOR);
animatorSet.playTogether(bgScaleYAnim, bgScaleXAnim, bgAlphaAnim, imgScaleUpYAnim, imgScaleUpXAnim);
animatorSet.play(imgScaleDownYAnim).with(imgScaleDownXAnim).after(imgScaleUpYAnim);
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
likeAnimationsMap.remove(holder);
resetLikeAnimationState(holder);
dispatchChangeFinishedIfAllAnimationsEnded(holder);
}
});
animatorSet.start();
likeAnimationsMap.put(holder, animatorSet);
}
use of android.animation.AnimatorSet in project InstaMaterial by frogermcs.
the class SendingProgressView method changeState.
private void changeState(int state) {
if (this.state == state) {
return;
}
tempBitmap.recycle();
resetTempCanvas();
this.state = state;
if (state == STATE_PROGRESS_STARTED) {
setCurrentProgress(0);
simulateProgressAnimator.start();
} else if (state == STATE_DONE_STARTED) {
setCurrentDoneBgOffset(MAX_DONE_BG_OFFSET);
setCurrentCheckmarkOffset(MAX_DONE_IMG_OFFSET);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playSequentially(doneBgAnimator, checkmarkAnimator);
animatorSet.start();
} else if (state == STATE_FINISHED) {
if (onLoadingFinishedListener != null) {
onLoadingFinishedListener.onLoadingFinished();
}
}
}
use of android.animation.AnimatorSet 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.AnimatorSet in project ViewAnimator by florent37.
the class ViewAnimator method createAnimatorSet.
protected AnimatorSet createAnimatorSet() {
List<Animator> animators = new ArrayList<>();
for (AnimationBuilder animationBuilder : animationList) {
List<Animator> animatorList = animationBuilder.createAnimators();
if (animationBuilder.getSingleInterpolator() != null) {
for (Animator animator : animatorList) {
animator.setInterpolator(animationBuilder.getSingleInterpolator());
}
}
animators.addAll(animatorList);
}
for (AnimationBuilder animationBuilder : animationList) {
if (animationBuilder.isWaitForHeight()) {
waitForThisViewHeight = animationBuilder.getView();
break;
}
}
for (Animator animator : animators) {
if (animator instanceof ValueAnimator) {
ValueAnimator valueAnimator = (ValueAnimator) animator;
valueAnimator.setRepeatCount(repeatCount);
valueAnimator.setRepeatMode(repeatMode);
}
}
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(animators);
animatorSet.setDuration(duration);
animatorSet.setStartDelay(startDelay);
if (interpolator != null)
animatorSet.setInterpolator(interpolator);
animatorSet.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
if (startListener != null)
startListener.onStart();
}
@Override
public void onAnimationEnd(Animator animation) {
if (stopListener != null)
stopListener.onStop();
if (next != null) {
next.prev = null;
next.start();
}
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
return animatorSet;
}
use of android.animation.AnimatorSet in project XobotOS by xamarin.
the class ActionBarContextView method makeInAnimation.
private Animator makeInAnimation() {
mClose.setTranslationX(-mClose.getWidth() - ((MarginLayoutParams) mClose.getLayoutParams()).leftMargin);
ObjectAnimator buttonAnimator = ObjectAnimator.ofFloat(mClose, "translationX", 0);
buttonAnimator.setDuration(200);
buttonAnimator.addListener(this);
buttonAnimator.setInterpolator(new DecelerateInterpolator());
AnimatorSet set = new AnimatorSet();
AnimatorSet.Builder b = set.play(buttonAnimator);
if (mMenuView != null) {
final int count = mMenuView.getChildCount();
if (count > 0) {
for (int i = count - 1, j = 0; i >= 0; i--, j++) {
View child = mMenuView.getChildAt(i);
child.setScaleY(0);
ObjectAnimator a = ObjectAnimator.ofFloat(child, "scaleY", 0, 1);
a.setDuration(100);
a.setStartDelay(j * 70);
b.with(a);
}
}
}
return set;
}
Aggregations