List of usage examples for android.animation ValueAnimator start
@Override public void start()
From source file:Main.java
static void changeTextSize(final TextView textView, float from, float to) { ValueAnimator textSizeChangeAnimator = ValueAnimator.ofFloat(from, to); textSizeChangeAnimator.setDuration(150); textSizeChangeAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override/*w w w . ja v a2 s.co m*/ public void onAnimationUpdate(ValueAnimator valueAnimator) { textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, (float) valueAnimator.getAnimatedValue()); } }); textSizeChangeAnimator.start(); }
From source file:Main.java
public static void changeTextColor(final TextView textView, int fromColor, int toColor) { ValueAnimator changeTextColorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), fromColor, toColor); changeTextColorAnimation.setDuration(150); changeTextColorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override//from www .j av a 2s . com public void onAnimationUpdate(ValueAnimator animator) { textView.setTextColor((Integer) animator.getAnimatedValue()); } }); changeTextColorAnimation.start(); }
From source file:Main.java
static void changeTextColor(final TextView textView, int fromColor, int toColor) { ValueAnimator changeTextColorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), fromColor, toColor); changeTextColorAnimation.setDuration(150); changeTextColorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override// w w w . j a va 2 s . com public void onAnimationUpdate(ValueAnimator animator) { textView.setTextColor((Integer) animator.getAnimatedValue()); } }); changeTextColorAnimation.start(); }
From source file:Main.java
static void changeImageColorFilter(final ImageView image, int fromColor, int toColor) { ValueAnimator imageColorChangeAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), fromColor, toColor); imageColorChangeAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override/*from w w w . j a v a2 s .c o m*/ public void onAnimationUpdate(ValueAnimator animator) { image.setColorFilter((Integer) animator.getAnimatedValue()); } }); imageColorChangeAnimation.setDuration(150); imageColorChangeAnimation.start(); }
From source file:Main.java
public static void backgroundColorChange(final View view, int fromColor, int toColor) { ValueAnimator imageColorChangeAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), fromColor, toColor); imageColorChangeAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override//from w w w. ja v a2 s .c om public void onAnimationUpdate(ValueAnimator animator) { view.setBackgroundColor((Integer) animator.getAnimatedValue()); } }); imageColorChangeAnimation.setDuration(150); imageColorChangeAnimation.start(); }
From source file:Main.java
static void changeViewBackgroundColor(final View view, int fromColor, int toColor) { ValueAnimator imageColorChangeAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), fromColor, toColor); imageColorChangeAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override/*from w w w. jav a 2s. co m*/ public void onAnimationUpdate(ValueAnimator animator) { view.setBackgroundColor((Integer) animator.getAnimatedValue()); } }); imageColorChangeAnimation.setDuration(150); imageColorChangeAnimation.start(); }
From source file:Main.java
public static void dimBackground(final float from, final float to, Activity context) { final Window window = context.getWindow(); ValueAnimator valueAnimator = ValueAnimator.ofFloat(from, to); valueAnimator.setDuration(500);/* w ww . jav a 2 s.c o m*/ valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { WindowManager.LayoutParams params = window.getAttributes(); params.alpha = (Float) animation.getAnimatedValue(); window.setAttributes(params); } }); valueAnimator.start(); }
From source file:Main.java
static void changeRightPadding(final View view, int fromPadding, int toPadding) { ValueAnimator animator = ValueAnimator.ofFloat(fromPadding, toPadding); animator.setDuration(150);/*w ww .j av a2 s . c o m*/ animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { float animatedValue = (float) valueAnimator.getAnimatedValue(); view.setPadding(view.getPaddingLeft(), view.getPaddingTop(), (int) animatedValue, view.getPaddingBottom()); } }); animator.start(); }
From source file:Main.java
static void changeViewTopPadding(final View view, int fromPadding, int toPadding) { ValueAnimator animator = ValueAnimator.ofFloat(fromPadding, toPadding); animator.setDuration(150);/*from w w w. j av a 2 s . co m*/ animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { float animatedValue = (float) valueAnimator.getAnimatedValue(); view.setPadding(view.getPaddingLeft(), (int) animatedValue, view.getPaddingRight(), view.getPaddingBottom()); } }); animator.start(); }
From source file:Main.java
public static void animateHeight(final View view, int from, int to, int duration) { boolean expanding = to > from; ValueAnimator anim = ValueAnimator.ofInt(from, to); anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override//from w w w. j av a 2s. co m public void onAnimationUpdate(ValueAnimator valueAnimator) { int val = (Integer) valueAnimator.getAnimatedValue(); ViewGroup.LayoutParams layoutParams = view.getLayoutParams(); layoutParams.height = val; view.setLayoutParams(layoutParams); } }); anim.setDuration(duration); anim.start(); view.animate().alpha(expanding ? 1 : 0).setDuration(duration / 2).start(); }