List of usage examples for android.view.animation Animation setDuration
public void setDuration(long durationMillis)
From source file:com.dbeginc.dbweather.utils.animations.widgets.RainFallView.java
@Override protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) { super.onSizeChanged(width, height, oldWidth, oldHeight); SecureRandom random = new SecureRandom(); Interpolator interpolator = new LinearInterpolator(); mRainFlakeCount = Math.max(width, height) / 20; coords = new int[mRainFlakeCount][]; drawables.clear();/*from ww w . jav a 2 s .c o m*/ for (int i = 0; i < mRainFlakeCount; i++) { Animation animation = new TranslateAnimation(0, height / 10 - random.nextInt(height / 5), 0, height + 30); animation.setDuration(10 * height + random.nextInt(5 * height)); animation.setRepeatCount(-1); animation.initialize(10, 10, 10, 10); animation.setInterpolator(interpolator); coords[i] = new int[] { random.nextInt(width - 30), -30 }; drawables.add(new AnimateDrawable(mRainDrop, animation)); animation.setStartOffset(random.nextInt(20 * height)); animation.startNow(); int y; y = random.nextInt(2); if (y == 0) { drawables.add(new AnimateDrawable(mRainDrop, animation)); } else { drawables.add(new AnimateDrawable(mRainDrop)); } } }
From source file:com.dbeginc.dbweather.utils.animations.widgets.SnowFallView.java
@Override protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) { super.onSizeChanged(width, height, oldWidth, oldHeight); Random random = new SecureRandom(); Interpolator interpolator = new LinearInterpolator(); snow_flake_count = Math.max(width, height) / 20; coords = new int[snow_flake_count][]; drawables.clear();/*from w ww .j a v a2 s . co m*/ for (int i = 0; i < snow_flake_count; i++) { Animation animation = new TranslateAnimation(0, height / 10 - random.nextInt(height / 5), 0, height + 30); animation.setDuration(10 * height + random.nextInt(5 * height)); animation.setRepeatCount(-1); animation.initialize(10, 10, 10, 10); animation.setInterpolator(interpolator); coords[i] = new int[] { random.nextInt(width - 30), -30 }; drawables.add(new AnimateDrawable(snow_flake, animation)); animation.setStartOffset(random.nextInt(20 * height)); animation.startNow(); int y; y = random.nextInt(2); if (y == 0) { drawables.add(new AnimateDrawable(snow_flake, animation)); } else { drawables.add(new AnimateDrawable(snow_flake)); } } }
From source file:cn.lingox.android.share.view.ScrollAwareFABBehavior.java
private void animateIn(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 {/* www .j a v a 2s .co m*/ Animation anim = AnimationUtils.loadAnimation(button.getContext(), android.support.design.R.anim.design_fab_in); anim.setDuration(200L); anim.setInterpolator(INTERPOLATOR); button.startAnimation(anim); } }
From source file:com.orangemoo.com.beta.widget.ScrollFABBehavior.java
private void animateIn(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).setDuration(Utils.SWIPE_BEHAVIOR_ANIMATION_TIME).start(); } else {//from w w w. j a v a 2s .co m Animation anim = AnimationUtils.loadAnimation(button.getContext(), android.support.design.R.anim.design_fab_in); anim.setDuration(Utils.SWIPE_BEHAVIOR_ANIMATION_TIME); anim.setInterpolator(INTERPOLATOR); button.startAnimation(anim); } }
From source file:dev.vision.shopping.center.Splash.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ImageView iv = new ImageView(this); Animation mLoadAnimation = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.fade_in); mLoadAnimation.setDuration(2500); iv.setImageResource(R.drawable.myapp_loading); mLoadAnimation.setAnimationListener(new AnimationListener() { @Override//from ww w. ja va 2 s. c om public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { new Handler().postDelayed(new Runnable() { @SuppressLint("NewApi") @Override public void run() { Intent i = new Intent(Splash.this, CustomZoomAnimation.class); if (LICENSE.isValid("10/07/2015", Splash.this)) { startActivity(i); finish(); } } }, 2000); } }); iv.setAnimation(mLoadAnimation); setContentView(iv); }
From source file:com.develop.autorus.MainActivity.java
public static void collapse(final View v) { final int initialHeight = v.getMeasuredHeight(); Animation a = new Animation() { @Override//from www . java2 s. c om protected void applyTransformation(float interpolatedTime, Transformation t) { if (interpolatedTime == 1) { v.setVisibility(View.GONE); } else { v.getLayoutParams().height = initialHeight - (int) (initialHeight * interpolatedTime); v.requestLayout(); } } @Override public boolean willChangeBounds() { return true; } }; a.setDuration((int) (initialHeight / v.getContext().getResources().getDisplayMetrics().density)); v.startAnimation(a); }
From source file:com.wii.sean.wiimmfiitus.adapters.CustomWiiCyclerViewAdapter.java
private Animation getBlinkAnimation() { Animation animation = new AlphaAnimation(1, 0); animation.setDuration(500); animation.setInterpolator(new LinearInterpolator()); animation.setRepeatCount(Animation.INFINITE); animation.setRepeatMode(Animation.REVERSE); return animation; }
From source file:pl.wasat.smarthma.customviews.EntryItemView.java
private void titleAnimation() { String title = this.entry.getTitle().replaceFirst("urn:ogc:def:", ""); if (title.length() < 30) { tvEntryTitle.setText(title);/*from ww w . j av a2s .c o m*/ return; } int stopAnimPos = -1000; int startAnimPos = 20; int duration = 30000; Animation animation = new TranslateAnimation(startAnimPos, stopAnimPos, 0, 0); animation.setDuration(duration); animation.setRepeatMode(Animation.RESTART); animation.setRepeatCount(Animation.INFINITE); animation.setAnimationListener(this); tvEntryTitle.setText(title); tvEntryTitle.measure(0, 0); tvEntryTitle.setAnimation(animation); }
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; }// ww w .j a va 2 s. c o m 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; }/*w ww . j a v a 2s .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 = 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); } }