List of usage examples for android.view.animation AlphaAnimation setAnimationListener
public void setAnimationListener(AnimationListener listener)
Binds an animation listener to this animation.
From source file:Main.java
public static void animationAlpha(View paramView, long paramLong, float paramFloat1, float paramFloat2, Animation.AnimationListener paramAnimationListener) { AlphaAnimation localAlphaAnimation = new AlphaAnimation(paramFloat1, paramFloat2); localAlphaAnimation.setAnimationListener(paramAnimationListener); animation(paramView, localAlphaAnimation, 500L, paramLong); }
From source file:Main.java
public static Animation fadeInLong(final android.view.animation.Animation.AnimationListener animationlistener) { final AlphaAnimation alphaanimation = new AlphaAnimation(0F, 1F); alphaanimation.setDuration(600L);/*from w ww .j a v a 2s . co m*/ alphaanimation.setInterpolator(new LinearInterpolator()); alphaanimation.setAnimationListener(animationlistener); return alphaanimation; }
From source file:Main.java
public static Animation fadeOut(final android.view.animation.Animation.AnimationListener animationlistener) { final AlphaAnimation alphaanimation = new AlphaAnimation(1F, 0F); alphaanimation.setDuration(300L);/* www.ja v a2 s. c om*/ alphaanimation.setInterpolator(new LinearInterpolator()); alphaanimation.setAnimationListener(animationlistener); return alphaanimation; }
From source file:Main.java
public static Animation fadeIn(final android.view.animation.Animation.AnimationListener animationlistener) { final AlphaAnimation alphaanimation = new AlphaAnimation(0F, 1F); alphaanimation.setDuration(300L);/*from w w w. j av a 2 s .co m*/ alphaanimation.setInterpolator(new LinearInterpolator()); alphaanimation.setAnimationListener(animationlistener); return alphaanimation; }
From source file:Main.java
public static AlphaAnimation getAlphaAnimation(float fromAlpha, float toAlpha, long durationMillis, AnimationListener animationListener) { AlphaAnimation alphaAnimation = new AlphaAnimation(fromAlpha, toAlpha); alphaAnimation.setDuration(durationMillis); if (animationListener != null) { alphaAnimation.setAnimationListener(animationListener); }/*from w ww . j a va2 s .c o m*/ return alphaAnimation; }
From source file:Main.java
public static void SetFlickerAnimation(final TextView v, final String info, final String temp) { v.setText(info);//from w w w .j a va 2 s.co m AlphaAnimation anim = new AlphaAnimation(0, 1); anim.setDuration(4000); anim.setRepeatCount(Animation.INFINITE); // anim1.setRepeatMode(Animation.REVERSE); anim.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation arg0) { // TODO Auto-generated method stub } @Override public void onAnimationRepeat(Animation arg0) { // TODO Auto-generated method stub num++; if (num == 10) { num = 0; } if (num % 2 == 0) { v.setText(info); } else { v.setText(temp); } } @Override public void onAnimationEnd(Animation arg0) { // TODO Auto-generated method stub } }); v.startAnimation(anim); }
From source file:Main.java
public static void SetMenuAnimation(final ImageView v, final int bg1, final int bg2) { v.setImageResource(bg1);//from w w w . j a v a 2 s . c o m AlphaAnimation anim = new AlphaAnimation(0.8f, 1); anim.setDuration(1000); anim.setRepeatCount(Animation.INFINITE); // anim1.setRepeatMode(Animation.REVERSE); anim.setInterpolator(new AccelerateInterpolator()); anim.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation arg0) { // TODO Auto-generated method stub } @Override public void onAnimationRepeat(Animation arg0) { // TODO Auto-generated method stub num++; if (num == 10) { num = 0; } if (num % 2 == 0) { v.setImageResource(bg1); } else { v.setImageResource(bg2); } } @Override public void onAnimationEnd(Animation arg0) { // TODO Auto-generated method stub } }); v.startAnimation(anim); }
From source file:fr.shywim.antoinedaniel.utils.Utils.java
/** * First part of the click animation.// w ww . j av a 2 s .c o m * * @param context Any context. * @param v View who will have the effect. * @param isRoot Whether the passed view is the ViewGroup parent. */ public static void clickAnimDown(Context context, View v, boolean isRoot) { RelativeLayout root; if (isRoot) root = (RelativeLayout) v; else root = (RelativeLayout) v.getParent(); final View rectView = new View(context); rectView.setId(R.id.rect_view_id); rectView.setVisibility(View.GONE); rectView.setBackgroundResource(R.drawable.square); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(v.getMeasuredWidth(), v.getMeasuredHeight()); params.addRule(RelativeLayout.ALIGN_TOP, v.getId()); rectView.setLayoutParams(params); AlphaAnimation rectAnim = new AlphaAnimation(0f, 0.4f); rectAnim.setFillAfter(true); rectAnim.setInterpolator(new AccelerateInterpolator()); rectAnim.setDuration(150); rectAnim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { rectView.setVisibility(View.VISIBLE); } @Override public void onAnimationEnd(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); root.addView(rectView); rectView.startAnimation(rectAnim); }
From source file:fr.shywim.antoinedaniel.utils.Utils.java
/** * Second part of the click animation./*from w w w . java 2 s.c o m*/ * * @param v View who will have the effect. * @param isRoot Whether the passed view is the ViewGroup parent. */ public static void clickAnimUp(View v, boolean isRoot) { RelativeLayout root; if (isRoot) root = (RelativeLayout) v; else root = (RelativeLayout) v.getParent(); final View rectView = root.findViewById(R.id.rect_view_id); if (rectView != null) { AlphaAnimation rectAnim = new AlphaAnimation(0.4f, 0f); rectAnim.setFillAfter(true); rectAnim.setInterpolator(new DecelerateInterpolator()); rectAnim.setDuration(150); rectAnim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { new Handler().post(new Runnable() { @Override public void run() { ViewGroup parent = (ViewGroup) rectView.getParent(); rectView.setVisibility(View.GONE); if (parent != null) parent.removeView(rectView); } }); } @Override public void onAnimationRepeat(Animation animation) { } }); rectView.clearAnimation(); rectView.startAnimation(rectAnim); } }
From source file:com.pdftron.pdf.utils.ViewerUtils.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) public static void animateView(final View view, final PDFViewCtrl pdfViewCtrl) { // Example of another animation that could be applied to the view. //ValueAnimator colorAnim = ObjectAnimator.ofInt(view, "backgroundColor", /*Red*/0xFFFF8080, /*Blue*/0xFF8080FF); //colorAnim.setDuration(1500); //colorAnim.setEvaluator(new ArgbEvaluator()); //colorAnim.setRepeatCount(2); //colorAnim.setRepeatMode(ValueAnimator.REVERSE); // Honeycomb introduced new Animation classes that are easier to use // and provide more options. Let's do a runtime check here and use // older classes for pre-Honeycomb devices. if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) { AlphaAnimation anim1 = new AlphaAnimation(0.0f, 1.0f); final AlphaAnimation anim2 = new AlphaAnimation(1.0f, 0.0f); anim1.setDuration(500);//ww w. j ava 2s. c o m anim2.setDuration(500); anim1.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { view.startAnimation(anim2); } }); anim2.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { if (pdfViewCtrl != null) { pdfViewCtrl.removeView(view); } } }); view.startAnimation(anim1); } else { // Since we want the flashing view to be removed once the animation // is finished, we use this listener to remove the view from // PDFViewCtrl when the event is triggered. Animator.AnimatorListener animListener = new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { pdfViewCtrl.removeView(view); } @Override public void onAnimationCancel(Animator animation) { } }; // Get animator for the flashing view. Animator fader = createAlphaAnimator(view, animListener); // If using more than one animator, you can create a set and // play them together, or in some other order... AnimatorSet animation = new AnimatorSet(); animation.playTogether(/*colorAnim, */fader); animation.start(); } }