类android.animation.Animator.AnimatorListener源码实例Demo

下面列出了怎么用android.animation.Animator.AnimatorListener的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: FimiX8-RE   文件: YoYo.java
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;
}
 
/**
 * 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;
}
 
/**
 * 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);
        }

    };
}
 
/**
 * 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);
            }
        }

    };
}
 
/**
 * 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);
            }
        }

    };
}
 
/**
 * 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));
        }

    };
}
 
/**
 * 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;
        }

    };
}
 
源代码8 项目: CSipSimple   文件: GlowPadView.java
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();
}
 
源代码9 项目: CSipSimple   文件: GlowPadView.java
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();
}
 
源代码10 项目: AgentWebX5   文件: AnimProcessor.java
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);
    }
 
源代码11 项目: AgentWebX5   文件: AnimProcessor.java
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);
    }
 
public static Animator createAnimator(@NonNull View view, float toAlpha, int durationMillis, int startDelayMillis, AnimatorListener listener) {
    Animator animator = ObjectAnimator.ofFloat(view, "alpha", view.getAlpha(), toAlpha);
    animator.setDuration((long) durationMillis);
    animator.setStartDelay((long) startDelayMillis);
    animator.addListener(listener);
    return animator;
}
 
/**
 * Creates and returns an animation listener, which allows to remove the view, which is used to
 * visualize a specific tab, when swiping the tabs horizontally has been ended.
 *
 * @param tabItem
 *         The tab item, which corresponds to the tab, whose view should be removed, 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 createSwipeNeighborAnimationListener(@NonNull final TabItem tabItem) {
    return new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(final Animator animation) {
            super.onAnimationEnd(animation);
            contentViewRecycler.remove(tabItem.getTab());
        }

    };
}
 
/**
 * Creates and returns an animation listener, which allows to cancel the dialog, once the
 * animation, which is used to hide it, has finished.
 *
 * @return The animation listener, which has been created, as an instance of the type {@link
 * AnimatorListener}
 */
private AnimatorListener createCancelAnimationListener() {
    return new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(final Animator animation) {
            super.onAnimationEnd(animation);
            AbstractAnimateableDialog.super.cancel();
        }

    };
}
 
/**
 * Animates the position and size of a specific tab in order to hide the tab switcher.
 *
 * @param item
 *         The item, which corresponds to the tab, which should be animated, as an instance of
 *         the class {@link AbstractItem}. The item may not be null
 * @param duration
 *         The duration of the animation in milliseconds as a {@link Long} value
 * @param interpolator
 *         The interpolator, which should be used by the animation, as an instance of the class
 *         {@link Interpolator}. The interpolator may not be null
 * @param delay
 *         The delay of the animation in milliseconds as a {@link Long} value
 * @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
 */
private void animateHideSwitcher(@NonNull final AbstractItem item, final long duration,
                                 @NonNull final Interpolator interpolator, final long delay,
                                 @Nullable final AnimatorListener listener) {
    View view = item.getView();
    animateBottomMargin(view, -(tabInset + tabBorderWidth), duration, delay);
    ViewPropertyAnimator animation = view.animate();
    animation.setDuration(duration);
    animation.setInterpolator(interpolator);
    animation.setListener(new AnimationListenerWrapper(listener));
    getArithmetics().animateScale(Axis.DRAGGING_AXIS, animation, 1);
    getArithmetics().animateScale(Axis.ORTHOGONAL_AXIS, animation, 1);
    FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) view.getLayoutParams();
    getArithmetics().animatePosition(Axis.ORTHOGONAL_AXIS, animation, item,
            getTabSwitcher().getLayout() == Layout.PHONE_LANDSCAPE ? layoutParams.topMargin :
                    0);
    int selectedTabIndex = getModel().getSelectedTabIndex();

    if (item.getIndex() < selectedTabIndex) {
        getArithmetics().animatePosition(Axis.DRAGGING_AXIS, animation, item,
                getArithmetics().getTabContainerSize(Axis.DRAGGING_AXIS));
    } else if (item.getIndex() > selectedTabIndex) {
        getArithmetics().animatePosition(Axis.DRAGGING_AXIS, animation, item,
                getTabSwitcher().getLayout() == Layout.PHONE_LANDSCAPE ? 0 :
                        layoutParams.topMargin);
    } else {
        getArithmetics().animatePosition(Axis.DRAGGING_AXIS, animation, item,
                getTabSwitcher().getLayout() == Layout.PHONE_LANDSCAPE ? 0 :
                        layoutParams.topMargin);
    }

    animation.setStartDelay(delay);
    animation.start();
}
 
/**
 * Animates the position, size and alpha of a specific tab in order to swipe it orthogonally.
 *
 * @param item
 *         The item, corresponds to the tab, which should be animated, as an instance of the
 *         class {@link AbstractItem}. The item may not be null
 * @param remove
 *         True, if the tab should be removed after the animation has finished, false otherwise
 * @param delayMultiplier
 *         The multiplied, which should be used to calculate the delay after which the animation
 *         should be started, by being multiplied with the default delay, as an {@link Integer}
 *         value
 * @param swipeAnimation
 *         The animation, which should be used, as an instance of the class {@link
 *         SwipeAnimation}. The animation may not be null
 * @param listener
 *         The listener, which should be notified about the progress of the animation, as an
 *         instance of the type {@link AnimatorListener} or null, if no listener should be
 *         notified
 */
private void animateSwipe(@NonNull final AbstractItem item, final boolean remove,
                          final int delayMultiplier,
                          @NonNull final SwipeAnimation swipeAnimation,
                          @Nullable final AnimatorListener listener) {
    View view = item.getView();
    float currentScale = getArithmetics().getScale(item, true);
    float swipePosition = calculateSwipePosition();
    float targetPosition = remove ?
            (swipeAnimation.getDirection() == SwipeDirection.LEFT_OR_TOP ? -1 * swipePosition :
                    swipePosition) : 0;
    float currentPosition = getArithmetics().getPosition(Axis.ORTHOGONAL_AXIS, item);
    float distance = Math.abs(targetPosition - currentPosition);
    long animationDuration = swipeAnimation.getDuration() != -1 ? swipeAnimation.getDuration() :
            Math.round(swipeAnimationDuration * (distance / swipePosition));
    ViewPropertyAnimator animation = view.animate();
    animation.setInterpolator(
            swipeAnimation.getInterpolator() != null ? swipeAnimation.getInterpolator() :
                    new AccelerateDecelerateInterpolator());
    animation.setListener(new AnimationListenerWrapper(listener));
    animation.setDuration(animationDuration);
    getArithmetics()
            .animatePosition(Axis.ORTHOGONAL_AXIS, animation, item, targetPosition, true);
    getArithmetics().animateScale(Axis.ORTHOGONAL_AXIS, animation,
            remove ? swipedTabScale * currentScale : currentScale);
    getArithmetics().animateScale(Axis.DRAGGING_AXIS, animation,
            remove ? swipedTabScale * currentScale : currentScale);
    animation.alpha(remove ? swipedTabAlpha : 1);
    animation.setStartDelay(delayMultiplier * calculateAnimationDelay(animationDuration));
    animation.start();
}
 
/**
 * Creates and returns an animation listener, which allows to dismiss the dialog, once the
 * animation, which is used to hide it, has finished.
 *
 * @return The animation listener, which has been created, as an instance of the type {@link
 * AnimatorListener}
 */
private AnimatorListener createDismissAnimationListener() {
    return new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            AbstractAnimateableDialog.super.dismiss();
        }

    };
}
 
源代码18 项目: dynamiclistview   文件: DynamicListLayout.java
private void animate(float fromY, float toY, AnimatorListener listener) {
    ValueAnimator animator = ValueAnimator.ofFloat(fromY, toY);
    animator.setInterpolator(new DecelerateInterpolator());
    animator.setDuration(200);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            float val = (Float) animation.getAnimatedValue();
            mListFrame.scrollTo(0, (int) val);
            checkPullingState(mListFrame.getScrollY());
        }
    });
    animator.addListener(listener);
    animator.start();
}
 
/**
 * Creates and returns an animation listener, which allows to inflate or remove the views, which
 * are used to visualize tabs, when an animation, which is used to hide the tab switcher, has
 * been finished.
 *
 * @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 createHideSwitcherAnimationListener() {
    return new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(final Animator animation) {
            super.onAnimationEnd(animation);
            AbstractItemIterator iterator =
                    new ItemIterator.Builder(getTabSwitcher(), tabViewRecycler).create();
            AbstractItem item;

            while ((item = iterator.next()) != null) {
                if (((TabItem) item).getTab() == getModel().getSelectedTab()) {
                    Pair<View, Boolean> pair = tabViewRecycler.inflate(item);
                    View view = pair.first;
                    FrameLayout.LayoutParams layoutParams =
                            (FrameLayout.LayoutParams) view.getLayoutParams();
                    view.setAlpha(1f);
                    getArithmetics().setScale(Axis.DRAGGING_AXIS, item, 1);
                    getArithmetics().setScale(Axis.ORTHOGONAL_AXIS, item, 1);
                    view.setX(layoutParams.leftMargin);
                    view.setY(layoutParams.topMargin);
                } else {
                    tabViewRecycler.remove(item);
                }
            }

            tabViewRecycler.clearCache();
            tabRecyclerAdapter.clearCachedPreviews();
            tabViewBottomMargin = -1;
        }

    };
}
 
/**
 * Creates and returns an animation listener, which allows to remove all tabs, when the
 * animation, which is used to swipe all tabs, has been finished.
 *
 * @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 createClearAnimationListener() {
    return new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(final Animator animation) {
            super.onAnimationEnd(animation);
            tabViewRecycler.removeAll();
            setFirstVisibleIndex(-1);
            animateToolbarVisibility(getModel().areToolbarsShown(), 0);
        }

    };
}
 
/**
 * Creates and returns an animation listener, which allows to remove the view, which is used to
 * visualize a specific tab, when swiping the tabs horizontally has been ended.
 *
 * @param tabItem
 *         The tab item, which corresponds to the tab, whose view should be removed, 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 createSwipeNeighborAnimationListener(@NonNull final TabItem tabItem) {
    return new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(final Animator animation) {
            super.onAnimationEnd(animation);
            getTabViewRecycler().remove(tabItem);
        }

    };
}
 
/**
 * 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());
        }

    };
}
 
/**
 * 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();
        }

    };
}
 
源代码24 项目: delion   文件: SwipableOverlayView.java
/**
 * 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;
        }
    };
}
 
源代码25 项目: TwinklingRefreshLayout   文件: AnimProcessor.java
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);
    }
 
源代码26 项目: TwinklingRefreshLayout   文件: AnimProcessor.java
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);
    }
 
源代码27 项目: AndroidChromium   文件: SwipableOverlayView.java
/**
 * 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;
        }
    };
}
 
@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;
}
 
源代码29 项目: LB-Launcher   文件: LauncherViewPropertyAnimator.java
@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;
}
 
源代码30 项目: LB-Launcher   文件: LauncherViewPropertyAnimator.java
@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;
}