List of usage examples for android.animation AnimatorListenerAdapter AnimatorListenerAdapter
AnimatorListenerAdapter
From source file:by.gdgminsk.animationguide.util.AnimUtils.java
public static void scaleOut(final View view, int delay) { PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 0.0f); PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 0.0f); PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 0.4f); ObjectAnimator scaleOutAnimation = ObjectAnimator.ofPropertyValuesHolder(view, alpha, scaleX, scaleY); scaleOutAnimation.setInterpolator(EASE_OUT_INTERPOLATOR); scaleOutAnimation.addListener(new AnimatorListenerAdapter() { @Override/* w w w . ja v a2s . c o m*/ public void onAnimationEnd(Animator animation) { view.setVisibility(View.GONE); } @Override public void onAnimationStart(Animator animation) { view.setVisibility(View.VISIBLE); } @Override public void onAnimationCancel(Animator animation) { view.setScaleX(0.0f); view.setScaleY(0.0f); view.setVisibility(View.GONE); } }); scaleOutAnimation.setDuration(view.getResources().getInteger(R.integer.duration_fab_scale_out)); scaleOutAnimation.setStartDelay(delay); scaleOutAnimation.start(); }
From source file:com.hannesdorfmann.home.filter.FilterAdapter.java
@Override public FilterViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) { final FilterViewHolder holder = new FilterViewHolder( LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.filter_item, viewGroup, false)); holder.itemView.setOnClickListener(new View.OnClickListener() { @Override/*from www .ja v a 2 s .c o m*/ public void onClick(View v) { final int position = holder.getAdapterPosition(); if (position == RecyclerView.NO_POSITION) return; final SourceFilterPresentationModel filter = filters.get(position); holder.itemView.setHasTransientState(true); ObjectAnimator fade = ObjectAnimator.ofInt(holder.filterIcon, ViewUtils.IMAGE_ALPHA, filter.getEnabled() ? FILTER_ICON_DISABLED_ALPHA : FILTER_ICON_ENABLED_ALPHA); fade.setDuration(300); fade.setInterpolator(AnimationUtils.loadInterpolator(holder.itemView.getContext(), android.R.interpolator.fast_out_slow_in)); fade.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { holder.itemView.setHasTransientState(false); clickedListener.onSourceFilterClicked(filter); } }); fade.start(); } }); return holder; }
From source file:android.support.transition.ChangeClipBounds.java
@Override public Animator createAnimator(@NonNull final ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {/*from ww w . ja va 2 s.c o m*/ if (startValues == null || endValues == null || !startValues.values.containsKey(PROPNAME_CLIP) || !endValues.values.containsKey(PROPNAME_CLIP)) { return null; } Rect start = (Rect) startValues.values.get(PROPNAME_CLIP); Rect end = (Rect) endValues.values.get(PROPNAME_CLIP); final boolean endIsNull = end == null; if (start == null && end == null) { return null; // No animation required since there is no clip. } if (start == null) { start = (Rect) startValues.values.get(PROPNAME_BOUNDS); } else if (end == null) { end = (Rect) endValues.values.get(PROPNAME_BOUNDS); } if (start.equals(end)) { return null; } ViewCompat.setClipBounds(endValues.view, start); RectEvaluator evaluator = new RectEvaluator(new Rect()); ObjectAnimator animator = ObjectAnimator.ofObject(endValues.view, ViewUtils.CLIP_BOUNDS, evaluator, start, end); if (endIsNull) { final View endView = endValues.view; animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { ViewCompat.setClipBounds(endView, null); } }); } return animator; }
From source file:com.reddyetwo.hashmypass.app.TutorialIntroFragment.java
private void startAnimation() { // Load and set up individual animators AnimatorSet websiteAnimator = (AnimatorSet) AnimatorInflater.loadAnimator(getActivity(), R.animator.intro_website);/*from w w w . j av a 2s .com*/ websiteAnimator.setTarget(mWebsiteTextView); AnimatorSet masterKeyAnimator = (AnimatorSet) AnimatorInflater.loadAnimator(getActivity(), R.animator.intro_master_key); masterKeyAnimator.setTarget(mIcMasterKeyView); AnimatorSet passwordAnimator = (AnimatorSet) AnimatorInflater.loadAnimator(getActivity(), R.animator.intro_password); passwordAnimator.setTarget(mWebsitePasswordView); // Prepare set with all animators, set up repeating and random data mAnimatorSet = new AnimatorSet(); mAnimatorSet.playTogether(websiteAnimator, masterKeyAnimator, passwordAnimator); mAnimatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { generateRandomData(); } @Override public void onAnimationEnd(Animator animation) { if (mAnimatorSet != null) { mAnimatorSet.start(); } } }); mAnimatorSet.start(); }
From source file:com.jaspervanriet.huntingthatproduct.Activities.CollectionActivity.java
private void goBack() { mBackPressed = true;//from w w w. j ava 2 s . co m mCollectionLayout.animate().translationY(Utils.getScreenHeight(this)).setDuration(200) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { CollectionActivity.super.onBackPressed(); overridePendingTransition(0, 0); finish(); } }).start(); }
From source file:fr.cph.stock.android.activity.BaseActivity.java
/** * Show progress bar//from w w w.j a v a 2 s .c om * * @param show * show the bar or not * @param errorMessage * the error message */ @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2) private void showProgress(final boolean show, String errorMessage) { // On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow // for very easy animations. If available, use these APIs to fade-in // the progress spinner. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime); mLoginStatusView.setVisibility(View.VISIBLE); mLoginStatusView.animate().setDuration(shortAnimTime).alpha(show ? 1 : 0) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mLoginStatusView.setVisibility(show ? View.VISIBLE : View.GONE); } }); } else { // The ViewPropertyAnimator APIs are not available, so simply show // and hide the relevant UI components. mLoginStatusView.setVisibility(show ? View.VISIBLE : View.GONE); } }
From source file:com.reddyetwo.hashmypass.app.tutorial.TutorialIntroFragment.java
private void createAnimation() { // Load and set up individual animators AnimatorSet websiteAnimator = (AnimatorSet) AnimatorInflater.loadAnimator(getActivity(), R.animator.intro_website);//from www .j a v a 2 s . co m websiteAnimator.setTarget(mWebsiteTextView); AnimatorSet masterKeyAnimator = (AnimatorSet) AnimatorInflater.loadAnimator(getActivity(), R.animator.intro_master_key); masterKeyAnimator.setTarget(mIcMasterKeyView); AnimatorSet passwordAnimator = (AnimatorSet) AnimatorInflater.loadAnimator(getActivity(), R.animator.intro_password); passwordAnimator.setTarget(mWebsitePasswordView); // Prepare set with all animators, set up repeating and random data mAnimatorSet = new AnimatorSet(); mAnimatorSet.playTogether(websiteAnimator, masterKeyAnimator, passwordAnimator); mAnimatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { mAnimationCancelled = false; generateRandomData(); } @Override public void onAnimationCancel(Animator animation) { mAnimationCancelled = true; } @Override public void onAnimationEnd(Animator animation) { if (!mAnimationCancelled) { mAnimatorSet.start(); } } }); }
From source file:com.grarak.kerneladiutor.views.recyclerview.overallstatistics.FrequencyButtonView.java
private void rotate(final View v, boolean reverse) { ViewPropertyAnimator animator = v.animate().rotation(reverse ? -360 : 360); animator.setListener(new AnimatorListenerAdapter() { @Override//from w w w .j a va2 s. com public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); v.setRotation(0); } }); animator.start(); }
From source file:android.support.designox.widget.FloatingActionButtonIcs.java
@Override void show(@Nullable final InternalVisibilityChangedListener listener, final boolean fromUser) { if (mIsHiding || mView.getVisibility() != View.VISIBLE) { if (ViewCompat.isLaidOut(mView) && !mView.isInEditMode()) { mView.animate().cancel();//from w ww. j a v a2 s. c o m if (mView.getVisibility() != View.VISIBLE) { // If the view isn't visible currently, we'll animate it from a single pixel mView.setAlpha(0f); mView.setScaleY(0f); mView.setScaleX(0f); } mView.animate().scaleX(1f).scaleY(1f).alpha(1f).setDuration(SHOW_HIDE_ANIM_DURATION) .setInterpolator(AnimationUtils.LINEAR_OUT_SLOW_IN_INTERPOLATOR) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { mView.internalSetVisibility(View.VISIBLE, fromUser); } @Override public void onAnimationEnd(Animator animation) { if (listener != null) { listener.onShown(); } } }); } else { mView.internalSetVisibility(View.VISIBLE, fromUser); mView.setAlpha(1f); mView.setScaleY(1f); mView.setScaleX(1f); if (listener != null) { listener.onShown(); } } } }
From source file:com.microsoft.mimickeralarm.onboarding.OnboardingTutorialFragment.java
@Override public void onResume() { super.onResume(); final View welcomePage = getView().findViewById(R.id.onboarding_welcome); View tutorialContainer = getView().findViewById(R.id.onboarding_tutorial); if (!mStarted) { mStarted = true;/*from w ww . j a va2s .c o m*/ tutorialContainer.setAlpha(0f); tutorialContainer.setVisibility(View.VISIBLE); tutorialContainer.animate().alpha(1f).setDuration(WELCOME_MSG_CROSSFADE_DURATION) .setStartDelay(WELCOME_MSG_DURATION).setListener(null); welcomePage.animate().alpha(0).setDuration(WELCOME_MSG_CROSSFADE_DURATION) .setStartDelay(WELCOME_MSG_DURATION).setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { welcomePage.setVisibility(View.GONE); } }); } else { tutorialContainer.setAlpha(1f); } }