當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。