List of usage examples for android.view.animation DecelerateInterpolator DecelerateInterpolator
public DecelerateInterpolator()
From source file:cardstream.CardActionButton.java
@Override public boolean onTouchEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: { setPressed(true);//from w ww. ja v a 2 s . c o m Log.d("", "click"); if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) { animate().scaleX(0.98f).scaleY(0.98f).setDuration(100) .setInterpolator(new DecelerateInterpolator()); } else { ViewCompat.setElevation(this, 8.f); } break; } case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: { setPressed(false); if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) { animate().scaleX(1.f).scaleY(1.f).setDuration(50).setInterpolator(new BounceInterpolator()); } else { ViewCompat.setElevation(this, 0.f); } break; } } return super.onTouchEvent(event); }
From source file:com.bobomee.android.navigator.expandable.Utils.java
/** * Creates interpolator./*from w ww . j a va 2 s . c o m*/ * @return a timeinterpolator * @param interpolatorType a int value from 0 to 10 */ public static TimeInterpolator createInterpolator(@IntRange(from = 0, to = 10) final int interpolatorType) { switch (interpolatorType) { case ACCELERATE_DECELERATE_INTERPOLATOR: return new AccelerateDecelerateInterpolator(); case ACCELERATE_INTERPOLATOR: return new AccelerateInterpolator(); case ANTICIPATE_INTERPOLATOR: return new AnticipateInterpolator(); case ANTICIPATE_OVERSHOOT_INTERPOLATOR: return new AnticipateOvershootInterpolator(); case BOUNCE_INTERPOLATOR: return new BounceInterpolator(); case DECELERATE_INTERPOLATOR: return new DecelerateInterpolator(); case FAST_OUT_LINEAR_IN_INTERPOLATOR: return new FastOutLinearInInterpolator(); case FAST_OUT_SLOW_IN_INTERPOLATOR: return new FastOutSlowInInterpolator(); case LINEAR_INTERPOLATOR: return new LinearInterpolator(); case LINEAR_OUT_SLOW_IN_INTERPOLATOR: return new LinearOutSlowInInterpolator(); case OVERSHOOT_INTERPOLATOR: return new OvershootInterpolator(); default: return new LinearInterpolator(); } }
From source file:com.kogitune.activitytransition.fragment.ExitFragmentTransition.java
public void startExitListening(final Runnable popBackStackRunnable) { if (interpolator == null) { interpolator = new DecelerateInterpolator(); }//from ww w .j a v a 2 s. c om final View toView = moveData.toView; toView.setFocusableInTouchMode(true); toView.requestFocus(); toView.setOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if (event.getAction() != KeyEvent.ACTION_UP) { return true; } TransitionAnimation.startExitAnimation(moveData, interpolator, new Runnable() { @Override public void run() { if (popBackStackRunnable != null) { popBackStackRunnable.run(); return; } if (fragment == null) { if (!supportFragment.isResumed()) { return; } final FragmentManager fragmentManager = supportFragment.getFragmentManager(); if (fragmentManager != null) { fragmentManager.popBackStack(); } } else { if (!fragment.isResumed()) { return; } final android.app.FragmentManager fragmentManager = fragment.getFragmentManager(); if (fragmentManager != null) { fragmentManager.popBackStack(); } } } }); return true; } return false; } }); }
From source file:org.mozilla.gecko.animation.PropertyAnimator.java
public PropertyAnimator(long duration) { this(duration, new DecelerateInterpolator()); }
From source file:com.kogitune.activity_transition.fragment.ExitFragmentTransition.java
public void startExitListening(final Runnable popBackStackRunnable) { if (interpolator == null) { interpolator = new DecelerateInterpolator(); }// ww w . j a v a 2 s . c o m final View toView = moveData.toView; toView.setFocusableInTouchMode(true); toView.requestFocus(); toView.setOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if (event.getAction() != KeyEvent.ACTION_UP) { return true; } TransitionAnimation.startExitAnimation(moveData, interpolator, new Runnable() { @Override public void run() { if (popBackStackRunnable != null) { popBackStackRunnable.run(); return; } if (fragment == null) { if (!supportFragment.isResumed()) { return; } final FragmentManager fragmentManager = supportFragment.getFragmentManager(); if (fragmentManager != null) { fragmentManager.popBackStack(); } } else { if (!fragment.isResumed()) { return; } final android.app.FragmentManager fragmentManager = fragment.getFragmentManager(); if (fragmentManager != null) { fragmentManager.popBackStack(); } } } }, listener); return true; } return false; } }); }
From source file:com.kogitune.activitytransition.fragment.FragmentTransition.java
public ExitFragmentTransition start(Bundle savedInstanceState) { if (interpolator == null) { interpolator = new DecelerateInterpolator(); }//ww w. ja va2 s . com final Context context = toView.getContext(); final Bundle bundle; if (fragment == null) { bundle = supportFragment.getArguments(); } else { bundle = fragment.getArguments(); } final MoveData moveData = TransitionAnimation.startAnimation(context, toView, bundle, savedInstanceState, duration, interpolator); if (fragment == null) { return new ExitFragmentTransition(supportFragment, moveData); } return new ExitFragmentTransition(fragment, moveData); }
From source file:com.kogitune.activitytransition.ActivityTransition.java
public ExitActivityTransition start(Bundle savedInstanceState) { if (interpolator == null) { interpolator = new DecelerateInterpolator(); }/*w w w.j a v a2 s . c o m*/ final Bundle bundle = fromIntent.getExtras(); if (Build.VERSION.SDK_INT >= 21) { final TransitionData transitionData = new TransitionData(toView.getContext(), bundle); if (transitionData.imageFilePath != null) { TransitionAnimation.setImageToView(toView, transitionData.imageFilePath); } ViewCompat.setTransitionName(toView, toViewName); final Window window = ((Activity) context).getWindow(); TransitionSet set = new TransitionSet(); set.addTransition(new ChangeBounds()); set.addTransition(new ChangeImageTransform()); set.setInterpolator(interpolator); window.setSharedElementEnterTransition(set); window.setSharedElementReturnTransition(set); return new ExitActivityTransition(null); } final Context context = toView.getContext(); final MoveData moveData = TransitionAnimation.startAnimation(context, toView, bundle, savedInstanceState, duration, interpolator); return new ExitActivityTransition(moveData); }
From source file:com.yoloo.android.util.AnimUtils.java
public static Interpolator getDecelerateInterpolator() { if (decelerate == null) { decelerate = new DecelerateInterpolator(); }/*www . j a va2 s. co m*/ return decelerate; }
From source file:com.kogitune.activity_transition.fragment.FragmentTransition.java
public ExitFragmentTransition start(Bundle savedInstanceState) { if (interpolator == null) { interpolator = new DecelerateInterpolator(); }/*from w w w . java2 s. c o m*/ final Context context = toView.getContext(); final Bundle bundle; if (fragment == null) { if (supportFragment.getArguments() == null) { throw new IllegalStateException("you should call FragmentTransitionLauncher.prepare() at first "); } bundle = supportFragment.getArguments().getBundle(TRANSITION_BUNDLE); } else { if (fragment.getArguments() == null) { throw new IllegalStateException("you should call FragmentTransitionLauncher.prepare() at first "); } bundle = fragment.getArguments().getBundle(TRANSITION_BUNDLE); } final MoveData moveData = TransitionAnimation.startAnimation(context, toView, bundle, savedInstanceState, duration, interpolator, listener); if (fragment == null) { return new ExitFragmentTransition(supportFragment, moveData); } return new ExitFragmentTransition(fragment, moveData); }
From source file:net.nym.napply.library.behavior.BottomScrollShowHideBehavior.java
private void show(final View child) { if (child == null) { return;//www . j a va 2 s .c o m } final float translationY = child.getTranslationY(); //hide -> show if (translationY <= 0 || isAnimate) { return; } ViewPropertyAnimatorCompat animator = ViewCompat.animate(child); animator.translationY(0).setDuration(500).setInterpolator(new DecelerateInterpolator()) .setListener(new ViewPropertyAnimatorListener() { @Override public void onAnimationStart(View view) { child.setVisibility(View.VISIBLE); isAnimate = true; } @Override public void onAnimationEnd(View view) { isAnimate = false; } @Override public void onAnimationCancel(View view) { hide(child); } }).start(); }