List of usage examples for android.animation ObjectAnimator setRepeatMode
public void setRepeatMode(@RepeatMode int value)
From source file:io.vit.vitio.Fragments.Today.TodayFragment.java
private void animateView() { PowerManager powerManager = (PowerManager) getActivity().getSystemService(Context.POWER_SERVICE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && powerManager.isPowerSaveMode()) { return;//from www . j av a 2 s .c o m } //float dimension = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 200, getResources().getDisplayMetrics()); ObjectAnimator objectAnimatorX = ObjectAnimator.ofFloat(ocassionImage, "scaleX", 1f, 0.8f); ObjectAnimator objectAnimatorY = ObjectAnimator.ofFloat(ocassionImage, "scaleY", 1f, 0.8f); objectAnimatorX.setDuration(6000); objectAnimatorY.setDuration(6000); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playTogether(objectAnimatorX, objectAnimatorY); animatorSet.setInterpolator(new LinearInterpolator()); objectAnimatorX.setRepeatCount(ObjectAnimator.INFINITE); objectAnimatorX.setRepeatMode(ObjectAnimator.REVERSE); objectAnimatorY.setRepeatCount(ObjectAnimator.INFINITE); objectAnimatorY.setRepeatMode(ObjectAnimator.REVERSE); animatorSet.start(); objectAnimatorX.start(); }
From source file:com.box.myview.MyTopSnackBar.TSnackbar.java
/** * @param drawable/*from w ww . j av a 2 s. co m*/ * @param left * @param right * @return */ public TSnackbar addIconProgressLoading(Drawable drawable, boolean left, boolean right) { final ObjectAnimator animator = ObjectAnimator.ofInt(drawable, "level", 0, 10000); animator.setDuration(1000); animator.setInterpolator(new LinearInterpolator()); animator.setRepeatCount(ValueAnimator.INFINITE); animator.setRepeatMode(ValueAnimator.INFINITE); mView.setBackgroundColor(mContext.getResources().getColor(Prompt.SUCCESS.getBackgroundColor())); if (left) { mView.getMessageView().setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null); } if (right) { mView.getMessageView().setCompoundDrawablesWithIntrinsicBounds(null, null, drawable, null); } animator.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { if (mCallback != null) { mCallback.onShown(TSnackbar.this); } SnackbarManager.getInstance().onShown(mManagerCallback); } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); animator.start(); return this; }