当前位置: 首页>>代码示例>>Java>>正文


Java AnimatorListener类代码示例

本文整理汇总了Java中android.animation.Animator.AnimatorListener的典型用法代码示例。如果您正苦于以下问题:Java AnimatorListener类的具体用法?Java AnimatorListener怎么用?Java AnimatorListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AnimatorListener类属于android.animation.Animator包,在下文中一共展示了AnimatorListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: smoothScrollTo

import android.animation.Animator.AnimatorListener; //导入依赖的package包/类
private void smoothScrollTo(int desX, int desY, AnimatorListener listener)
{
    ObjectAnimator xTranslate = ObjectAnimator.ofInt(this, "scrollX", desX);
    ObjectAnimator yTranslate = ObjectAnimator.ofInt(this, "scrollY", desY);

    yTranslate.addUpdateListener(new AnimatorUpdateListener()
    {
        @Override
        public void onAnimationUpdate(ValueAnimator animation)
        {
            if (mHeaderStatusChangedListener != null) mHeaderStatusChangedListener.onHeaderOffsetChanged((int) (mScrollOffsetHeight * animation.getAnimatedFraction()), animation.getAnimatedFraction());
        }
    });

    AnimatorSet animators = new AnimatorSet();
    animators.setDuration(240L);
    animators.playTogether(xTranslate, yTranslate);
    if (listener != null) animators.addListener(listener);
    animators.start();
}
 
开发者ID:kfrozen,项目名称:HeaderCollapsibleLayout,代码行数:21,代码来源:HeaderCollapsibleLayout.java

示例2: switchFragments

import android.animation.Animator.AnimatorListener; //导入依赖的package包/类
/**
 * This method is used to toggle between the two fragment states by
 * calling the appropriate animations between them. The entry and exit
 * animations of the text fragment are specified in R.animator resource
 * files. The entry and exit animations of the image fragment are
 * specified in the slideBack and slideForward methods below. The reason
 * for separating the animation logic in this way is because the translucent
 * dark hover view must fade in at the same time as the image fragment
 * animates into the background, which would be difficult to time
 * properly given that the setCustomAnimations method can only modify the
 * two fragments in the transaction.
 */
private void switchFragments () {
    if (mIsAnimating) {
        return;
    }
    mIsAnimating = true;
    if (mDidSlideOut) {
        mDidSlideOut = false;
        getFragmentManager().popBackStack();
    } else {
        mDidSlideOut = true;

        AnimatorListener listener = new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator arg0) {
                FragmentTransaction transaction = getFragmentManager().beginTransaction();
                transaction.setCustomAnimations(R.animator.slide_fragment_in, 0, 0,
                        R.animator.slide_fragment_out);
                transaction.add(R.id.move_to_back_container, mTextFragment);
                transaction.addToBackStack(null);
                transaction.commit();
            }
        };
        slideBack (listener);
    }
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:38,代码来源:SlidingFragments.java

示例3: slideBack

import android.animation.Animator.AnimatorListener; //导入依赖的package包/类
/**
 * 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.
 */
public void slideBack(AnimatorListener listener)
{
    View movingFragmentView = mImageFragment.getView();

    PropertyValuesHolder rotateX =  PropertyValuesHolder.ofFloat("rotationX", 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, "rotationX", 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();
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:29,代码来源:SlidingFragments.java

示例4: createSwipeSelectedTabAnimationListener

import android.animation.Animator.AnimatorListener; //导入依赖的package包/类
/**
 * 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);
            }
        }

    };
}
 
开发者ID:michael-rapp,项目名称:ChromeLikeTabSwitcher,代码行数:28,代码来源:TabletTabSwitcherLayout.java

示例5: animateHideSwitcher

import android.animation.Animator.AnimatorListener; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:michael-rapp,项目名称:ChromeLikeTabSwitcher,代码行数:51,代码来源:PhoneTabSwitcherLayout.java

示例6: animateTilt

import android.animation.Animator.AnimatorListener; //导入依赖的package包/类
/**
 * Animates to rotation of all tabs to be reset to normal.
 *
 * @param interpolator
 *         The interpolator, which should be used by the animation, as an instance of the type
 *         {@link Interpolator}. The interpolator may not be null
 * @param maxAngle
 *         The angle, the tabs may be rotated by at maximum, in degrees as a {@link Float}
 *         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
 * @return True, if at least one tab was animated, false otherwise
 */
private boolean animateTilt(@NonNull final Interpolator interpolator, final float maxAngle,
                            @Nullable final AnimatorListener listener) {
    ItemIterator iterator =
            new ItemIterator.Builder(getTabSwitcher(), tabViewRecycler).reverse(true).create();
    AbstractItem item;
    boolean result = false;

    while ((item = iterator.next()) != null) {
        if (item.isInflated() &&
                getArithmetics().getRotation(Axis.ORTHOGONAL_AXIS, item) != 0) {
            View view = item.getView();
            ViewPropertyAnimator animation = view.animate();
            animation.setListener(new AnimationListenerWrapper(
                    createRevertOvershootAnimationListener(item, !result ? listener : null)));
            animation.setDuration(Math.round(revertOvershootAnimationDuration *
                    (Math.abs(getArithmetics().getRotation(Axis.ORTHOGONAL_AXIS, item)) /
                            maxAngle)));
            animation.setInterpolator(interpolator);
            getArithmetics().animateRotation(Axis.ORTHOGONAL_AXIS, animation, 0);
            animation.setStartDelay(0);
            animation.start();
            result = true;
        }
    }

    return result;
}
 
开发者ID:michael-rapp,项目名称:ChromeLikeTabSwitcher,代码行数:42,代码来源:PhoneTabSwitcherLayout.java

示例7: createSwipeAnimationListener

import android.animation.Animator.AnimatorListener; //导入依赖的package包/类
/**
 * 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);
        }

    };
}
 
开发者ID:michael-rapp,项目名称:ChromeLikeTabSwitcher,代码行数:28,代码来源:PhoneTabSwitcherLayout.java

示例8: createRevertOvershootAnimationListener

import android.animation.Animator.AnimatorListener; //导入依赖的package包/类
/**
 * 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);
            }
        }

    };
}
 
开发者ID:michael-rapp,项目名称:ChromeLikeTabSwitcher,代码行数:34,代码来源:PhoneTabSwitcherLayout.java

示例9: createPeekAnimationListener

import android.animation.Animator.AnimatorListener; //导入依赖的package包/类
/**
 * 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();
        }

    };
}
 
开发者ID:michael-rapp,项目名称:ChromeLikeTabSwitcher,代码行数:50,代码来源:PhoneTabSwitcherLayout.java

示例10: createZoomOutAnimationListener

import android.animation.Animator.AnimatorListener; //导入依赖的package包/类
/**
 * 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));
        }

    };
}
 
开发者ID:michael-rapp,项目名称:ChromeLikeTabSwitcher,代码行数:37,代码来源:PhoneTabSwitcherLayout.java

示例11: createZoomInAnimationListener

import android.animation.Animator.AnimatorListener; //导入依赖的package包/类
/**
 * 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;
        }

    };
}
 
开发者ID:michael-rapp,项目名称:ChromeLikeTabSwitcher,代码行数:26,代码来源:PhoneTabSwitcherLayout.java

示例12: animateHideSwitcher

import android.animation.Animator.AnimatorListener; //导入依赖的package包/类
/**
 * Animates the position and size of a specific tab item in order to hide the tab switcher.
 *
 * @param tabItem
 *         The tab item, which should be animated, as an instance of the class {@link TabItem}.
 *         The tab 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 TabItem tabItem, final long duration,
                                 @NonNull final Interpolator interpolator, final long delay,
                                 @Nullable final AnimatorListener listener) {
    View view = tabItem.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, view,
            getTabSwitcher().getLayout() == Layout.PHONE_LANDSCAPE ? layoutParams.topMargin : 0,
            false);
    int selectedTabIndex = getModel().getSelectedTabIndex();

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

    animation.setStartDelay(delay);
    animation.start();
}
 
开发者ID:NeoTerm,项目名称:NeoTerm,代码行数:51,代码来源:PhoneTabSwitcherLayout.java

示例13: animateTilt

import android.animation.Animator.AnimatorListener; //导入依赖的package包/类
/**
 * Animates to rotation of all tabs to be reset to normal.
 *
 * @param interpolator
 *         The interpolator, which should be used by the animation, as an instance of the type
 *         {@link Interpolator}. The interpolator may not be null
 * @param maxAngle
 *         The angle, the tabs may be rotated by at maximum, in degrees as a {@link Float}
 *         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
 * @return True, if at least one tab was animated, false otherwise
 */
private boolean animateTilt(@NonNull final Interpolator interpolator, final float maxAngle,
                            @Nullable final AnimatorListener listener) {
    TabItemIterator iterator =
            new TabItemIterator.Builder(getTabSwitcher(), viewRecycler).reverse(true).create();
    TabItem tabItem;
    boolean result = false;

    while ((tabItem = iterator.next()) != null) {
        if (tabItem.isInflated()) {
            View view = tabItem.getView();

            if (getArithmetics().getRotation(Axis.ORTHOGONAL_AXIS, view) != 0) {
                ViewPropertyAnimator animation = view.animate();
                animation.setListener(new AnimationListenerWrapper(
                        createRevertOvershootAnimationListener(view,
                                !result ? listener : null)));
                animation.setDuration(Math.round(revertOvershootAnimationDuration *
                        (Math.abs(getArithmetics().getRotation(Axis.ORTHOGONAL_AXIS, view)) /
                                maxAngle)));
                animation.setInterpolator(interpolator);
                getArithmetics().animateRotation(Axis.ORTHOGONAL_AXIS, animation, 0);
                animation.setStartDelay(0);
                animation.start();
                result = true;
            }
        }
    }

    return result;
}
 
开发者ID:NeoTerm,项目名称:NeoTerm,代码行数:45,代码来源:PhoneTabSwitcherLayout.java

示例14: createHideSwitcherAnimationListener

import android.animation.Animator.AnimatorListener; //导入依赖的package包/类
/**
 * 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);
            AbstractTabItemIterator iterator =
                    new TabItemIterator.Builder(getTabSwitcher(), viewRecycler).create();
            TabItem tabItem;

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

            viewRecycler.clearCache();
            recyclerAdapter.clearCachedPreviews();
            tabViewBottomMargin = -1;
        }

    };
}
 
开发者ID:NeoTerm,项目名称:NeoTerm,代码行数:43,代码来源:PhoneTabSwitcherLayout.java

示例15: createSwipeAnimationListener

import android.animation.Animator.AnimatorListener; //导入依赖的package包/类
/**
 * Creates and returns a listener, which allows to handle, when a tab has been swiped, but was
 * not removed.
 *
 * @param tabItem
 *         The tab item, which corresponds to the tab, which has been swiped, as an instance of
 *         the class {@link TabItem}. The tab 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 TabItem tabItem) {
    return new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(final Animator animation) {
            super.onAnimationEnd(animation);
            inflateOrRemoveView(tabItem);
            View view = tabItem.getView();
            adaptStackOnSwipeAborted(tabItem, tabItem.getIndex() + 1);
            tabItem.getTag().setClosing(false);
            getArithmetics().setPivot(Axis.DRAGGING_AXIS, view,
                    getArithmetics().getPivot(Axis.DRAGGING_AXIS, view, DragState.NONE));
            animateToolbarVisibility(true, 0);
        }

    };
}
 
开发者ID:NeoTerm,项目名称:NeoTerm,代码行数:29,代码来源:PhoneTabSwitcherLayout.java


注:本文中的android.animation.Animator.AnimatorListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。