List of usage examples for android.view.animation OvershootInterpolator OvershootInterpolator
public OvershootInterpolator(float tension)
From source file:eu.davidea.samples.flexibleadapter.animators.OvershootInLeftAnimator.java
@Override protected void animateAddImpl(final RecyclerView.ViewHolder holder, final int index) { ViewCompat.animate(holder.itemView).translationX(0).setDuration(getAddDuration()) .setListener(new DefaultAddVpaListener(holder)).setInterpolator(new OvershootInterpolator(mTension)) .start();/*from ww w .jav a2s.co m*/ }
From source file:com.github.rubensousa.stackview.animator.StackDefaultAnimator.java
@Override public void animateChange(View view, final int stackPosition) { ViewCompat.animate(view)//w w w . j a v a 2s .c o m .scaleX(1 - stackPosition * getStackView().getScaleXFactor() < StackView.SCALE_X_MIN ? StackView.SCALE_X_MIN : 1 - stackPosition * getStackView().getScaleXFactor()) .translationX(stackPosition * getStackView().getHorizontalSpacing()) .translationZ((getStackView().getSize() - 1 - stackPosition) * getStackView().getElevationSpacing()) .setStartDelay(stackPosition * 50).setInterpolator(new AccelerateInterpolator()) .setDuration(getAnimationDuration()).setListener(new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationEnd(View view) { super.onAnimationEnd(view); ViewCompat.animate(view).setListener(null); getAnimationListener().onChangeFinished(view, stackPosition); } }); ViewCompat.animate(view).translationY(stackPosition * getStackView().getVerticalSpacing()) .setInterpolator(new OvershootInterpolator(3f)).setDuration(getAnimationDuration()); }
From source file:com.malmstein.materialanimations.activityscenetransitionbasic.DetailActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_transition_details); // Retrieve the correct Item instance, using the ID provided in the Intent mItem = Item.getItem(getIntent().getIntExtra(EXTRA_PARAM_ID, 0)); mHeaderImageView = (ImageView) findViewById(R.id.imageview_header); mHeaderTitle = (TextView) findViewById(R.id.textview_title); mFab = (ImageButton) findViewById(R.id.button_fab); // BEGIN_INCLUDE(detail_set_view_name) /**//from www . j a va2 s. com * Set the name of the view's which will be transition to, using the static values above. * This could be done in the layout XML, but exposing it via static variables allows easy * querying from other Activities */ ViewCompat.setTransitionName(mHeaderImageView, VIEW_NAME_HEADER_IMAGE); ViewCompat.setTransitionName(mHeaderTitle, VIEW_NAME_HEADER_TITLE); // END_INCLUDE(detail_set_view_name) mFab.setTranslationY(2 * getResources().getDimensionPixelOffset(R.dimen.btn_fab_size)); getWindow().getEnterTransition().addListener(new Transition.TransitionListener() { @Override public void onTransitionStart(Transition transition) { } @Override public void onTransitionEnd(Transition transition) { mFab.animate().translationY(0).setInterpolator(new OvershootInterpolator(1.f)).setStartDelay(300) .setDuration(400).start(); } @Override public void onTransitionCancel(Transition transition) { } @Override public void onTransitionPause(Transition transition) { } @Override public void onTransitionResume(Transition transition) { } }); loadItem(); }
From source file:com.malmstein.materialanimations.activityscenetransitionbasic.DetailActivity.java
@Override public void onBackPressed() { mFab.animate().translationYBy(2 * getResources().getDimensionPixelOffset(R.dimen.btn_fab_size)) .setInterpolator(new OvershootInterpolator(1.f)).setDuration(400).withEndAction(new Runnable() { @Override// w w w . j a v a2s. c om public void run() { finishAfterTransition(); } }); }
From source file:com.savvasdalkitsis.betwixt.Interpolators.java
/** * <strong>ANDROID INTERPOLATOR</strong><br/><br/> * An interpolator where the change flings forward and overshoots the last value then comes back. * @param tension Amount of overshoot. When tension equals 0.0f, there is no overshoot and the * interpolator becomes a simple deceleration interpolator. *//*from w w w. j a va2s .c o m*/ @NonNull public static Interpolator overshoot(int tension) { return new OvershootInterpolator(tension); }
From source file:link.fls.swipestack.SwipeHelper.java
private void resetViewPosition() { mObservedView.animate().x(mInitialX).y(mInitialY).rotation(0).alpha(1).setDuration(mAnimationDuration) .setInterpolator(new OvershootInterpolator(1.4f)).setListener(null); }
From source file:nl.hnogames.domoticz.app.DomoticzRecyclerFragment.java
public void setGridViewLayout() { try {//from w w w .java 2 s .com boolean isTablet = false; float screenWidth = 0; boolean isPortrait = false; if (getActivity().getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) isPortrait = true; if (getActivity() instanceof MainActivity) { isTablet = !((MainActivity) getActivity()).onPhone; } gridView.setHasFixedSize(true); if (isTablet) { if (isPortrait) { GridLayoutManager mLayoutManager = new GridLayoutManager(getActivity(), 1); gridView.setLayoutManager(mLayoutManager); } else { GridLayoutManager mLayoutManager = new GridLayoutManager(getActivity(), 2); gridView.setLayoutManager(mLayoutManager); } } else { GridLayoutManager mLayoutManager = new GridLayoutManager(getActivity(), 1); gridView.setLayoutManager(mLayoutManager); } gridView.setItemAnimator(new SlideInUpAnimator(new OvershootInterpolator(1f))); } catch (Exception ex) { } }
From source file:com.etmay.brescrollpager.ui.MyScroller.java
/** * Create a Scroller with the specified interpolator. If the interpolator is * null, the default (viscous) interpolator will be used. Specify whether or * not to support progressive "flywheel" behavior in flinging. *//* w w w. jav a 2s . c o m*/ public MyScroller(Context context, Interpolator interpolator, boolean flywheel) { mFinished = true; if (interpolator == null) { // mInterpolator = new LinearOutSlowInInterpolator(); mInterpolator = new OvershootInterpolator(1.1f); } else { // mInterpolator = interpolator; mInterpolator = new LinearOutSlowInInterpolator(); // mInterpolator = new DecelerateInterpolator(); } mPpi = context.getResources().getDisplayMetrics().density * 160.0f; mDeceleration = computeDeceleration(ViewConfiguration.getScrollFriction()); mFlywheel = flywheel; mPhysicalCoeff = computeDeceleration(0.84f); // look and feel tuning }
From source file:nl.hnogames.domoticz.app.DomoticzDashboardFragment.java
public void setGridViewLayout() { try {// w w w . j ava 2 s. c o m boolean isTablet = false; float screenWidth = 0; boolean isPortrait = false; if (getActivity().getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) isPortrait = true; if (getActivity() instanceof MainActivity) { isTablet = !((MainActivity) getActivity()).onPhone; } gridView.setHasFixedSize(true); if (!mSharedPrefs.showDashboardAsList()) { if (isTablet) { if (isPortrait) { GridLayoutManager mLayoutManager = new GridLayoutManager(getActivity(), 1); gridView.setLayoutManager(mLayoutManager); } else { GridLayoutManager mLayoutManager = new GridLayoutManager(getActivity(), 2); gridView.setLayoutManager(mLayoutManager); } } else { GridLayoutManager mLayoutManager = new GridLayoutManager(getActivity(), 1); gridView.setLayoutManager(mLayoutManager); } } else { if (isTablet) { if (isPortrait) { StaggeredGridLayoutManager mLayoutManager = new StaggeredGridLayoutManager(3, StaggeredGridLayoutManager.VERTICAL); gridView.setLayoutManager(mLayoutManager); } else { StaggeredGridLayoutManager mLayoutManager = new StaggeredGridLayoutManager(4, StaggeredGridLayoutManager.VERTICAL); gridView.setLayoutManager(mLayoutManager); } } else { if (isPortrait) { StaggeredGridLayoutManager mLayoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL); gridView.setLayoutManager(mLayoutManager); } else { StaggeredGridLayoutManager mLayoutManager = new StaggeredGridLayoutManager(3, StaggeredGridLayoutManager.VERTICAL); gridView.setLayoutManager(mLayoutManager); } } } gridView.setItemAnimator(new SlideInUpAnimator(new OvershootInterpolator(1f))); } catch (Exception ignored) { } }
From source file:com.viewpagerindicator.TabMovablePageIndicator.java
private void animateScrollWithIndicator(TabView tabView) { int scrollPos = tabView.getLeft() - (getWidth() - tabView.getWidth()) / 2; AnimatorSet as = new AnimatorSet(); as.setDuration(300);//w ww .ja v a 2s. c o m ArrayList<Animator> animations = new ArrayList<Animator>(); // scroll ObjectAnimator animScrollX = ObjectAnimator.ofInt(TabMovablePageIndicator.this, "scrollX", scrollPos); animScrollX.setInterpolator(new AccelerateDecelerateInterpolator()); animations.add(animScrollX); // indicator position int left = tabView.getLeft(); // int width = tabView.getWidth(); int textWidth = tabView.wordWidth; // int x = left + (width - textWidth) / 2 - mExtendWidth * 2; // x = x < 0 ? 0 : x; ObjectAnimator translateXAnim = ObjectAnimator.ofFloat(mIndicator, "translationX", left); translateXAnim.setInterpolator(new OvershootInterpolator(0.8f)); animations.add(translateXAnim); // indicator width ValueAnimator animWidth = ValueAnimator.ofInt(mIndicator.getLayoutParams().width, textWidth + mExtendWidth * 2); animWidth.addUpdateListener(new AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mIndicator.getLayoutParams(); lp.width = (Integer) animation.getAnimatedValue(); mIndicator.setLayoutParams(lp); requestLayout(); } }); animations.add(animWidth); as.playTogether(animations); as.start(); }