List of usage examples for android.view ViewPropertyAnimator setInterpolator
public ViewPropertyAnimator setInterpolator(TimeInterpolator interpolator)
From source file:Main.java
private static void scaleInternal(final View view, int startScaleValue, int endScaleValue, int durationMs, int startDelay, AnimatorListenerAdapter listener, Interpolator interpolator) { view.setScaleX(startScaleValue);/*from w w w . java2s. c om*/ view.setScaleY(startScaleValue); final ViewPropertyAnimator animator = view.animate(); animator.cancel(); animator.setInterpolator(interpolator).scaleX(endScaleValue).scaleY(endScaleValue).setListener(listener) .withLayer(); if (durationMs != DEFAULT_DURATION) { animator.setDuration(durationMs); } animator.setStartDelay(startDelay); animator.start(); }
From source file:Main.java
private static void scaleInternal(final View view, int startScaleValue, int endScaleValue, int durationMs, int startDelay, AnimatorListenerAdapter listener, Interpolator interpolator) { view.setScaleX(startScaleValue);/*from w w w . j ava 2s. c o m*/ view.setScaleY(startScaleValue); final ViewPropertyAnimator animator = view.animate(); animator.cancel(); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { animator.setInterpolator(interpolator).scaleX(endScaleValue).scaleY(endScaleValue) .setListener(listener); } else { animator.setInterpolator(interpolator).scaleX(endScaleValue).scaleY(endScaleValue).setListener(listener) .withLayer(); } if (durationMs != DEFAULT_DURATION) { animator.setDuration(durationMs); } animator.setStartDelay(startDelay); animator.start(); }
From source file:com.erevacation.challenge.rxjavaanimator.ViewAnimatorCreator.java
private static ViewPropertyAnimator animateFadeIn(View view, int duration, int delay, TimeInterpolator interpolator) { view.setAlpha(0);/*from w ww . java 2 s .c o m*/ ViewPropertyAnimator propertyAnimator = view.animate().alpha(1).setStartDelay(delay).setDuration(duration); if (interpolator != null) { propertyAnimator.setInterpolator(interpolator); } else { propertyAnimator.setInterpolator(new LinearOutSlowInInterpolator()); } return propertyAnimator; }
From source file:com.erevacation.challenge.rxjavaanimator.ViewAnimatorCreator.java
private static ViewPropertyAnimator animateFadeOut(View view, int duration, int delay, TimeInterpolator interpolator) { view.setAlpha(1);/*from ww w. j a v a 2s . c om*/ ViewPropertyAnimator propertyAnimator = view.animate().alpha(0).setStartDelay(delay).setDuration(duration); if (interpolator != null) { propertyAnimator.setInterpolator(interpolator); } else { propertyAnimator.setInterpolator(new FastOutLinearInInterpolator()); } return propertyAnimator; }
From source file:com.erevacation.challenge.rxjavaanimator.ViewAnimatorCreator.java
private static ViewPropertyAnimator animateTranslate(View view, int duration, int delay, int dx, TimeInterpolator interpolator) { Timber.d("Translate for dx: " + dx); view.setAlpha(1);// ww w. j a v a 2 s . com ViewPropertyAnimator propertyAnimator = view.animate().translationX(dx).setStartDelay(delay) .setDuration(duration); if (interpolator != null) { propertyAnimator.setInterpolator(interpolator); } else { propertyAnimator.setInterpolator(new FastOutLinearInInterpolator()); } return propertyAnimator; }
From source file:com.erevacation.challenge.rxjavaanimator.ViewAnimatorCreator.java
private static ViewPropertyAnimator animateScaleDown(View view, int duration, int delay, TimeInterpolator interpolator) { view.setScaleX(1);/* www . jav a 2 s. com*/ view.setScaleY(1); ViewPropertyAnimator propertyAnimator = view.animate().scaleX(0).scaleY(0).setStartDelay(delay) .setDuration(duration); if (interpolator != null) { propertyAnimator.setInterpolator(interpolator); } else { propertyAnimator.setInterpolator(new FastOutLinearInInterpolator()); } return propertyAnimator; }
From source file:com.erevacation.challenge.rxjavaanimator.ViewAnimatorCreator.java
private static ViewPropertyAnimator animateScaleUp(View view, int duration, int delay, TimeInterpolator interpolator) { view.setScaleX(0);/*from w ww . j ava 2 s .c om*/ view.setScaleY(0); ViewPropertyAnimator propertyAnimator = view.animate().scaleX(1).scaleY(1).setStartDelay(delay) .setDuration(duration); if (interpolator != null) { propertyAnimator.setInterpolator(interpolator); } else { propertyAnimator.setInterpolator(new LinearOutSlowInInterpolator()); } return propertyAnimator; }
From source file:org.sufficientlysecure.keychain.ui.ViewKeyAdvActivity.java
private void animateMenuItem(final MenuItem vEditSubkeys, final boolean animateShow) { View actionView = LayoutInflater.from(this).inflate(R.layout.edit_icon, null); vEditSubkeys.setActionView(actionView); actionView.setTranslationX(animateShow ? 150 : 0); ViewPropertyAnimator animator = actionView.animate(); animator.translationX(animateShow ? 0 : 150); animator.setDuration(300);//w ww . j a v a2s . c om animator.setInterpolator(new OvershootInterpolator(1.5f)); animator.setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (!animateShow) { vEditSubkeys.setVisible(false); } vEditSubkeys.setActionView(null); } }); animator.start(); }