use of android.animation.AnimatorSet in project kickmaterial by byoutline.
the class CategoriesListActivity method runFinishAnimation.
private void runFinishAnimation(Runnable finishAction) {
if (summaryScrolledValue > 0) {
binding.categoriesRv.smoothScrollToPosition(0);
}
ViewUtils.showView(binding.selectCategoryTv, false);
ObjectAnimator imageFade = ObjectAnimator.ofFloat(binding.selectedCategoryIv, View.ALPHA, 1, 0);
AnimatorSet set = new AnimatorSet();
AnimatorSet closeButtonScale = AnimatorUtils.getScaleAnimator(binding.closeCategoriesIv, 1, 0.1f);
set.playTogether(closeButtonScale, imageFade);
set.setDuration(FINISH_ANIMATION_DURATION);
set.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (revealAnimation != null) {
revealAnimation.cancel();
}
ViewUtils.showView(binding.categoryCircleRevealIv, false);
binding.closeCategoriesIv.setScaleX(0);
binding.closeCategoriesIv.setScaleY(0);
finishAction.run();
}
});
binding.categoriesRv.startAnimation(LUtils.loadAnimationWithLInterpolator(getApplicationContext(), R.anim.slide_to_bottom));
set.start();
}
use of android.animation.AnimatorSet in project animate by hitherejoe.
the class MorphButtonToDialog method createAnimator.
@Override
public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues, final TransitionValues endValues) {
Animator changeBounds = super.createAnimator(sceneRoot, startValues, endValues);
if (startValues == null || endValues == null || changeBounds == null)
return null;
Integer startColor = (Integer) startValues.values.get(PROPERTY_COLOR);
Integer endColor = (Integer) endValues.values.get(PROPERTY_COLOR);
if (startColor == null || endColor == null)
return null;
MorphDrawable background = new MorphDrawable(startColor, 0);
endValues.view.setBackground(background);
Animator color = ObjectAnimator.ofArgb(background, background.COLOR, endColor);
// ease in the dialog's child views (slide up & fade_fast in)
if (endValues.view instanceof ViewGroup) {
ViewGroup vg = (ViewGroup) endValues.view;
float offset = vg.getHeight() / 3;
for (int i = 0; i < vg.getChildCount(); i++) {
View v = vg.getChildAt(i);
v.setTranslationY(offset);
v.setAlpha(0f);
v.animate().alpha(1f).translationY(0f).setDuration(150).setStartDelay(150).setInterpolator(AnimationUtils.loadInterpolator(vg.getContext(), android.R.interpolator.fast_out_slow_in));
offset *= 1.8f;
}
}
AnimatorSet transition = new AnimatorSet();
transition.playTogether(changeBounds, color);
transition.setDuration(300);
transition.setInterpolator(AnimationUtils.loadInterpolator(sceneRoot.getContext(), android.R.interpolator.fast_out_slow_in));
return transition;
}
use of android.animation.AnimatorSet in project animate by hitherejoe.
the class MorphDialogToButton method createAnimator.
@Override
public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {
Animator changeBounds = super.createAnimator(sceneRoot, startValues, endValues);
if (startValues == null || endValues == null || changeBounds == null) {
return null;
}
Integer startColor = (Integer) startValues.values.get(PROPERTY_COLOR);
Integer endColor = (Integer) endValues.values.get(PROPERTY_COLOR);
if (startColor == null || endColor == null) {
return null;
}
MorphDrawable background = new MorphDrawable(startColor, 0);
endValues.view.setBackground(background);
Animator color = ObjectAnimator.ofArgb(background, background.COLOR, endColor);
// hide child views (offset down & fade_fast out)
if (endValues.view instanceof ViewGroup) {
ViewGroup vg = (ViewGroup) endValues.view;
for (int i = 0; i < vg.getChildCount(); i++) {
View v = vg.getChildAt(i);
v.animate().alpha(0f).translationY(v.getHeight() / 3).setStartDelay(0L).setDuration(50L).setInterpolator(AnimationUtils.loadInterpolator(vg.getContext(), android.R.interpolator.fast_out_linear_in)).start();
}
}
AnimatorSet transition = new AnimatorSet();
transition.playTogether(changeBounds, color);
transition.setDuration(300);
transition.setInterpolator(AnimUtils.getMaterialInterpolator(sceneRoot.getContext()));
return transition;
}
use of android.animation.AnimatorSet in project animate by hitherejoe.
the class MorphDialogToFab method createAnimator.
@Override
public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {
Animator changeBounds = super.createAnimator(sceneRoot, startValues, endValues);
if (startValues == null || endValues == null || changeBounds == null) {
return null;
}
Integer startColor = (Integer) startValues.values.get(PROPERTY_COLOR);
Integer startCornerRadius = (Integer) startValues.values.get(PROPERTY_CORNER_RADIUS);
Integer endColor = (Integer) endValues.values.get(PROPERTY_COLOR);
Integer endCornerRadius = (Integer) endValues.values.get(PROPERTY_CORNER_RADIUS);
if (startColor == null || startCornerRadius == null || endColor == null || endCornerRadius == null) {
return null;
}
MorphDrawable background = new MorphDrawable(startColor, startCornerRadius);
endValues.view.setBackground(background);
Animator color = ObjectAnimator.ofArgb(background, background.COLOR, endColor);
Animator corners = ObjectAnimator.ofFloat(background, background.CORNER_RADIUS, endCornerRadius);
// hide child views (offset down & fade_fast out)
if (endValues.view instanceof ViewGroup) {
ViewGroup vg = (ViewGroup) endValues.view;
for (int i = 0; i < vg.getChildCount(); i++) {
View v = vg.getChildAt(i);
v.animate().alpha(0f).translationY(v.getHeight() / 3).setStartDelay(0L).setDuration(50L).setInterpolator(AnimationUtils.loadInterpolator(vg.getContext(), android.R.interpolator.fast_out_linear_in)).start();
}
}
AnimatorSet transition = new AnimatorSet();
transition.playTogether(changeBounds, corners, color);
transition.setDuration(300);
transition.setInterpolator(AnimUtils.getMaterialInterpolator(sceneRoot.getContext()));
return transition;
}
use of android.animation.AnimatorSet in project nmid-headline by miao1007.
the class ImagesFeedAdapter method updateHeartButton.
private void updateHeartButton(final StreamViewHolder holder, boolean animated, final boolean isLike) {
if (animated) {
if (!likeAnimations.containsKey(holder)) {
AnimatorSet animatorSet = new AnimatorSet();
likeAnimations.put(holder, animatorSet);
ObjectAnimator rotationAnim = ObjectAnimator.ofFloat(holder.mBtn_like, "rotation", 0f, 360f);
rotationAnim.setDuration(300);
rotationAnim.setInterpolator(ACCELERATE_INTERPOLATOR);
ObjectAnimator bounceAnimX = ObjectAnimator.ofFloat(holder.mBtn_like, "scaleX", 0.2f, 1f);
bounceAnimX.setDuration(300);
bounceAnimX.setInterpolator(OVERSHOOT_INTERPOLATOR);
ObjectAnimator bounceAnimY = ObjectAnimator.ofFloat(holder.mBtn_like, "scaleY", 0.2f, 1f);
bounceAnimY.setDuration(300);
bounceAnimY.setInterpolator(OVERSHOOT_INTERPOLATOR);
bounceAnimY.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
if (isLike) {
holder.mBtn_like.setImageResource(R.drawable.ic_heart_red);
} else {
holder.mBtn_like.setImageResource(R.drawable.ic_heart_outline_grey);
}
}
});
animatorSet.play(rotationAnim);
animatorSet.play(bounceAnimX).with(bounceAnimY).after(rotationAnim);
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
resetLikeAnimationState(holder);
}
});
animatorSet.start();
}
} else {
if (likedPositions.contains(holder.getPosition())) {
holder.mBtn_like.setImageResource(R.drawable.ic_heart_red);
} else {
holder.mBtn_like.setImageResource(R.drawable.ic_heart_outline_grey);
}
}
}
Aggregations