Search in sources :

Example 91 with AnimatorListenerAdapter

use of android.animation.AnimatorListenerAdapter in project MaterialLogin by fanrunqi.

the class RegisterActivity method animateRevealClose.

public void animateRevealClose() {
    Animator mAnimator = ViewAnimationUtils.createCircularReveal(cvAdd, cvAdd.getWidth() / 2, 0, cvAdd.getHeight(), fab.getWidth() / 2);
    mAnimator.setDuration(500);
    mAnimator.setInterpolator(new AccelerateInterpolator());
    mAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            cvAdd.setVisibility(View.INVISIBLE);
            super.onAnimationEnd(animation);
            fab.setImageResource(R.drawable.plus);
            RegisterActivity.super.onBackPressed();
        }

        @Override
        public void onAnimationStart(Animator animation) {
            super.onAnimationStart(animation);
        }
    });
    mAnimator.start();
}
Also used : Animator(android.animation.Animator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

Example 92 with AnimatorListenerAdapter

use of android.animation.AnimatorListenerAdapter in project XobotOS by xamarin.

the class FragmentManagerImpl method hideFragment.

public void hideFragment(Fragment fragment, int transition, int transitionStyle) {
    if (DEBUG)
        Log.v(TAG, "hide: " + fragment);
    if (!fragment.mHidden) {
        fragment.mHidden = true;
        if (fragment.mView != null) {
            Animator anim = loadAnimator(fragment, transition, true, transitionStyle);
            if (anim != null) {
                anim.setTarget(fragment.mView);
                // Delay the actual hide operation until the animation finishes, otherwise
                // the fragment will just immediately disappear
                final Fragment finalFragment = fragment;
                anim.addListener(new AnimatorListenerAdapter() {

                    @Override
                    public void onAnimationEnd(Animator animation) {
                        if (finalFragment.mView != null) {
                            finalFragment.mView.setVisibility(View.GONE);
                        }
                    }
                });
                anim.start();
            } else {
                fragment.mView.setVisibility(View.GONE);
            }
        }
        if (fragment.mAdded && fragment.mHasMenu && fragment.mMenuVisible) {
            mNeedMenuInvalidate = true;
        }
        fragment.onHiddenChanged(true);
    }
}
Also used : Animator(android.animation.Animator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

Example 93 with AnimatorListenerAdapter

use of android.animation.AnimatorListenerAdapter in project LookLook by xinghongfei.

the class TopNewsDescribeActivity method expandImageAndFinish.

private void expandImageAndFinish() {
    if (mShot.getOffset() != 0f) {
        Animator expandImage = ObjectAnimator.ofFloat(mShot, ParallaxScrimageView.OFFSET, 0f);
        expandImage.setDuration(80);
        expandImage.setInterpolator(new AccelerateInterpolator());
        expandImage.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                    finishAfterTransition();
                } else {
                    finish();
                }
            }
        });
        expandImage.start();
    } else {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            finishAfterTransition();
        } else {
            finish();
        }
    }
}
Also used : Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ValueAnimator(android.animation.ValueAnimator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

Example 94 with AnimatorListenerAdapter

use of android.animation.AnimatorListenerAdapter in project LookLook by xinghongfei.

the class ZhihuDescribeActivity method expandImageAndFinish.

private void expandImageAndFinish() {
    if (mShot.getOffset() != 0f) {
        Animator expandImage = ObjectAnimator.ofFloat(mShot, ParallaxScrimageView.OFFSET, 0f);
        expandImage.setDuration(80);
        expandImage.setInterpolator(new AccelerateInterpolator());
        expandImage.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                    finishAfterTransition();
                } else {
                    finish();
                }
            }
        });
        expandImage.start();
    } else {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            finishAfterTransition();
        } else {
            finish();
        }
    }
}
Also used : Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ValueAnimator(android.animation.ValueAnimator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

Example 95 with AnimatorListenerAdapter

use of android.animation.AnimatorListenerAdapter in project LookLook by xinghongfei.

the class MeiziAdapter method bindViewHolderNormal.

private void bindViewHolderNormal(final MeiziViewHolder holder, final int position) {
    final Meizi meizi = meiziItemes.get(holder.getAdapterPosition());
    holder.imageView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            startDescribeActivity(meizi, holder);
        }
    });
    //        holder.textView.setText("视频");
    //        holder.textView.setOnClickListener(new View.OnClickListener() {
    //            @Override
    //            public void onClick(View view) {
    //                startDescribeActivity(meizi,holder);
    //            }
    //        });
    Glide.with(mContext).load(meizi.getUrl()).listener(new RequestListener<String, GlideDrawable>() {

        @Override
        public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
            return false;
        }

        @Override
        public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
            if (!meizi.hasFadedIn) {
                holder.imageView.setHasTransientState(true);
                final ObservableColorMatrix cm = new ObservableColorMatrix();
                final ObjectAnimator animator = ObjectAnimator.ofFloat(cm, ObservableColorMatrix.SATURATION, 0f, 1f);
                animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

                    @Override
                    public void onAnimationUpdate(ValueAnimator valueAnimator) {
                        holder.imageView.setColorFilter(new ColorMatrixColorFilter(cm));
                    }
                });
                animator.setDuration(2000L);
                animator.setInterpolator(new AccelerateInterpolator());
                animator.addListener(new AnimatorListenerAdapter() {

                    @Override
                    public void onAnimationEnd(Animator animation) {
                        super.onAnimationEnd(animation);
                        holder.imageView.clearColorFilter();
                        holder.imageView.setHasTransientState(false);
                        animator.start();
                        meizi.hasFadedIn = true;
                    }
                });
            }
            return false;
        }
    }).diskCacheStrategy(DiskCacheStrategy.SOURCE).centerCrop().into(new DribbbleTarget(holder.imageView, false));
}
Also used : DribbbleTarget(com.looklook.xinghongfei.looklook.util.DribbbleTarget) RequestListener(com.bumptech.glide.request.RequestListener) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) ObjectAnimator(android.animation.ObjectAnimator) Meizi(com.looklook.xinghongfei.looklook.bean.meizi.Meizi) ValueAnimator(android.animation.ValueAnimator) View(android.view.View) BadgedFourThreeImageView(com.looklook.xinghongfei.looklook.widget.BadgedFourThreeImageView) RecyclerView(android.support.v7.widget.RecyclerView) ColorMatrixColorFilter(android.graphics.ColorMatrixColorFilter) DribbbleTarget(com.looklook.xinghongfei.looklook.util.DribbbleTarget) Target(com.bumptech.glide.request.target.Target) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ValueAnimator(android.animation.ValueAnimator) ObservableColorMatrix(com.looklook.xinghongfei.looklook.util.ObservableColorMatrix) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) GlideDrawable(com.bumptech.glide.load.resource.drawable.GlideDrawable)

Aggregations

Animator (android.animation.Animator)868 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)868 ObjectAnimator (android.animation.ObjectAnimator)464 ValueAnimator (android.animation.ValueAnimator)459 AnimatorSet (android.animation.AnimatorSet)144 View (android.view.View)131 ViewGroup (android.view.ViewGroup)92 PropertyValuesHolder (android.animation.PropertyValuesHolder)70 StackStateAnimator (com.android.systemui.statusbar.stack.StackStateAnimator)70 AnimatorUpdateListener (android.animation.ValueAnimator.AnimatorUpdateListener)62 ImageView (android.widget.ImageView)45 TextView (android.widget.TextView)43 Interpolator (android.view.animation.Interpolator)42 Paint (android.graphics.Paint)41 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)41 Rect (android.graphics.Rect)40 RenderNodeAnimator (android.view.RenderNodeAnimator)36 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)36 TimeAnimator (android.animation.TimeAnimator)30 TargetApi (android.annotation.TargetApi)30