List of usage examples for android.view.animation Animation setAnimationListener
public void setAnimationListener(AnimationListener listener)
Binds an animation listener to this animation.
From source file:nl.endran.scrumpoker.fragments.cardselection.CardDisplayFragment.java
public void show(CardSelection cardSelection) { if (!showing) { showing = true;//from www . ja v a 2s. c om int stringId = cardSelection.getCardValue().getStringId(); if (stringId == R.string.coffee) { textViewNumber.setTextSize(TypedValue.COMPLEX_UNIT_PX, textViewName.getResources().getDimension(R.dimen.display_mid_text_size)); } else { textViewNumber.setTextSize(TypedValue.COMPLEX_UNIT_PX, textViewName.getResources().getDimension(R.dimen.display_large_text_size)); } textViewNumber.setText(stringId); textViewName.setText(cardSelection.getCardValue().toString().replace("_", " ")); textViewName.setBackgroundColor(cardSelection.getColorDark()); cardView.setCardBackgroundColor(cardSelection.getColor()); Animation animation = animationManager.createAnimation(getContext(), R.anim.slide_in_bottom_center_with_bounce); animation.setAnimationListener(new SetVisibleOnAnimationStartListener(cardView)); cardView.startAnimation(animation); } }
From source file:org.telegram.ui.Views.BaseFragment.java
@Override public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) { if (nextAnim != 0) { Animation anim = AnimationUtils.loadAnimation(getActivity(), nextAnim); anim.setAnimationListener(new Animation.AnimationListener() { public void onAnimationStart(Animation animation) { BaseFragment.this.onAnimationStart(); }/* ww w. j av a 2 s. co m*/ public void onAnimationRepeat(Animation animation) { } public void onAnimationEnd(Animation animation) { BaseFragment.this.onAnimationEnd(); } }); return anim; } else { return super.onCreateAnimation(transit, enter, nextAnim); } }
From source file:com.architjn.acjmusicplayer.elements.ScrollAwareFABBehavior.java
private void animateOut(final FloatingActionButton button) { Animation anim = AnimationUtils.loadAnimation(button.getContext(), R.anim.abc_slide_out_bottom); anim.setInterpolator(INTERPOLATOR);// ww w. j a v a2 s.c o m anim.setDuration(600L); anim.setAnimationListener(new Animation.AnimationListener() { public void onAnimationStart(Animation animation) { ScrollAwareFABBehavior.this.mIsAnimatingOut = true; } public void onAnimationEnd(Animation animation) { ScrollAwareFABBehavior.this.mIsAnimatingOut = false; button.setVisibility(View.GONE); } @Override public void onAnimationRepeat(final Animation animation) { } }); button.startAnimation(anim); }
From source file:it.bellotti.android.materialdesignsample.ui.widget.ScrollAwareFABBehavior.java
private void animateFabIn(final FloatingActionButton button) { button.setVisibility(View.VISIBLE); if (Build.VERSION.SDK_INT >= 14) { ViewCompat.animate(button).scaleX(1.0F).scaleY(1.0F).alpha(1.0F).setInterpolator(INTERPOLATOR) .withLayer().setListener(null).start(); } else {//from ww w . j ava 2 s.c om Animation anim = new ScaleAnimation(0.0F, 0.0F, 1.0F, 1.0F); anim.setDuration(200L); anim.setInterpolator(INTERPOLATOR); anim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { ScrollAwareFABBehavior.this.mIsAnimatingOut = true; } @Override public void onAnimationEnd(Animation animation) { ScrollAwareFABBehavior.this.mIsAnimatingOut = false; button.setVisibility(View.VISIBLE); } @Override public void onAnimationRepeat(Animation animation) { } }); button.startAnimation(anim); } }
From source file:com.iven.lfflfeedreader.mainact.fabscroll.java
private void animateOut(final FloatingActionButton button) { if (Build.VERSION.SDK_INT >= 14) { ViewCompat.animate(button).scaleX(0.0F).scaleY(0.0F).alpha(0.0F).setInterpolator(INTERPOLATOR) .withLayer().setListener(new ViewPropertyAnimatorListener() { public void onAnimationStart(View view) { fabscroll.this.mIsAnimatingOut = true; }/* www. ja va 2 s . c om*/ public void onAnimationCancel(View view) { fabscroll.this.mIsAnimatingOut = false; } public void onAnimationEnd(View view) { fabscroll.this.mIsAnimatingOut = false; view.setVisibility(View.GONE); } }).start(); } else { Animation anim = AnimationUtils.loadAnimation(button.getContext(), R.anim.fab_out); anim.setInterpolator(INTERPOLATOR); anim.setDuration(200L); anim.setAnimationListener(new Animation.AnimationListener() { public void onAnimationStart(Animation animation) { fabscroll.this.mIsAnimatingOut = true; } public void onAnimationEnd(Animation animation) { fabscroll.this.mIsAnimatingOut = false; button.setVisibility(View.GONE); } @Override public void onAnimationRepeat(final Animation animation) { } }); button.startAnimation(anim); } }
From source file:it.bellotti.android.materialdesignsample.ui.widget.ScrollAwareFABBehavior.java
private void animateFabOut(final FloatingActionButton button) { if (Build.VERSION.SDK_INT >= 14) { ViewCompat.animate(button).scaleX(0.0F).scaleY(0.0F).alpha(0.0F).setInterpolator(INTERPOLATOR) .withLayer().setListener(new ViewPropertyAnimatorListener() { public void onAnimationStart(View view) { ScrollAwareFABBehavior.this.mIsAnimatingOut = true; }/*from w w w .j a va 2s. c o m*/ public void onAnimationCancel(View view) { ScrollAwareFABBehavior.this.mIsAnimatingOut = false; } public void onAnimationEnd(View view) { ScrollAwareFABBehavior.this.mIsAnimatingOut = false; view.setVisibility(View.GONE); } }).start(); } else { Animation anim = new ScaleAnimation(1.0F, 1.0F, 0.0F, 0.0F); anim.setInterpolator(INTERPOLATOR); anim.setDuration(200L); anim.setAnimationListener(new Animation.AnimationListener() { public void onAnimationStart(Animation animation) { ScrollAwareFABBehavior.this.mIsAnimatingOut = true; } public void onAnimationEnd(Animation animation) { ScrollAwareFABBehavior.this.mIsAnimatingOut = false; button.setVisibility(View.GONE); } @Override public void onAnimationRepeat(final Animation animation) { } }); button.startAnimation(anim); } }
From source file:br.com.devfestsul.planetas.utils.ScrollAwareFABBehavior.java
private void animateOut(final FloatingActionButton button) { if (Build.VERSION.SDK_INT >= 14) { ViewCompat.animate(button).scaleX(0.0F).scaleY(0.0F).alpha(0.0F).setInterpolator(INTERPOLATOR) .withLayer().setListener(new ViewPropertyAnimatorListener() { public void onAnimationStart(View view) { ScrollAwareFABBehavior.this.mIsAnimatingOut = true; }/*from ww w .ja v a 2 s .co m*/ public void onAnimationCancel(View view) { ScrollAwareFABBehavior.this.mIsAnimatingOut = false; } public void onAnimationEnd(View view) { ScrollAwareFABBehavior.this.mIsAnimatingOut = false; view.setVisibility(View.GONE); } }).start(); } else { Animation anim = AnimationUtils.loadAnimation(button.getContext(), R.anim.fab_out); anim.setInterpolator(INTERPOLATOR); anim.setDuration(200L); anim.setAnimationListener(new Animation.AnimationListener() { public void onAnimationStart(Animation animation) { ScrollAwareFABBehavior.this.mIsAnimatingOut = true; } public void onAnimationEnd(Animation animation) { ScrollAwareFABBehavior.this.mIsAnimatingOut = false; button.setVisibility(View.GONE); } @Override public void onAnimationRepeat(final Animation animation) { } }); button.startAnimation(anim); } }
From source file:com.tamuhack.bootcamp.MessagesFragment.java
public void showError() { Animation slideDown = AnimationUtils.loadAnimation(getContext(), R.anim.slide_in_out_top); slideDown.setAnimationListener(new Animation.AnimationListener() { @Override// w w w. j a v a2 s . c o m public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { // need to hide the view when the animation is complete mError.setVisibility(View.GONE); } @Override public void onAnimationRepeat(Animation animation) { } }); mError.startAnimation(slideDown); mError.setVisibility(View.VISIBLE); }
From source file:com.gubo.vosh.ScrollAwareFABBehavior.java
private void animateOut(final FloatingActionButton button) { if (Build.VERSION.SDK_INT >= 14) { ViewCompat.animate(button).scaleX(0.0F).scaleY(0.0F).alpha(0.0F).setInterpolator(INTERPOLATOR) .withLayer().setListener(new ViewPropertyAnimatorListener() { public void onAnimationStart(View view) { ScrollAwareFABBehavior.this.mIsAnimatingOut = true; }// w w w . j a v a 2s .c o m public void onAnimationCancel(View view) { ScrollAwareFABBehavior.this.mIsAnimatingOut = false; } public void onAnimationEnd(View view) { ScrollAwareFABBehavior.this.mIsAnimatingOut = false; view.setVisibility(View.GONE); } }).start(); } else { Animation anim = AnimationUtils.loadAnimation(button.getContext(), android.R.anim.fade_out); anim.setInterpolator(INTERPOLATOR); anim.setDuration(200L); anim.setAnimationListener(new Animation.AnimationListener() { public void onAnimationStart(Animation animation) { ScrollAwareFABBehavior.this.mIsAnimatingOut = true; } public void onAnimationEnd(Animation animation) { ScrollAwareFABBehavior.this.mIsAnimatingOut = false; button.setVisibility(View.GONE); } @Override public void onAnimationRepeat(final Animation animation) { } }); button.startAnimation(anim); } }