List of usage examples for android.view.animation Animation setStartTime
public void setStartTime(long startTimeMillis)
From source file:Main.java
public static Animation createForeverReverseRotationAnimation() { Animation mRotateAnimation = new RotateAnimation(720, 0, Animation.RESTART, 0.5f, Animation.RESTART, 0.5f); mRotateAnimation.setInterpolator(new LinearInterpolator()); mRotateAnimation.setRepeatCount(Animation.INFINITE); mRotateAnimation.setRepeatMode(Animation.RESTART); mRotateAnimation.setStartTime(Animation.START_ON_FIRST_FRAME); return mRotateAnimation; }
From source file:Main.java
public static Animation createForeverRotationAnimation() { Animation mRotateAnimation = new RotateAnimation(0, 1080, Animation.RESTART, 0.5f, Animation.RESTART, 0.5f); mRotateAnimation.setInterpolator(new LinearInterpolator()); mRotateAnimation.setRepeatCount(Animation.INFINITE); mRotateAnimation.setRepeatMode(Animation.RESTART); mRotateAnimation.setStartTime(Animation.START_ON_FIRST_FRAME); return mRotateAnimation; }
From source file:org.smssecure.smssecure.util.ViewUtil.java
public static void animateIn(final @NonNull View view, final @NonNull Animation animation) { if (view.getVisibility() == View.VISIBLE) return;/*from w w w . j a va2 s . c o m*/ view.clearAnimation(); animation.reset(); animation.setStartTime(0); view.setVisibility(View.VISIBLE); view.startAnimation(animation); }
From source file:org.smssecure.smssecure.util.ViewUtil.java
public static ListenableFuture<Boolean> animateOut(final @NonNull View view, final @NonNull Animation animation, final int visibility) { final SettableFuture future = new SettableFuture(); if (view.getVisibility() == visibility) { future.set(true);//from ww w . j a v a 2s. c om } else { view.clearAnimation(); animation.reset(); animation.setStartTime(0); animation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { view.setVisibility(visibility); future.set(true); } }); view.startAnimation(animation); } return future; }
From source file:com.benefit.buy.library.http.query.callback.BitmapAjaxCallback.java
private static void setBmAnimate(ImageView iv, Bitmap bm, Bitmap preset, int fallback, int animation, float ratio, float anchor, int source) { bm = filter(iv, bm, fallback);/*from ww w .j a v a 2 s . c o m*/ if (bm == null) { iv.setImageBitmap(null); return; } Drawable d = makeDrawable(iv, bm, ratio, anchor); Animation anim = null; if (fadeIn(animation, source)) { if (preset == null) { anim = new AlphaAnimation(0, 1); anim.setInterpolator(new DecelerateInterpolator()); anim.setDuration(FADE_DUR); } else { Drawable pd = makeDrawable(iv, preset, ratio, anchor); Drawable[] ds = new Drawable[] { pd, d }; TransitionDrawable td = new TransitionDrawable(ds); td.setCrossFadeEnabled(true); td.startTransition(FADE_DUR); d = td; } } else if (animation > 0) { anim = AnimationUtils.loadAnimation(iv.getContext(), animation); } iv.setImageDrawable(d); if (anim != null) { anim.setStartTime(AnimationUtils.currentAnimationTimeMillis()); iv.startAnimation(anim); } else { iv.setAnimation(null); } }
From source file:cn.jmessage.android.uikit.pickerimage.view.BaseZoomableImageView.java
protected void center(boolean vertical, boolean horizontal, boolean animate) { if (mBitmap == null) return;// w ww . ja v a 2s .c o m Matrix m = getImageViewMatrix(); float[] topLeft = new float[] { 0, 0 }; float[] botRight = new float[] { mBitmap.getWidth(), mBitmap.getHeight() }; translatePoint(m, topLeft); translatePoint(m, botRight); float height = botRight[1] - topLeft[1]; float width = botRight[0] - topLeft[0]; float deltaX = 0, deltaY = 0; if (vertical) { int viewHeight = getHeight(); if (height < viewHeight) { deltaY = (viewHeight - height) / 2 - topLeft[1]; } else if (topLeft[1] > 0) { deltaY = -topLeft[1]; } else if (botRight[1] < viewHeight) { deltaY = getHeight() - botRight[1]; } } if (horizontal) { int viewWidth = getWidth(); if (width < viewWidth) { deltaX = (viewWidth - width) / 2 - topLeft[0]; } else if (topLeft[0] > 0) { deltaX = -topLeft[0]; } else if (botRight[0] < viewWidth) { deltaX = viewWidth - botRight[0]; } } postTranslate(deltaX, deltaY); if (animate) { Animation a = new TranslateAnimation(-deltaX, 0, -deltaY, 0); a.setStartTime(SystemClock.elapsedRealtime()); a.setDuration(250); setAnimation(a); } setImageMatrix(getImageViewMatrix()); }
From source file:com.appbase.androidquery.callback.BitmapAjaxCallback.java
private static void setBmAnimate(ImageView iv, Bitmap bm, Bitmap preset, int fallback, int animation, float ratio, float anchor, int source) { bm = filter(iv, bm, fallback);/* w w w .jav a2 s . co m*/ if (bm == null) { iv.setImageBitmap(null); return; } Drawable d = makeDrawable(iv, bm, ratio, anchor); Animation anim = null; if (fadeIn(animation, source)) { if (preset == null) { anim = new AlphaAnimation(0, 1); anim.setInterpolator(new DecelerateInterpolator()); anim.setDuration(FADE_DUR); } else { Drawable pd = makeDrawable(iv, preset, ratio, anchor); Drawable[] ds = new Drawable[] { pd, d }; TransitionDrawable td = new TransitionDrawable(ds); td.setCrossFadeEnabled(true); td.startTransition(FADE_DUR); d = td; } } else if (animation > 0) { anim = AnimationUtils.loadAnimation(iv.getContext(), animation); } iv.setImageDrawable(d); if (anim != null) { anim.setStartTime(AnimationUtils.currentAnimationTimeMillis()); iv.startAnimation(anim); } else { iv.setAnimation(null); } }