List of usage examples for android.view.animation AnimationSet setAnimationListener
public void setAnimationListener(AnimationListener listener)
Binds an animation listener to this animation.
From source file:Main.java
protected static void show(final View view) { Animation fadeIn = new AlphaAnimation(0, 1); fadeIn.setStartOffset(500);/*ww w . j av a2s .c o m*/ fadeIn.setDuration(500); Animation collapse = new ScaleAnimation(1, 1, 0, 1); collapse.setDuration(500); AnimationSet animation = new AnimationSet(false); animation.setInterpolator(new AccelerateInterpolator()); animation.addAnimation(collapse); animation.addAnimation(fadeIn); animation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { view.setVisibility(View.VISIBLE); } @Override public void onAnimationEnd(Animation animation) { view.setVisibility(View.VISIBLE); } @Override public void onAnimationRepeat(Animation animation) { } }); view.startAnimation(animation); }
From source file:Main.java
public static AnimationSet flash(final android.view.animation.Animation.AnimationListener animationlistener) { final AnimationSet animationset = new AnimationSet(true); final AlphaAnimation alphaanimation = new AlphaAnimation(0F, 1F); alphaanimation.setStartOffset(500L); alphaanimation.setDuration(100L);/*from ww w .j a v a 2 s . c o m*/ animationset.addAnimation(alphaanimation); final AlphaAnimation alphaanimation1 = new AlphaAnimation(1F, 0F); alphaanimation1.setDuration(100L); alphaanimation1.setStartOffset(1200L); animationset.addAnimation(alphaanimation1); animationset.setAnimationListener(animationlistener); return animationset; }
From source file:Main.java
public static void enlargeToRight(FragmentActivity activity, View view, AnimationListener listener) { DisplayMetrics displaymetrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); int screenHeight = displaymetrics.heightPixels; int screenWidth = displaymetrics.widthPixels; AnimationSet animation = new AnimationSet(true); float pivotX = view.getWidth() / 2; float pivotY = view.getHeight() / 2; ScaleAnimation anim = new ScaleAnimation(0.8f, 1f, 0.8f, 1f, pivotX, pivotY); anim.setInterpolator(new LinearInterpolator()); anim.setDuration(200);/*from w w w .ja va2s . c o m*/ anim.setStartOffset(200); //anim.setFillAfter(true); animation.addAnimation(anim); TranslateAnimation animTrans = new TranslateAnimation(0.0f, (float) (screenWidth - view.getWidth()), 0.0f, 0.0f); anim.setInterpolator(new LinearInterpolator()); animTrans.setDuration(400); //animTrans.setStartOffset(300); animation.addAnimation(animTrans); if (listener != null) animation.setAnimationListener(listener); view.startAnimation(animation); }
From source file:Main.java
public static void shrinkToLeft(FragmentActivity activity, View view, AnimationListener listener) { DisplayMetrics displaymetrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); int screenHeight = displaymetrics.heightPixels; int screenWidth = displaymetrics.widthPixels; AnimationSet animation = new AnimationSet(true); float pivotX = view.getWidth() / 2; float pivotY = view.getHeight() / 2; ScaleAnimation anim = new ScaleAnimation(1f, 0.8f, 1f, 0.8f, pivotX, pivotY); anim.setInterpolator(new LinearInterpolator()); anim.setDuration(200);// w ww .j ava 2 s . c o m anim.setStartOffset(200); //anim.setFillAfter(true); animation.addAnimation(anim); TranslateAnimation animTrans = new TranslateAnimation(0.0f, (float) -(screenWidth - view.getWidth()), 0.0f, 0.0f); anim.setInterpolator(new LinearInterpolator()); animTrans.setDuration(400); //animTrans.setStartOffset(300); animation.addAnimation(animTrans); if (listener != null) animation.setAnimationListener(listener); view.startAnimation(animation); }
From source file:com.example.fragment.ScreenSlidePageFragment.java
public void startAnimation() { // SELECT LAYER ScrollView relate = (ScrollView) mRootView.findViewById(R.id.content); // relate.setVisibility(View.VISIBLE); AnimationSet set = new AnimationSet(true); set.setAnimationListener(this); TranslateAnimation translate;/*from w w w .ja v a 2 s. c o m*/ float toX = -8.0f / 100.0f;//0.0f; float fromX = 0.0f;//-8.0f / 100.0f; float toY = 0.0f; float fromY = 29.0f / 100.0f; translate = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, fromX, Animation.RELATIVE_TO_PARENT, toX, Animation.RELATIVE_TO_PARENT, fromY, Animation.RELATIVE_TO_PARENT, toY); translate.setDuration(2000); translate.setInterpolator(new AccelerateInterpolator()); set.addAnimation(translate); set.setFillBefore(true); // set.setFillBefore(false); // set.setFillAfter(false); set.setFillAfter(true); relate.startAnimation(set); }
From source file:com.example.fragment.PrimitiveFragment.java
public void testAnimation(float destX, float destY) { this.mDestX = Factory.getAdjustedX(destX); this.mDestY = Factory.getAdjustedY(destY); // SELECT LAYER FrameLayout relate = (FrameLayout) mRootView.findViewById(R.id.FLBackLayer); // ScrollView relate = (ScrollView)mRootView.findViewById(R.id.content); // relate.setVisibility(View.VISIBLE); AnimationSet set = new AnimationSet(true); set.setAnimationListener(this); TranslateAnimation translate;/*from ww w . j a v a2 s. co m*/ float toX = this.mDestX; float fromX = this.mSrcX; float toY = this.mDestY; float fromY = this.mSrcY; translate = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, fromX, Animation.RELATIVE_TO_PARENT, toX, Animation.RELATIVE_TO_PARENT, fromY, Animation.RELATIVE_TO_PARENT, toY); translate.setDuration(Constants.Animation.IPF_START); translate.setInterpolator(new AccelerateInterpolator()); set.addAnimation(translate); set.setFillBefore(true); // set.setFillBefore(false); // set.setFillAfter(false); set.setFillAfter(true); relate.startAnimation(set); }
From source file:com.example.fragment.PrimitiveFragment.java
public void move(float destX, float destY) { if (!this.mIsAlive) return;//from www. ja v a2s . com if (this.mIsMoving) { return;// ADD Array } this.mDestX = Factory.getAdjustedX(destX - this.mPaddingW); this.mDestY = Factory.getAdjustedY(destY - this.mPaddingH); // SELECT LAYER FrameLayout relate = (FrameLayout) mRootView.findViewById(R.id.FLBackLayer); // ScrollView relate = (ScrollView)mRootView.findViewById(R.id.content); // relate.setVisibility(View.VISIBLE); AnimationSet set = new AnimationSet(true); set.setAnimationListener(this); TranslateAnimation translate; float toX = this.mDestX; float fromX = this.mSrcX; float toY = this.mDestY; float fromY = this.mSrcY; translate = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, fromX, Animation.RELATIVE_TO_PARENT, toX, Animation.RELATIVE_TO_PARENT, fromY, Animation.RELATIVE_TO_PARENT, toY); translate.setDuration(Constants.Animation.IPF); translate.setInterpolator(new AccelerateInterpolator()); set.addAnimation(translate); set.setFillBefore(true); // set.setFillBefore(false); // set.setFillAfter(false); set.setFillAfter(true); relate.startAnimation(set); this.mIsMoving = true; this.mIsMove = true; }
From source file:com.watasan.infospider.fragment.PrimitiveFragment.java
/** SCRIPT ACTION AREA --------------------------------------------------> */ public void testAnimation(float destX, float destY) { this.mDestX = Factory.getAdjustedX(destX); this.mDestY = Factory.getAdjustedY(destY); // SELECT LAYER FrameLayout relate = (FrameLayout) mRootView.findViewById(R.id.FLBackLayer); // ScrollView relate = (ScrollView)mRootView.findViewById(R.id.content); // relate.setVisibility(View.VISIBLE); AnimationSet set = new AnimationSet(true); set.setAnimationListener(this); TranslateAnimation translate;/*w w w.ja va2 s . c o m*/ float toX = this.mDestX; float fromX = this.mSrcX; float toY = this.mDestY; float fromY = this.mSrcY; translate = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, fromX, Animation.RELATIVE_TO_PARENT, toX, Animation.RELATIVE_TO_PARENT, fromY, Animation.RELATIVE_TO_PARENT, toY); translate.setDuration(Constants.Animation.IPF_START); translate.setInterpolator(new AccelerateInterpolator()); set.addAnimation(translate); set.setFillBefore(true); // set.setFillBefore(false); // set.setFillAfter(false); set.setFillAfter(true); relate.startAnimation(set); }
From source file:it.imwatch.nfclottery.dialogs.InsertContactDialog.java
/** * Hides the email error textview./*w w w . j a va2 s. c om*/ */ private void hideEmailError() { mEmailErrorState = 0; // Re-enable the positive button of the dialog iif the name is also valid setFormIsValidated(mNameErrorState == 0); if (mEmailErrorTextView.getVisibility() == View.GONE) { return; // No need to animate out the textview, it's already gone } AnimationSet fadeOutSet = new AnimationSet(true); fadeOutSet.addAnimation(new AlphaAnimation(1f, 0f)); fadeOutSet.addAnimation(new TranslateAnimation(0f, 0f, 0f, -mErrorAnimTranslateY)); fadeOutSet.setDuration(300); fadeOutSet.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { // Don't care } @Override public void onAnimationEnd(Animation animation) { mEmailErrorTextView.setVisibility(View.GONE); } @Override public void onAnimationRepeat(Animation animation) { // Don't care } }); mEmailErrorTextView.startAnimation(fadeOutSet); }
From source file:it.imwatch.nfclottery.dialogs.InsertContactDialog.java
/** * Hides the name error textview./*from w ww .j a v a 2s . co m*/ */ private void hideNameError() { mNameErrorState = 0; // Re-enable the positive button of the dialog iif the name is also valid setFormIsValidated(mEmailErrorState == 0); if (mNameErrorTextView.getVisibility() == View.GONE) { return; // No need to animate out the textview, it's already gone } AnimationSet fadeOutSet = new AnimationSet(true); fadeOutSet.addAnimation(new AlphaAnimation(1f, 0f)); fadeOutSet.addAnimation(new TranslateAnimation(0f, 0f, 0f, -mErrorAnimTranslateY)); fadeOutSet.setDuration(300); fadeOutSet.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { // Don't care } @Override public void onAnimationEnd(Animation animation) { mNameErrorTextView.setVisibility(View.GONE); } @Override public void onAnimationRepeat(Animation animation) { // Don't care } }); mNameErrorTextView.startAnimation(fadeOutSet); }