List of usage examples for android.animation AnimatorSet addListener
public void addListener(AnimatorListener listener)
From source file:fr.paug.droidcon.util.LPreviewUtilsBase.java
public void setOrAnimatePlusCheckIcon(final ImageView imageView, boolean isCheck, boolean allowAnimate, int resIdChecked) { final int imageResId = isCheck ? resIdChecked : R.drawable.add_schedule_button_icon_unchecked; if (imageView.getTag() != null) { if (imageView.getTag() instanceof Animator) { Animator anim = (Animator) imageView.getTag(); anim.end();/*from www . j a v a 2 s . c o m*/ imageView.setAlpha(1f); } } if (allowAnimate && isCheck) { int duration = mActivity.getResources().getInteger(android.R.integer.config_shortAnimTime); Animator outAnimator = ObjectAnimator.ofFloat(imageView, View.ALPHA, 0f); outAnimator.setDuration(duration / 2); outAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { imageView.setImageResource(imageResId); } }); AnimatorSet inAnimator = new AnimatorSet(); outAnimator.setDuration(duration); inAnimator.playTogether(ObjectAnimator.ofFloat(imageView, View.ALPHA, 1f), ObjectAnimator.ofFloat(imageView, View.SCALE_X, 0f, 1f), ObjectAnimator.ofFloat(imageView, View.SCALE_Y, 0f, 1f)); AnimatorSet set = new AnimatorSet(); set.playSequentially(outAnimator, inAnimator); set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { imageView.setTag(null); } }); imageView.setTag(set); set.start(); } else { mHandler.post(new Runnable() { @Override public void run() { imageView.setImageResource(imageResId); } }); } }
From source file:com.truizlop.fabreveallayout.FABRevealLayout.java
private void startRevealAnimation() { View disappearingView = getMainView(); ObjectAnimator fabAnimator = getFABAnimator(); ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(disappearingView, "alpha", 1, 0); AnimatorSet set = new AnimatorSet(); set.play(fabAnimator).with(alphaAnimator); setupAnimationParams(set);/*from w ww. j a v a 2 s . com*/ set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); fab.setVisibility(GONE); prepareForReveal(); expandCircle(); } }); set.start(); }
From source file:com.android.clear.reminder.ItemAnimator.java
@Override public void runPendingAnimations() { final AnimatorSet removeAnimatorSet = new AnimatorSet(); removeAnimatorSet.playTogether(mRemoveAnimatorsList); mRemoveAnimatorsList.clear();/*from ww w . j a va 2 s . c o m*/ final AnimatorSet addAnimatorSet = new AnimatorSet(); addAnimatorSet.playTogether(mAddAnimatorsList); mAddAnimatorsList.clear(); final AnimatorSet changeAnimatorSet = new AnimatorSet(); changeAnimatorSet.playTogether(mChangeAnimatorsList); mChangeAnimatorsList.clear(); final AnimatorSet moveAnimatorSet = new AnimatorSet(); moveAnimatorSet.playTogether(mMoveAnimatorsList); mMoveAnimatorsList.clear(); final AnimatorSet pendingAnimatorSet = new AnimatorSet(); pendingAnimatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animator) { animator.removeAllListeners(); dispatchFinishedWhenDone(); } }); // Required order: removes, then changes & moves simultaneously, then additions. There are // redundant edges because changes or moves may be empty, causing the removes to incorrectly // play immediately. pendingAnimatorSet.play(removeAnimatorSet).before(changeAnimatorSet); pendingAnimatorSet.play(removeAnimatorSet).before(moveAnimatorSet); pendingAnimatorSet.play(changeAnimatorSet).with(moveAnimatorSet); pendingAnimatorSet.play(addAnimatorSet).after(changeAnimatorSet); pendingAnimatorSet.play(addAnimatorSet).after(moveAnimatorSet); pendingAnimatorSet.start(); }
From source file:com.truizlop.fabreveallayout.FABRevealLayout.java
private void startHideAnimation() { Animator contractAnimator = circularExpandingView.contract(); View disappearingView = getSecondaryView(); ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(disappearingView, "alpha", 1, 0); AnimatorSet set = new AnimatorSet(); set.play(contractAnimator).with(alphaAnimator); setupAnimationParams(set);// w w w . ja va 2 s . c o m set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); fab.setVisibility(VISIBLE); circularExpandingView.setVisibility(GONE); moveFABToOriginalLocation(); } }); set.start(); }
From source file:la.marsave.fullscreentest.MainActivity.java
/** * This method animates the image fragment into the background by both * scaling and rotating the fragment's view, as well as adding a * translucent dark hover view to inform the user that it is inactive. *//*from w w w . j ava 2 s .c o m*/ public void slideBack(Animator.AnimatorListener listener) { View movingFragmentView = mInfiniteViewPager; PropertyValuesHolder rotateX = PropertyValuesHolder.ofFloat("rotationY", 40f); PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 0.8f); PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 0.8f); ObjectAnimator movingFragmentAnimator = ObjectAnimator.ofPropertyValuesHolder(movingFragmentView, rotateX, scaleX, scaleY); ObjectAnimator darkHoverViewAnimator = ObjectAnimator.ofFloat(mDarkHoverView, "alpha", 0.0f, 0.5f); ObjectAnimator movingFragmentRotator = ObjectAnimator.ofFloat(movingFragmentView, "rotationY", 0); movingFragmentRotator.setStartDelay(getResources().getInteger(R.integer.half_slide_up_down_duration)); AnimatorSet s = new AnimatorSet(); s.playTogether(movingFragmentAnimator, darkHoverViewAnimator, movingFragmentRotator); s.addListener(listener); s.start(); }
From source file:com.artemchep.horario.ui.widgets.ContainersLayout.java
private void animateInFrameDetails() { frameDetails.setVisibility(View.VISIBLE); ViewUtils.onLaidOut(frameDetails, new Runnable() { @Override// ww w .ja v a2 s. c o m public void run() { ObjectAnimator alpha = ofFloat(frameDetails, View.ALPHA, 0.4f, 1f); ObjectAnimator translate = ofFloat(frameDetails, View.TRANSLATION_Y, frameDetails.getHeight() * 0.3f, 0f); AnimatorSet set = new AnimatorSet(); set.playTogether(alpha, translate); set.setDuration(ANIM_DURATION); set.setInterpolator(new LinearOutSlowInInterpolator()); set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); frameMaster.setVisibility(View.GONE); } }); set.start(); } }); }
From source file:com.artemchep.horario.ui.widgets.ContainersLayout.java
private void animateOutFrameDetails() { ViewUtils.onLaidOut(frameDetails, new Runnable() { @Override//from www . j a va 2s. c om public void run() { if (!frameDetails.isShown()) { return; } ObjectAnimator alpha = ObjectAnimator.ofFloat(frameDetails, View.ALPHA, 1f, 0f); ObjectAnimator translate = ofFloat(frameDetails, View.TRANSLATION_Y, 0f, frameDetails.getHeight() * 0.3f); AnimatorSet set = new AnimatorSet(); set.playTogether(alpha, translate); set.setDuration(ANIM_DURATION); set.setInterpolator(new FastOutLinearInInterpolator()); set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); frameDetails.setAlpha(1f); frameDetails.setTranslationY(0); frameDetails.setVisibility(View.GONE); } }); set.start(); } }); }
From source file:com.dk.animation.effect.out.HingeOut.java
@Override public void startAnimation(final ViewHolder holder, long duration, final BaseItemAnimator animator) { ViewCompat.animate(holder.itemView).cancel(); AnimatorSet set = new AnimatorSet(); View target = holder.itemView; int abs = Math.random() > 0.5 ? -1 : 1; float x, y;//www .j av a2 s .c o m if (abs > 0) { x = target.getPaddingLeft(); y = target.getPaddingTop(); } else { x = target.getWidth(); y = target.getPaddingTop(); } set.setDuration(animator.getRemoveDuration()); set.addListener(new AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { animator.dispatchAddFinished(holder); animator.mAddAnimations.remove(holder); animator.dispatchFinishedWhenDone(); } @Override public void onAnimationCancel(Animator animation) { } }); set.playTogether( ObjectAnimator.ofFloat(target, "rotation", 0, abs * 80, abs * 60, abs * 80, abs * 60, abs * 60), ObjectAnimator.ofFloat(target, "translationY", 0, 0, 0, 0, 0, 700), ObjectAnimator.ofFloat(target, "alpha", 1, 1, 1, 1, 1, 0), ObjectAnimator.ofFloat(target, "pivotX", x, x, x, x, x, x), ObjectAnimator.ofFloat(target, "pivotY", y, y, y, y, y, y)); set.setStartDelay(mDelay * mDelayCount); set.setDuration(animator.getAddDuration()); set.start(); animator.mAddAnimations.add(holder); }
From source file:la.marsave.fullscreentest.MainActivity.java
/** * This method animates the image fragment into the foreground by both * scaling and rotating the fragment's view, while also removing the * previously added translucent dark hover view. Upon the completion of * this animation, the image fragment regains focus since this method is * called from the onBackStackChanged method. *///from w ww . ja v a 2 s. com public void slideForward() { View movingFragmentView = mInfiniteViewPager; PropertyValuesHolder rotateX = PropertyValuesHolder.ofFloat("rotationX", 40f); PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 1.0f); PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 1.0f); ObjectAnimator movingFragmentAnimator = ObjectAnimator.ofPropertyValuesHolder(movingFragmentView, rotateX, scaleX, scaleY); ObjectAnimator darkHoverViewAnimator = ObjectAnimator.ofFloat(mDarkHoverView, "alpha", 0.5f, 0.0f); ObjectAnimator movingFragmentRotator = ObjectAnimator.ofFloat(movingFragmentView, "rotationX", 0); movingFragmentRotator.setStartDelay(getResources().getInteger(R.integer.half_slide_up_down_duration)); AnimatorSet s = new AnimatorSet(); s.playTogether(movingFragmentAnimator, movingFragmentRotator, darkHoverViewAnimator); s.setStartDelay(getResources().getInteger(R.integer.slide_up_down_duration)); s.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mIsAnimating = false; } }); s.start(); }
From source file:com.evilduck.animtest.DraggedPanelLayout.java
public void animatePanel(final boolean opening, float distY, long duration) { ObjectAnimator slidingPanelAnimator = ObjectAnimator.ofFloat(slidingPanel, View.TRANSLATION_Y, slidingPanel.getTranslationY(), slidingPanel.getTranslationY() + distY); ObjectAnimator bottomPanelAnimator = ObjectAnimator.ofFloat(bottomPanel, View.TRANSLATION_Y, bottomPanel.getTranslationY(), bottomPanel.getTranslationY() + (float) (distY * parallaxFactor)); AnimatorSet set = new AnimatorSet(); set.playTogether(slidingPanelAnimator, bottomPanelAnimator); set.setDuration(duration);//from w w w . j ava2 s.co m set.setInterpolator(sDecelerator); set.addListener(new MyAnimListener(opening)); set.start(); }