Search in sources :

Example 11 with ViewPropertyAnimator

use of android.view.ViewPropertyAnimator in project Material-Movies by saulmm.

the class GUIUtils method showViewByScale.

public static ViewPropertyAnimator showViewByScale(View v, AnimatorListener animatorListener) {
    ViewPropertyAnimator propertyAnimator = v.animate().setStartDelay(SCALE_DELAY).scaleY(1).scaleX(1);
    propertyAnimator.setListener(animatorListener);
    return propertyAnimator;
}
Also used : ViewPropertyAnimator(android.view.ViewPropertyAnimator)

Example 12 with ViewPropertyAnimator

use of android.view.ViewPropertyAnimator in project Material-Movies by saulmm.

the class GUIUtils method hideViewByScaleY.

public static ViewPropertyAnimator hideViewByScaleY(View v, AnimatorListener animatorListener) {
    ViewPropertyAnimator propertyAnimator = v.animate().setStartDelay(SCALE_DELAY).scaleY(0);
    propertyAnimator.setListener(animatorListener);
    return propertyAnimator;
}
Also used : ViewPropertyAnimator(android.view.ViewPropertyAnimator)

Example 13 with ViewPropertyAnimator

use of android.view.ViewPropertyAnimator in project Tangram-Android by alibaba.

the class Card method getLayoutHelper.

@Nullable
public final LayoutHelper getLayoutHelper() {
    LayoutHelper helper = convertLayoutHelper(mLayoutHelper);
    // bind style to helper
    if (style != null && helper != null) {
        helper.setZIndex(style.zIndex);
        if (helper instanceof BaseLayoutHelper) {
            BaseLayoutHelper baseHelper = (BaseLayoutHelper) helper;
            baseHelper.setBgColor(style.bgColor);
            if (!TextUtils.isEmpty(style.bgImgUrl)) {
                if (serviceManager != null && serviceManager.getService(CardSupport.class) != null) {
                    final CardSupport support = serviceManager.getService(CardSupport.class);
                    baseHelper.setLayoutViewBindListener(new BindListener(style) {

                        @Override
                        public void onBind(View layoutView, BaseLayoutHelper baseLayoutHelper) {
                            support.onBindBackgroundView(layoutView, Card.this);
                        }
                    });
                    baseHelper.setLayoutViewUnBindListener(new UnbindListener(style) {

                        @Override
                        public void onUnbind(View layoutView, BaseLayoutHelper baseLayoutHelper) {
                            support.onUnbindBackgroundView(layoutView, Card.this);
                        }
                    });
                } else {
                    baseHelper.setLayoutViewBindListener(new BindListener(style));
                    baseHelper.setLayoutViewUnBindListener(new UnbindListener(style));
                }
            } else {
                baseHelper.setLayoutViewBindListener(null);
                baseHelper.setLayoutViewUnBindListener(null);
            }
            if (!Float.isNaN(style.aspectRatio)) {
            // ((BaseLayoutHelper) helper).setAspectRatio(style.aspectRatio);
            }
        }
        if (helper instanceof FixAreaLayoutHelper) {
            FixAreaLayoutHelper fixHelper = (FixAreaLayoutHelper) helper;
            boolean hasCustomAnimatorHelper = false;
            if (serviceManager != null && serviceManager.getService(CardSupport.class) != null) {
                CardSupport support = serviceManager.getService(CardSupport.class);
                FixAreaLayoutHelper.FixViewAnimatorHelper viewAnimatorHelper = support.onGetFixViewAppearAnimator(Card.this);
                if (viewAnimatorHelper != null) {
                    hasCustomAnimatorHelper = true;
                    fixHelper.setFixViewAnimatorHelper(viewAnimatorHelper);
                }
            }
            if (!hasCustomAnimatorHelper) {
                final int duration = style.extras != null ? style.extras.optInt(Style.KEY_ANIMATION_DURATION) : 0;
                if (duration > 0) {
                    fixHelper.setFixViewAnimatorHelper(new FixAreaLayoutHelper.FixViewAnimatorHelper() {

                        @Override
                        public ViewPropertyAnimator onGetFixViewAppearAnimator(View fixView) {
                            int height = fixView.getMeasuredHeight();
                            fixView.setTranslationY(-height);
                            return fixView.animate().translationYBy(height).setDuration(duration);
                        }

                        @Override
                        public ViewPropertyAnimator onGetFixViewDisappearAnimator(View fixView) {
                            int height = fixView.getMeasuredHeight();
                            return fixView.animate().translationYBy(-height).setDuration(duration);
                        }
                    });
                }
            }
        }
        if (helper instanceof MarginLayoutHelper) {
            ((MarginLayoutHelper) helper).setMargin(style.margin[Style.MARGIN_LEFT_INDEX], style.margin[Style.MARGIN_TOP_INDEX], style.margin[Style.MARGIN_RIGHT_INDEX], style.margin[Style.MARGIN_BOTTOM_INDEX]);
            ((MarginLayoutHelper) helper).setPadding(style.padding[Style.MARGIN_LEFT_INDEX], style.padding[Style.MARGIN_TOP_INDEX], style.padding[Style.MARGIN_RIGHT_INDEX], style.padding[Style.MARGIN_BOTTOM_INDEX]);
        }
    }
    if (mRetainLayout) {
        mLayoutHelper = helper;
    }
    return helper;
}
Also used : MarginLayoutHelper(com.alibaba.android.vlayout.layout.MarginLayoutHelper) FixAreaLayoutHelper(com.alibaba.android.vlayout.layout.FixAreaLayoutHelper) ImageView(android.widget.ImageView) View(android.view.View) ViewPropertyAnimator(android.view.ViewPropertyAnimator) CardSupport(com.tmall.wireless.tangram.support.CardSupport) BaseLayoutHelper(com.alibaba.android.vlayout.layout.BaseLayoutHelper) LayoutHelper(com.alibaba.android.vlayout.LayoutHelper) MarginLayoutHelper(com.alibaba.android.vlayout.layout.MarginLayoutHelper) FixAreaLayoutHelper(com.alibaba.android.vlayout.layout.FixAreaLayoutHelper) BaseLayoutHelper(com.alibaba.android.vlayout.layout.BaseLayoutHelper) Nullable(android.support.annotation.Nullable)

Example 14 with ViewPropertyAnimator

use of android.view.ViewPropertyAnimator in project T-MVP by north2016.

the class MyFabBehavior method show.

// 显示时的动画
private void show(final View view) {
    ViewPropertyAnimator animator = view.animate().translationY(0).setInterpolator(INTERPOLATOR).setDuration(200);
    animator.setListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animator) {
            view.setVisibility(View.VISIBLE);
            isAnimate = true;
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            isAnimate = false;
        }

        @Override
        public void onAnimationCancel(Animator animator) {
            hide(view);
        }

        @Override
        public void onAnimationRepeat(Animator animator) {
        }
    });
    animator.start();
}
Also used : Animator(android.animation.Animator) ViewPropertyAnimator(android.view.ViewPropertyAnimator) ViewPropertyAnimator(android.view.ViewPropertyAnimator)

Example 15 with ViewPropertyAnimator

use of android.view.ViewPropertyAnimator in project T-MVP by north2016.

the class MyFabBehavior method hide.

// 隐藏时的动画
private void hide(final View view) {
    ViewPropertyAnimator animator = view.animate().translationY(viewY).setInterpolator(INTERPOLATOR).setDuration(200);
    animator.setListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animator) {
            isAnimate = true;
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            view.setVisibility(View.INVISIBLE);
            isAnimate = false;
        }

        @Override
        public void onAnimationCancel(Animator animator) {
            show(view);
        }

        @Override
        public void onAnimationRepeat(Animator animator) {
        }
    });
    animator.start();
}
Also used : Animator(android.animation.Animator) ViewPropertyAnimator(android.view.ViewPropertyAnimator) ViewPropertyAnimator(android.view.ViewPropertyAnimator)

Aggregations

ViewPropertyAnimator (android.view.ViewPropertyAnimator)32 Animator (android.animation.Animator)11 View (android.view.View)4 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)3 ImageView (android.widget.ImageView)3 ViewTreeObserver (android.view.ViewTreeObserver)2 TextView (android.widget.TextView)2 AnimatorListener (android.animation.Animator.AnimatorListener)1 TimeInterpolator (android.animation.TimeInterpolator)1 TargetApi (android.annotation.TargetApi)1 PointF (android.graphics.PointF)1 Nullable (android.support.annotation.Nullable)1 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)1 AdapterView (android.widget.AdapterView)1 LayoutHelper (com.alibaba.android.vlayout.LayoutHelper)1 BaseLayoutHelper (com.alibaba.android.vlayout.layout.BaseLayoutHelper)1 FixAreaLayoutHelper (com.alibaba.android.vlayout.layout.FixAreaLayoutHelper)1 MarginLayoutHelper (com.alibaba.android.vlayout.layout.MarginLayoutHelper)1 AnimatorAdapter (com.saulmm.material.utils.AnimatorAdapter)1 CardSupport (com.tmall.wireless.tangram.support.CardSupport)1