android.animation.Animator.AnimatorListener Java Examples
The following examples show how to use
android.animation.Animator.AnimatorListener.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: YoYo.java From FimiX8-RE with MIT License | 6 votes |
private BaseViewAnimator play() { this.animator.setTarget(this.target); if (this.pivotX == Float.MAX_VALUE) { ViewCompat.setPivotX(this.target, ((float) this.target.getMeasuredWidth()) / 2.0f); } else { this.target.setPivotX(this.pivotX); } if (this.pivotY == Float.MAX_VALUE) { ViewCompat.setPivotY(this.target, ((float) this.target.getMeasuredHeight()) / 2.0f); } else { this.target.setPivotY(this.pivotY); } this.animator.setDuration(this.duration).setRepeatTimes(this.repeatTimes).setRepeatMode(this.repeatMode).setInterpolator(this.interpolator).setStartDelay(this.delay); if (this.callbacks.size() > 0) { for (AnimatorListener callback : this.callbacks) { this.animator.addAnimatorListener(callback); } } this.animator.animate(); return this.animator; }
Example #2
Source File: PhoneTabSwitcherLayout.java From ChromeLikeTabSwitcher with Apache License 2.0 | 6 votes |
/** * Creates and returns an animation listener, which allows to adapt the pivot of a specific tab, * when an animation, which reverted an overshoot, has been ended. * * @param item * The item, which corresponds to the tab, whose pivot should be adapted, as an instance * of the class {@link AbstractItem}. The item may not be null * @param listener * The listener, which should be notified about the animation's progress, as an instance * of the type {@link AnimatorListener} or null, if no listener should be notified * @return The listener, which has been created, as an instance of the type {@link * AnimatorListener}. The listener may not be null */ @NonNull private AnimatorListener createRevertOvershootAnimationListener( @NonNull final AbstractItem item, @Nullable final AnimatorListener listener) { return new AnimatorListenerAdapter() { @Override public void onAnimationEnd(final Animator animation) { super.onAnimationEnd(animation); getArithmetics().setPivot(Axis.DRAGGING_AXIS, item, getArithmetics().getPivot(Axis.DRAGGING_AXIS, item, DragState.NONE)); getArithmetics().setPivot(Axis.ORTHOGONAL_AXIS, item, getArithmetics().getPivot(Axis.DRAGGING_AXIS, item, DragState.NONE)); if (listener != null) { listener.onAnimationEnd(animation); } } }; }
Example #3
Source File: PhoneTabSwitcherLayout.java From ChromeLikeTabSwitcher with Apache License 2.0 | 6 votes |
/** * Creates and returns an animation listener, which allows to adapt the currently selected tab, * when swiping the tabs horizontally has been ended. * * @param tabItem * The tab item, which corresponds to the tab, which should be selected, as an instance * of the class {@link TabItem}. The tab item may not be null * @return The animation listener, which has been created, as an instance of the type {@link * AnimatorListener}. The listener may not be null */ @NonNull private AnimatorListener createSwipeSelectedTabAnimationListener( @NonNull final TabItem tabItem) { return new AnimatorListenerAdapter() { @Override public void onAnimationEnd(final Animator animation) { super.onAnimationEnd(animation); Tab tab = tabItem.getTab(); if (getModel().getSelectedTab() != tab) { getModel().selectTab(tab); } } }; }
Example #4
Source File: PhoneTabSwitcherLayout.java From ChromeLikeTabSwitcher with Apache License 2.0 | 6 votes |
/** * Creates and returns a listener, which allows to handle, when a tab has been swiped, but was * not removed. * * @param item * The item, which corresponds to the tab, which has been swiped, as an instance of the * class {@link AbstractItem}. The item may not be null * @return The listener, which has been created, as an instance of the type {@link * AnimatorListener}. The listener may not be null */ @NonNull private AnimatorListener createSwipeAnimationListener(@NonNull final AbstractItem item) { return new AnimatorListenerAdapter() { @Override public void onAnimationEnd(final Animator animation) { super.onAnimationEnd(animation); inflateOrRemoveView(item, false); adaptStackOnSwipeAborted(item, item.getIndex() + 1); item.getTag().setClosing(false); getArithmetics().setPivot(Axis.DRAGGING_AXIS, item, getArithmetics().getPivot(Axis.DRAGGING_AXIS, item, DragState.NONE)); animateToolbarVisibility(true, 0); } }; }
Example #5
Source File: PhoneTabSwitcherLayout.java From ChromeLikeTabSwitcher with Apache License 2.0 | 6 votes |
/** * Creates and returns an animation listener, which allows to zoom in the currently selected * tab, when a peek animation has been ended. * * @param selectedItem * The item, which corresponds to the currently selected tab, as an instance of the * class {@link AbstractItem}. The item may not be null * @param peekAnimation * The peek animation as an instance of the class {@link PeekAnimation}. The peek * animation may not be null * @return The listener, which has been created, as an instance of the type {@link * AnimatorListener}. The listener may not be null */ @NonNull private AnimatorListener createZoomOutAnimationListener( @NonNull final AbstractItem selectedItem, @NonNull final PeekAnimation peekAnimation) { return new AnimatorListenerAdapter() { @Override public void onAnimationEnd(final Animator animation) { super.onAnimationEnd(animation); getModel().removeListener(PhoneTabSwitcherLayout.this); getModel().hideSwitcher(); long totalDuration = peekAnimation.getDuration() != -1 ? peekAnimation.getDuration() : peekAnimationDuration; long duration = totalDuration / 3; Interpolator interpolator = peekAnimation.getInterpolator() != null ? peekAnimation.getInterpolator() : new AccelerateDecelerateInterpolator(); animateHideSwitcher(selectedItem, duration, interpolator, duration, createZoomInAnimationListener(selectedItem)); } }; }
Example #6
Source File: AnimateableDialogDecorator.java From AndroidMaterialDialog with Apache License 2.0 | 6 votes |
/** * Creates an animator, which should be used for a fade animation. * * @param animatedView * The animated view as an instance of the class {@link View}. The view may not be null * @param animation * The animation as an instance of the class {@link FadeAnimation}. The animation may * not be null * @param listener * The listener, which should be notified about the animation's events, as an instance * of the type {@link AnimatorListener} or null, if no listener should be notified * @param show * True, if the animation should be used to show the dialog, false otherwise * @return The animator, which has been created, as an instance of the class {@link * ViewPropertyAnimator} or null, if no animation should be used */ private ViewPropertyAnimator createAnimator(@NonNull final View animatedView, @NonNull final FadeAnimation animation, @Nullable final AnimatorListener listener, final boolean show) { if (animation.getAlpha() != null) { ViewPropertyAnimator animator = animatedView.animate().setInterpolator(animation.getInterpolator()) .setDuration(getDuration(animatedView, animation)) .setStartDelay(animation.getStartDelay()).setListener(listener); if (show) { animatedView.setAlpha(animation.getAlpha()); animator.alpha(1); } else { animatedView.setAlpha(1f); animator.alpha(animation.getAlpha()); } return animator; } return null; }
Example #7
Source File: PhoneTabSwitcherLayout.java From ChromeLikeTabSwitcher with Apache License 2.0 | 6 votes |
/** * Creates and returns an animation listener, which allows to restore the original state of a * tab, when an animation, which zooms in the tab, has been ended. * * @param item * The item, which corresponds to the tab, which has been zoomed in, as an instance of * the class {@link AbstractItem}. The item may not be null * @return The listener, which has been created, as an instance of the type {@link * AnimatorListener}. The listener may not be null */ private AnimatorListener createZoomInAnimationListener(@NonNull final AbstractItem item) { return new AnimatorListenerAdapter() { @Override public void onAnimationEnd(final Animator animation) { super.onAnimationEnd(animation); getModel().addListener(PhoneTabSwitcherLayout.this); tabViewRecycler.inflate(item); tabViewRecycler.clearCache(); tabRecyclerAdapter.clearCachedPreviews(); tabViewBottomMargin = -1; } }; }
Example #8
Source File: GlowPadView.java From CSipSimple with GNU General Public License v3.0 | 5 votes |
private void hideGlow(int duration, int delay, float finalAlpha, AnimatorListener finishListener) { mGlowAnimations.cancel(); mGlowAnimations.add(Tweener.to(mPointCloud.glowManager, duration, "ease", Ease.Quart.easeOut, "delay", delay, "alpha", finalAlpha, "x", 0.0f, "y", 0.0f, "onUpdate", mUpdateListener, "onComplete", finishListener)); mGlowAnimations.start(); }
Example #9
Source File: LauncherViewPropertyAnimator.java From TurboLauncher with Apache License 2.0 | 5 votes |
@Override public void onAnimationRepeat(Animator animation) { for (int i = 0; i < mListeners.size(); i++) { Animator.AnimatorListener listener = mListeners.get(i); listener.onAnimationRepeat(this); } }
Example #10
Source File: AnimProcessor.java From AgentWebX5 with Apache License 2.0 | 5 votes |
public void animLayoutByTime(int start, int end, long time, AnimatorUpdateListener listener, AnimatorListener animatorListener) { ValueAnimator va = ValueAnimator.ofInt(start, end); va.setInterpolator(new DecelerateInterpolator()); va.addUpdateListener(listener); va.addListener(animatorListener); va.setDuration(time); va.start(); // offerToQueue(va); }
Example #11
Source File: GlowPadView.java From CSipSimple with GNU General Public License v3.0 | 5 votes |
private void showGlow(int duration, int delay, float finalAlpha, AnimatorListener finishListener) { mGlowAnimations.cancel(); mGlowAnimations.add(Tweener.to(mPointCloud.glowManager, duration, "ease", Ease.Cubic.easeIn, "delay", delay, "alpha", finalAlpha, "onUpdate", mUpdateListener, "onComplete", finishListener)); mGlowAnimations.start(); }
Example #12
Source File: PhoneTabSwitcherLayout.java From ChromeLikeTabSwitcher with Apache License 2.0 | 5 votes |
/** * Creates and returns an animation listener, which allows to revert an overshoot at the start, * when an animation has been ended. * * @return The listener, which has been created, as an instance of the type {@link * AnimatorListener}. The listener may not be null */ @NonNull private AnimatorListener createRevertStartOvershootAnimationListener() { return new AnimatorListenerAdapter() { @Override public void onAnimationEnd(final Animator animation) { super.onAnimationEnd(animation); animateRevertStartOvershoot(new DecelerateInterpolator()); } }; }
Example #13
Source File: PhoneTabSwitcherLayout.java From ChromeLikeTabSwitcher with Apache License 2.0 | 5 votes |
/** * Creates and returns an animation listener, which allows to hide a tab, which has been added * by using a peek animation, when the animation has been ended. * * @param item * The item, which corresponds to the tab, which has been added by using the peek * animation, as an instance of the class {@link AbstractItem}. The item may not be * null * @param peekAnimation * The peek animation as an instance of the class {@link PeekAnimation}. The peek * animation may not be null * @return The listener, which has been created, as an instance of the type {@link * AnimatorListener}. The listener may not be null */ @NonNull private AnimatorListener createPeekAnimationListener(@NonNull final AbstractItem item, @NonNull final PeekAnimation peekAnimation) { return new AnimatorListenerAdapter() { @Override public void onAnimationEnd(final Animator animation) { super.onAnimationEnd(animation); long totalDuration = peekAnimation.getDuration() != -1 ? peekAnimation.getDuration() : peekAnimationDuration; long duration = totalDuration / 3; Interpolator interpolator = peekAnimation.getInterpolator() != null ? peekAnimation.getInterpolator() : new AccelerateDecelerateInterpolator(); View view = item.getView(); getArithmetics().setPivot(Axis.DRAGGING_AXIS, item, tabTitleContainerHeight); getArithmetics().setPivot(Axis.ORTHOGONAL_AXIS, item, getArithmetics().getSize(Axis.ORTHOGONAL_AXIS, item) / 2f); ViewPropertyAnimator animator = view.animate(); animator.setDuration(duration); animator.setStartDelay(duration); animator.setInterpolator(interpolator); animator.setListener( new AnimationListenerWrapper(createRevertPeekAnimationListener(item))); animator.alpha(0); getArithmetics().animatePosition(Axis.DRAGGING_AXIS, animator, item, getArithmetics().getPosition(Axis.DRAGGING_AXIS, item) * 1.5f); getArithmetics().animateScale(Axis.DRAGGING_AXIS, animator, 0); getArithmetics().animateScale(Axis.ORTHOGONAL_AXIS, animator, 0); animator.start(); } }; }
Example #14
Source File: SwipableOverlayView.java From delion with Apache License 2.0 | 5 votes |
/** * Creates an AnimatorListenerAdapter that cleans up after an animation is completed. * @return {@link AnimatorListenerAdapter} to use for animations. */ private AnimatorListener createAnimatorListener() { return new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mGestureState = GESTURE_NONE; mCurrentAnimation = null; mIsBeingDisplayedForFirstTime = false; } }; }
Example #15
Source File: AnimProcessor.java From TwinklingRefreshLayout with Apache License 2.0 | 5 votes |
public void animLayoutByTime(int start, int end, long time, AnimatorUpdateListener listener, AnimatorListener animatorListener) { ValueAnimator va = ValueAnimator.ofInt(start, end); va.setInterpolator(new DecelerateInterpolator()); va.addUpdateListener(listener); va.addListener(animatorListener); va.setDuration(time); va.start(); // offerToQueue(va); }
Example #16
Source File: AnimProcessor.java From TwinklingRefreshLayout with Apache License 2.0 | 5 votes |
public void animLayoutByTime(int start, int end, AnimatorUpdateListener listener, AnimatorListener animatorListener) { ValueAnimator va = ValueAnimator.ofInt(start, end); va.setInterpolator(new DecelerateInterpolator()); va.addUpdateListener(listener); va.addListener(animatorListener); va.setDuration((int) (Math.abs(start - end) * animFraction)); va.start(); // offerToQueue(va); }
Example #17
Source File: SwipableOverlayView.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * Creates an AnimatorListenerAdapter that cleans up after an animation is completed. * @return {@link AnimatorListenerAdapter} to use for animations. */ private AnimatorListener createAnimatorListener() { return new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mGestureState = GESTURE_NONE; mCurrentAnimation = null; mIsBeingDisplayedForFirstTime = false; } }; }
Example #18
Source File: LauncherViewPropertyAnimator.java From TurboLauncher with Apache License 2.0 | 5 votes |
@Override public void onAnimationStart(Animator animation) { // This is the first time we get a handle to the internal ValueAnimator // used by the ViewPropertyAnimator. mFirstFrameHelper.onAnimationStart(animation); for (int i = 0; i < mListeners.size(); i++) { Animator.AnimatorListener listener = mListeners.get(i); listener.onAnimationStart(this); } mRunning = true; }
Example #19
Source File: LauncherViewPropertyAnimator.java From LB-Launcher with Apache License 2.0 | 5 votes |
@Override public void onAnimationStart(Animator animation) { // This is the first time we get a handle to the internal ValueAnimator // used by the ViewPropertyAnimator. mFirstFrameHelper.onAnimationStart(animation); for (int i = 0; i < mListeners.size(); i++) { Animator.AnimatorListener listener = mListeners.get(i); listener.onAnimationStart(this); } mRunning = true; }
Example #20
Source File: LauncherViewPropertyAnimator.java From LB-Launcher with Apache License 2.0 | 5 votes |
@Override public void onAnimationCancel(Animator animation) { for (int i = 0; i < mListeners.size(); i++) { Animator.AnimatorListener listener = mListeners.get(i); listener.onAnimationCancel(this); } mRunning = false; }
Example #21
Source File: FloatingActionButtonImpl.java From material-components-android with Apache License 2.0 | 5 votes |
void removeOnShowAnimationListener(@NonNull AnimatorListener listener) { if (showListeners == null) { // This can happen if this method is called before the first call to // addOnShowAnimationListener. return; } showListeners.remove(listener); }
Example #22
Source File: FloatingActionButtonImpl.java From material-components-android with Apache License 2.0 | 5 votes |
public void removeOnHideAnimationListener(@NonNull AnimatorListener listener) { if (hideListeners == null) { // This can happen if this method is called before the first call to // addOnHideAnimationListener. return; } hideListeners.remove(listener); }
Example #23
Source File: MaterialMenuDrawable.java From material-menu with Apache License 2.0 | 5 votes |
public void setAnimationListener(AnimatorListener listener) { if (animatorListener != null) { transformation.removeListener(animatorListener); } if (listener != null) { transformation.addListener(listener); } animatorListener = listener; }
Example #24
Source File: FabTransformationBehavior.java From material-components-android with Apache License 2.0 | 5 votes |
private void createColorAnimation( @NonNull View dependency, View child, boolean expanded, boolean currentlyAnimating, @NonNull FabTransformationSpec spec, @NonNull List<Animator> animations, List<AnimatorListener> unusedListeners) { if (!(child instanceof CircularRevealWidget)) { return; } CircularRevealWidget circularRevealChild = (CircularRevealWidget) child; @ColorInt int tint = getBackgroundTint(dependency); @ColorInt int transparent = tint & 0x00FFFFFF; ObjectAnimator animator; if (expanded) { if (!currentlyAnimating) { circularRevealChild.setCircularRevealScrimColor(tint); } animator = ObjectAnimator.ofInt( circularRevealChild, CircularRevealScrimColorProperty.CIRCULAR_REVEAL_SCRIM_COLOR, transparent); } else { animator = ObjectAnimator.ofInt( circularRevealChild, CircularRevealScrimColorProperty.CIRCULAR_REVEAL_SCRIM_COLOR, tint); } animator.setEvaluator(ArgbEvaluatorCompat.getInstance()); MotionTiming timing = spec.timings.getTiming("color"); timing.apply(animator); animations.add(animator); }
Example #25
Source File: FabTransformationBehavior.java From material-components-android with Apache License 2.0 | 5 votes |
private void createChildrenFadeAnimation( View unusedDependency, View child, boolean expanded, boolean currentlyAnimating, @NonNull FabTransformationSpec spec, @NonNull List<Animator> animations, List<AnimatorListener> unusedListeners) { if (!(child instanceof ViewGroup)) { return; } if (child instanceof CircularRevealWidget && CircularRevealHelper.STRATEGY == CircularRevealHelper.BITMAP_SHADER) { // Bitmap shader strategy animates a static snapshot of the child. return; } ViewGroup childContentContainer = calculateChildContentContainer(child); if (childContentContainer == null) { return; } Animator animator; if (expanded) { if (!currentlyAnimating) { ChildrenAlphaProperty.CHILDREN_ALPHA.set(childContentContainer, 0f); } animator = ObjectAnimator.ofFloat(childContentContainer, ChildrenAlphaProperty.CHILDREN_ALPHA, 1f); } else { animator = ObjectAnimator.ofFloat(childContentContainer, ChildrenAlphaProperty.CHILDREN_ALPHA, 0f); } MotionTiming timing = spec.timings.getTiming("contentFade"); timing.apply(animator); animations.add(animator); }
Example #26
Source File: LauncherViewPropertyAnimator.java From Trebuchet with GNU General Public License v3.0 | 5 votes |
@Override public void onAnimationCancel(Animator animation) { for (int i = 0; i < mListeners.size(); i++) { Animator.AnimatorListener listener = mListeners.get(i); listener.onAnimationCancel(this); } mRunning = false; }
Example #27
Source File: LauncherViewPropertyAnimator.java From Trebuchet with GNU General Public License v3.0 | 5 votes |
@Override public void onAnimationEnd(Animator animation) { for (int i = 0; i < mListeners.size(); i++) { Animator.AnimatorListener listener = mListeners.get(i); listener.onAnimationEnd(this); } mRunning = false; }
Example #28
Source File: LauncherViewPropertyAnimator.java From Trebuchet with GNU General Public License v3.0 | 5 votes |
@Override public void onAnimationRepeat(Animator animation) { for (int i = 0; i < mListeners.size(); i++) { Animator.AnimatorListener listener = mListeners.get(i); listener.onAnimationRepeat(this); } }
Example #29
Source File: LauncherViewPropertyAnimator.java From TurboLauncher with Apache License 2.0 | 5 votes |
@Override public void onAnimationCancel(Animator animation) { for (int i = 0; i < mListeners.size(); i++) { Animator.AnimatorListener listener = mListeners.get(i); listener.onAnimationCancel(this); } mRunning = false; }
Example #30
Source File: LauncherViewPropertyAnimator.java From TurboLauncher with Apache License 2.0 | 5 votes |
@Override public void onAnimationEnd(Animator animation) { for (int i = 0; i < mListeners.size(); i++) { Animator.AnimatorListener listener = mListeners.get(i); listener.onAnimationEnd(this); } mRunning = false; }