Search in sources :

Example 16 with AnimatorListener

use of android.animation.Animator.AnimatorListener in project Fairphone by Kwamecorp.

the class PeaceOfMindActivity method hideHelp.

public void hideHelp() {
    ObjectAnimator showIn = ObjectAnimator.ofFloat(mHelpHolder, "alpha", 1, 0);
    showIn.setDuration(400);
    showIn.start();
    showIn.addListener(new AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animation) {
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            mHelpButton.setEnabled(true);
            mVerticalSeekBar.setEnabled(true);
            mHelpHolder.setVisibility(View.GONE);
            mHelpLayout.setVisibility(View.GONE);
        }

        @Override
        public void onAnimationCancel(Animator animation) {
        }
    });
}
Also used : AnimatorListener(android.animation.Animator.AnimatorListener) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ObjectAnimator(android.animation.ObjectAnimator)

Example 17 with AnimatorListener

use of android.animation.Animator.AnimatorListener in project Fairphone by Kwamecorp.

the class PeaceOfMindActivity method showHelp.

public void showHelp() {
    // disable the seekbar and help button when the help is showed
    mVerticalSeekBar.setEnabled(false);
    mHelpButton.setEnabled(false);
    mHelpHolder.setVisibility(View.VISIBLE);
    ObjectAnimator showIn = ObjectAnimator.ofFloat(mHelpHolder, "alpha", 0, 1);
    showIn.setDuration(400);
    showIn.start();
    showIn.addListener(new AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animation) {
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            mHelpLayout.setVisibility(View.VISIBLE);
            Interpolator decelerator = new DecelerateInterpolator();
            ObjectAnimator translateIn = ObjectAnimator.ofFloat(mHelpLayout, "translationY", 900f, 0f);
            translateIn.setInterpolator(decelerator);
            translateIn.setDuration(400);
            translateIn.start();
        }

        @Override
        public void onAnimationCancel(Animator animation) {
        }
    });
}
Also used : AnimatorListener(android.animation.Animator.AnimatorListener) DecelerateInterpolator(android.view.animation.DecelerateInterpolator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ObjectAnimator(android.animation.ObjectAnimator) Interpolator(android.view.animation.Interpolator) DecelerateInterpolator(android.view.animation.DecelerateInterpolator)

Example 18 with AnimatorListener

use of android.animation.Animator.AnimatorListener in project 9GAG by Mixiaoxiao.

the class ImageFragment method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onActivityCreated(savedInstanceState);
    isClose = false;
    //		mTranslateManager = new MxxTranslateManager(getActivity());
    mYoudaoFanyiManager = new MxxYoudaoFanyiManager(getActivity());
    mImageTitleTextView.setTypeface(Typeface.createFromAsset(getActivity().getAssets(), "Roboto-Light.ttf"));
    //		LayoutTransition transition =new LayoutTransition();
    fadeInAnimator = ObjectAnimator.ofFloat(((View) mImageTitleTextView.getParent()), "alpha", 0f, 1f);
    //		fadeInAnimator=ObjectAnimator.ofFloat(mImageTitleTextView, "translationY", -mImageTitleTextView.getHeight(), 0f);
    fadeInAnimator.setDuration(MxxScaleImageView.anim_duration / 2);
    fadeInAnimator.setStartDelay(MxxScaleImageView.anim_duration / 2);
    fadeInAnimator.addListener(new AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animation) {
            //				mTranslateManager.translateNoDialog(mCurrentFeedItem.getCaption(), new MxxTranslateManager.TranslateListener() {
            //					
            //					@Override
            //					public void onSuccess(String content, String result) {
            //						mImageTitleTextView.setText(content + "\n" + result);
            //					}
            //					
            //					@Override
            //					public void onError() {
            //						MxxToastUtil.showToast(getActivity(), "Translate error.");
            //					}
            //				});
            mYoudaoFanyiManager.fanyi(mCurrentFeedItem.getCaption(), new YoudaoFanyiListener() {

                @Override
                public void onSuccess(YoudaoFanyiItem fanyiItem) {
                    mImageTitleTextView.setText(fanyiItem.getTranslationContent(false));
                }

                @Override
                public void onError(String errMsg) {
                // TODO Auto-generated method stub
                }
            }, null);
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        }

        @Override
        public void onAnimationEnd(Animator animation) {
        }

        @Override
        public void onAnimationCancel(Animator animation) {
        }
    });
    fadeOutAnimator = ObjectAnimator.ofFloat(((View) mImageTitleTextView.getParent()), "alpha", 1f, 0f);
    fadeOutAnimator.setDuration(MxxScaleImageView.anim_duration / 2);
    //		fadeOutAnimator.addListener(new AnimatorListener() {
    //			
    //			@Override
    //			public void onAnimationStart(Animator animation) {}
    //			@Override
    //			public void onAnimationRepeat(Animator animation) {}
    //			
    //			@Override
    //			public void onAnimationEnd(Animator animation) {
    //				mImageTitleTextView.setVisibility(View.GONE);
    //			}
    //			
    //			@Override
    //			public void onAnimationCancel(Animator animation) {}
    //		});
    //		transition.setAnimator(LayoutTransition.APPEARING, fadeInAnimator );
    //		transition.setAnimator(LayoutTransition.DISAPPEARING, fadeOutAnimator);
    //		((ViewGroup)mImageTitleTextView.getParent()).setLayoutTransition(transition);
    mScaleImageView.setImageViewListener(new ImageViewListener() {

        @Override
        public void onSingleTap() {
            // TODO Auto-generated method stub
            //				mScaleImageView.resetScale();
            isClose = true;
            mScaleImageView.startCloseScaleAnimation();
            fadeOutAnimator.start();
        }

        @Override
        public void onScaleEnd() {
            // TODO Auto-generated method stub
            if (isClose) {
                mScaleImageView.setImageDrawable(null);
                rootView.setVisibility(View.GONE);
                ((MainActivity) getActivity()).showImageFragment(null, false, null);
                getActivity().supportInvalidateOptionsMenu();
                isClose = false;
            } else {
                mScaleImageView.setTopCrop(false);
                mScaleImageView.initAttacher();
            //					checkGif();
            }
        }
    });
    //		mImageTitleTextView.setOnLongClickListener(new View.OnLongClickListener() {
    //			
    //			@Override
    //			public boolean onLongClick(View v) {
    //				// TODO Auto-generated method stub
    //				showTitleTextViewTranslate();
    //				return true;
    //			}
    //		});
    mImageTitleTextView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            //				showTitleTextViewTranslate(getActivity(), mCurrentFeedItem.getCaption(),mTranslateManager);
            showTitleTextViewTranslate(getActivity(), mCurrentFeedItem.getCaption(), mYoudaoFanyiManager);
        }
    });
}
Also used : AnimatorListener(android.animation.Animator.AnimatorListener) YoudaoFanyiItem(com.mixiaoxiao.android.youdaofanyi.YoudaoFanyiItem) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ImageViewListener(com.mixiaoxiao.android.view.MxxScaleImageView.ImageViewListener) MxxYoudaoFanyiManager(com.mixiaoxiao.android.youdaofanyi.MxxYoudaoFanyiManager) YoudaoFanyiListener(com.mixiaoxiao.android.youdaofanyi.MxxYoudaoFanyiManager.YoudaoFanyiListener) MxxScaleImageView(com.mixiaoxiao.android.view.MxxScaleImageView) ImageView(android.widget.ImageView) MxxBlurView(com.mixiaoxiao.android.blur.MxxBlurView) View(android.view.View) TextView(android.widget.TextView)

Example 19 with AnimatorListener

use of android.animation.Animator.AnimatorListener in project Xposed-Tinted-Status-Bar by MohammadAG.

the class OverlayDrawable method setOverrideColor.

public void setOverrideColor(final int color) {
    int animateFrom;
    final int animateTo;
    if (mOverrideColor != -3) {
        animateFrom = mOverrideColor;
    } else {
        animateFrom = mColor;
    }
    if (color == -3) {
        animateTo = mColor;
    } else {
        animateTo = color;
    }
    if (mAnimator != null && mAnimator.isRunning()) {
        mAnimator.cancel();
        animateFrom = mOverrideColor;
        mAnimator = null;
    }
    mAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), animateFrom, animateTo);
    mAnimator.addUpdateListener(new AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animator) {
            mOverrideColor = (Integer) animator.getAnimatedValue();
            invalidateSelf();
        }
    });
    mAnimator.addListener(new AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animation) {
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            if (color == -3) {
                mOverrideColor = -3;
                mColor = animateTo;
                invalidateSelf();
            }
            mAnimator = null;
        }

        @Override
        public void onAnimationCancel(Animator animation) {
        }
    });
    mAnimator.start();
}
Also used : AnimatorListener(android.animation.Animator.AnimatorListener) Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) ArgbEvaluator(android.animation.ArgbEvaluator) AnimatorUpdateListener(android.animation.ValueAnimator.AnimatorUpdateListener) ValueAnimator(android.animation.ValueAnimator) Paint(android.graphics.Paint)

Example 20 with AnimatorListener

use of android.animation.Animator.AnimatorListener in project android-different-loading-animations by raweng.

the class AllAnimation method leftToRightToLeftMove.

public void leftToRightToLeftMove() {
    final ValueAnimator valueTvOne_x = ObjectAnimator.ofFloat(leftRightTvOne, "x", leftRightTvOne.getX(), screenWidth * .9f);
    valueTvOne_x.setDuration(1000);
    valueTvOne_x.setRepeatCount(0);
    valueTvOne_x.setRepeatMode(ValueAnimator.REVERSE);
    valueTvOne_x.setInterpolator(new DecelerateInterpolator());
    //- 35);
    final ValueAnimator valueTvTwo_x = ObjectAnimator.ofFloat(leftRightTvTwo, "x", leftRightTvTwo.getX(), screenWidth * .93f);
    valueTvTwo_x.setDuration(1000);
    valueTvTwo_x.setRepeatCount(0);
    valueTvTwo_x.setRepeatMode(ValueAnimator.REVERSE);
    valueTvTwo_x.setInterpolator(new DecelerateInterpolator());
    // - 20);
    final ValueAnimator valueTvThree_x = ObjectAnimator.ofFloat(leftRightTvThree, "x", leftRightTvThree.getX(), screenWidth * .96f);
    valueTvThree_x.setDuration(1000);
    valueTvThree_x.setRepeatCount(0);
    valueTvThree_x.setRepeatMode(ValueAnimator.REVERSE);
    valueTvThree_x.setInterpolator(new DecelerateInterpolator());
    animatorSet1 = new AnimatorSet();
    animatorSet1.playSequentially(valueTvOne_x, valueTvTwo_x, valueTvThree_x);
    animatorSet1.start();
    animatorSet1.addListener(new AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animation) {
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            ValueAnimator valueTvOne_x = ObjectAnimator.ofFloat(leftRightTvOne, "x", leftRightTvOne.getX(), leftRightTvOne.getX() * .01f);
            valueTvOne_x.setDuration(1000);
            valueTvOne_x.setRepeatCount(0);
            valueTvOne_x.setRepeatMode(ValueAnimator.REVERSE);
            valueTvOne_x.setInterpolator(new DecelerateInterpolator());
            final ValueAnimator valueTvTwo_x = ObjectAnimator.ofFloat(leftRightTvTwo, "x", leftRightTvTwo.getX(), leftRightTvTwo.getX() * .03f);
            valueTvTwo_x.setDuration(1000);
            valueTvTwo_x.setRepeatCount(0);
            valueTvTwo_x.setRepeatMode(ValueAnimator.REVERSE);
            valueTvTwo_x.setInterpolator(new DecelerateInterpolator());
            final ValueAnimator valueTvThree_x = ObjectAnimator.ofFloat(leftRightTvThree, "x", leftRightTvThree.getX(), leftRightTvThree.getX() * .06f);
            valueTvThree_x.setDuration(1000);
            valueTvThree_x.setRepeatCount(0);
            valueTvThree_x.setRepeatMode(ValueAnimator.REVERSE);
            valueTvThree_x.setInterpolator(new DecelerateInterpolator());
            animatorSet = new AnimatorSet();
            animatorSet.playSequentially(valueTvThree_x, valueTvTwo_x, valueTvOne_x);
            animatorSet.start();
            animatorSet.addListener(new AnimatorListener() {

                @Override
                public void onAnimationStart(Animator animation) {
                }

                @Override
                public void onAnimationRepeat(Animator animation) {
                }

                @Override
                public void onAnimationEnd(Animator animation) {
                    animatorSet1.start();
                }

                @Override
                public void onAnimationCancel(Animator animation) {
                }
            });
        }

        @Override
        public void onAnimationCancel(Animator animation) {
        }
    });
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) AnimatorListener(android.animation.Animator.AnimatorListener) ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) AnimatorSet(android.animation.AnimatorSet) ValueAnimator(android.animation.ValueAnimator)

Aggregations

AnimatorListener (android.animation.Animator.AnimatorListener)32 ObjectAnimator (android.animation.ObjectAnimator)25 Animator (android.animation.Animator)24 AnimatorSet (android.animation.AnimatorSet)10 ValueAnimator (android.animation.ValueAnimator)8 View (android.view.View)8 ImageView (android.widget.ImageView)6 TextView (android.widget.TextView)6 BaseItemAnimator (com.dk.animation.effect.BaseItemAnimator)6 SegmentAnimator (com.dk.animation.effect.SegmentAnimator)6 AnimatorUpdateListener (android.animation.ValueAnimator.AnimatorUpdateListener)5 Intent (android.content.Intent)5 ArrayList (java.util.ArrayList)4 PropertyValuesHolder (android.animation.PropertyValuesHolder)3 TimeInterpolator (android.animation.TimeInterpolator)3 ArgbEvaluator (android.animation.ArgbEvaluator)2 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)2 Comparator (java.util.Comparator)2 SuppressLint (android.annotation.SuppressLint)1 Paint (android.graphics.Paint)1