List of usage examples for android.view.animation AccelerateDecelerateInterpolator AccelerateDecelerateInterpolator
public AccelerateDecelerateInterpolator()
From source file:com.fastbootmobile.encore.app.fragments.MaterialReelBaseFragment.java
protected void hideMaterialReelBar(final FloatingActionButton playFab) { if (!mMaterialBarVisible) { return;// ww w . jav a 2 s .co m } mMaterialBarVisible = false; mHandler.post(new Runnable() { @Override public void run() { final int DP = getResources().getDimensionPixelSize(R.dimen.one_dp); Utils.animateHeadingHiding(mBarLayout, mBarLayout.getMeasuredWidth() / 2, (int) (mBarLayout.getMeasuredHeight() / 1.25f), ArtistActivity.BACK_DELAY); mBarLayout.setAlpha(1.0f); mBarPlay.setAlpha(1f); mBarNext.setAlpha(1f); mBarNext.setTranslationX(0); mBarNext.setScaleX(1); mBarNext.setScaleY(1); mBarShuffle.setTranslationX(0); mBarShuffle.setScaleX(1); mBarShuffle.setScaleY(1); mBarPrevious.setAlpha(1f); mBarPrevious.setTranslationX(0); mBarPrevious.setScaleX(1); mBarPrevious.setScaleY(1); mBarRepeat.setTranslationX(0); mBarRepeat.setScaleX(1); mBarRepeat.setScaleY(1); mBarPlay.animate().alpha(0).setDuration(100).start(); mBarNext.animate().alpha(0).scaleX(0).scaleY(0).translationX(16 * DP).setDuration(250).start(); mBarRepeat.animate().alpha(0).scaleX(0).scaleY(0).translationX(16 * DP).setDuration(250).start(); mBarPrevious.animate().alpha(0).translationX(-16 * DP).scaleX(0).scaleY(0).setDuration(250).start(); mBarShuffle.animate().alpha(0).scaleX(0).scaleY(0).translationX(16 * DP).setDuration(250).start(); playFab.animate().setStartDelay(150).alpha(1).scaleX(1.0f).scaleY(1.0f).setDuration(150).start(); mHandler.postDelayed(new Runnable() { @Override public void run() { CircularPathAnimation anim = new CircularPathAnimation(0, mSourceDeltaX, 0, 125 * DP); anim.setDuration(400); anim.setInterpolator(new ReverseAnimator(new AccelerateDecelerateInterpolator())); anim.setFillAfter(true); playFab.startAnimation(anim); } }, 150); mHandler.postDelayed(new Runnable() { @Override public void run() { mBarLayout.setVisibility(View.GONE); } }, 500); } }); }
From source file:com.taobao.weex.dom.action.AnimationAction.java
private @Nullable Interpolator createTimeInterpolator() { String interpolator = mAnimationBean.timingFunction; if (!TextUtils.isEmpty(interpolator)) { switch (interpolator) { case WXAnimationBean.EASE_IN: return new AccelerateInterpolator(); case WXAnimationBean.EASE_OUT: return new DecelerateInterpolator(); case WXAnimationBean.EASE_IN_OUT: return new AccelerateDecelerateInterpolator(); case WXAnimationBean.LINEAR: return new LinearInterpolator(); default://from www . jav a 2 s . c o m //Parse cubic-bezier try { SingleFunctionParser<Float> parser = new SingleFunctionParser<>(mAnimationBean.timingFunction, new SingleFunctionParser.FlatMapper<Float>() { @Override public Float map(String raw) { return Float.parseFloat(raw); } }); List<Float> params = parser.parse(WXAnimationBean.CUBIC_BEZIER); if (params != null && params.size() == WXAnimationBean.NUM_CUBIC_PARAM) { return PathInterpolatorCompat.create(params.get(0), params.get(1), params.get(2), params.get(3)); } else { return null; } } catch (RuntimeException e) { return null; } } } return null; }
From source file:org.telegram.ui.ChangePhoneActivity.java
public void setPage(int page, boolean animated, Bundle params, boolean back) { if (page == 3) { doneButton.setVisibility(View.GONE); } else {//from w ww . ja va 2 s . co m if (page == 0) { checkPermissions = true; } doneButton.setVisibility(View.VISIBLE); } final SlideView outView = views[currentViewNum]; final SlideView newView = views[page]; currentViewNum = page; newView.setParams(params); actionBar.setTitle(newView.getHeaderName()); newView.onShow(); newView.setX(back ? -AndroidUtilities.displaySize.x : AndroidUtilities.displaySize.x); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.setInterpolator(new AccelerateDecelerateInterpolator()); animatorSet.setDuration(300); animatorSet.playTogether( ObjectAnimator.ofFloat(outView, "translationX", back ? AndroidUtilities.displaySize.x : -AndroidUtilities.displaySize.x), ObjectAnimator.ofFloat(newView, "translationX", 0)); animatorSet.addListener(new AnimatorListenerAdapterProxy() { @Override public void onAnimationStart(Animator animation) { newView.setVisibility(View.VISIBLE); } @Override public void onAnimationEnd(Animator animation) { outView.setVisibility(View.GONE); outView.setX(0); } }); animatorSet.start(); }
From source file:de.dreier.mytargets.shared.views.TargetViewBase.java
protected void playAnimations(List<Animator> setList) { cancelPendingAnimations();//from w w w. j av a 2 s.co m animator = new AnimatorSet(); animator.playTogether(setList); animator.setInterpolator(new AccelerateDecelerateInterpolator()); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationCancel(Animator animation) { onAnimationEnd(animation); } @Override public void onAnimationEnd(Animator animation) { animator = null; updateVirtualViews(); invalidate(); } }); animator.setDuration(300); animator.start(); }
From source file:cn.com.hgh.view.SlideSwitch.java
public void moveToDest(final boolean toRight) { ValueAnimator toDestAnim = ValueAnimator.ofInt(frontRect_left, toRight ? max_left : min_left); toDestAnim.setDuration(500);//w w w . ja va 2 s. c o m toDestAnim.setInterpolator(new AccelerateDecelerateInterpolator()); // toDestAnim.start(); toDestAnim.addUpdateListener(new AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { // frontRect_left = (Integer) animation.getAnimatedValue(); // alpha = (int) (255 * (float) frontRect_left / (float) max_left); // invalidateView(); } }); toDestAnim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (toRight) { isOpen = true; if (listener != null) listener.open(); frontRect_left_begin = max_left; } else { isOpen = false; if (listener != null) listener.close(); frontRect_left_begin = min_left; } } }); }
From source file:com.gudong.appkit.ui.fragment.AppListFragment.java
private void setupRecyclerView(View rootView) { mRecyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview); LinearLayoutManager mLayoutManager = new LinearLayoutManager(getActivity()); mRecyclerView.setLayoutManager(mLayoutManager); mRecyclerView//w ww .java 2 s . c o m .addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST)); //every item's height is fix so use this method //RecyclerView can perform several optimizations mRecyclerView.setHasFixedSize(true); mAdapter = new AppInfoListAdapter(getActivity(), Utils.isBriefMode()); mAdapter.setClickPopupMenuItem(this); mAdapter.setClickListItem(this); SlideInBottomAnimationAdapter slideInLeftAdapter = new SlideInBottomAnimationAdapter(mAdapter); slideInLeftAdapter.setDuration(300); slideInLeftAdapter.setInterpolator(new AccelerateDecelerateInterpolator()); mRecyclerView.setAdapter(slideInLeftAdapter); }
From source file:com.fastbootmobile.encore.app.fragments.RecognitionFragment.java
public void onRecognitionStartUI() { mRecognitionButton.setActive(true);// w w w . j av a 2 s .c o m if (mTvDetails.getAlpha() > 0) { // Hide the details text mTvDetails.animate().alpha(0).translationY(mTvDetails.getMeasuredHeight()).setDuration(FADE_DURATION) .setInterpolator(new AccelerateDecelerateInterpolator()).start(); } mTvStatus.setText(R.string.recognition_status_listening); hideResultCard(); }
From source file:com.example.gaurav.calculator.Calculator.java
@Override public void onTextSizeChanged(final TextView textView, float oldSize) { if (mCurrentState != CalculatorState.INPUT) { // Only animate text changes that occur from user input. return;/*from w w w . j a va2s .c o m*/ } // Calculate the values needed to perform the scale and translation animations, // maintaining the same apparent baseline for the displayed text. final float textScale = oldSize / textView.getTextSize(); final float translationX = (1.0f - textScale) * (textView.getWidth() / 2.0f - ViewCompat.getPaddingEnd(textView)); final float translationY = (1.0f - textScale) * (textView.getHeight() / 2.0f - textView.getPaddingBottom()); final AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playTogether(ObjectAnimator.ofFloat(textView, "scaleX", textScale, 1.0f), ObjectAnimator.ofFloat(textView, "scaleY", textScale, 1.0f), ObjectAnimator.ofFloat(textView, "translationX", translationX, 0.0f), ObjectAnimator.ofFloat(textView, "translationY", translationY, 0.0f)); animatorSet.setDuration(getResources().getInteger(android.R.integer.config_mediumAnimTime)); animatorSet.setInterpolator(new AccelerateDecelerateInterpolator()); animatorSet.start(); }
From source file:com.test.slidebutton.SlideButton.java
/** * max_leftmin_left(moveToboolean toRight) * @param toRight//from w w w .j a v a2s. c o m */ @Deprecated private void moveToDest(final boolean toRight) { ValueAnimator toDestAnim = ValueAnimator.ofInt(sliderCurrentLeft, toRight ? max_left : min_left); toDestAnim.setDuration(200); toDestAnim.setInterpolator(new AccelerateDecelerateInterpolator()); // toDestAnim.setInterpolator(new OvershootInterpolator()); toDestAnim.start(); toDestAnim.addUpdateListener(new AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { sliderCurrentLeft = (Integer) animation.getAnimatedValue(); alpha = (int) (255 * (float) sliderCurrentLeft / (float) max_left); if (alpha < 0) alpha = 0; if (alpha > 255) alpha = 255; caculateColor(); invalidateView(); } }); toDestAnim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (toRight) { isOpen = true; if (listener != null) { listener.open(); } sliderCurrentLeft = sliderMoveStartLeft = max_left; alpha = 255; } else { isOpen = false; if (listener != null) { listener.close(); } sliderCurrentLeft = sliderMoveStartLeft = min_left; alpha = 0; } invalidateView(); } }); }
From source file:com.sinyuk.jianyimaterial.widgets.FloatingToolbar.java
public void hide() { if (mFab == null) { throw new IllegalStateException( "FloatingActionButton not attached." + "Please, use attachFab(FloatingActionButton fab)."); }//from www . j a v a 2s . c om if (mMorphed && !mMorphing) { mMorphed = false; float x = getX(); if (mFabOriginalX > x) { x = x + (mFabOriginalX - x) / 4f; } else { x = x - (mFabOriginalX - x) / 4f; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { hideLollipopImpl(); } else { hideDefaultImpl(); } animate().x(x).setDuration(CIRCULAR_UNREVEAL_DURATION).setStartDelay(CIRCULAR_UNREVEAL_DELAY) .setInterpolator(new AccelerateDecelerateInterpolator()); if (mMenuLayout != null) { mMenuLayout.animate().alpha(0f).scaleX(0.7f).setStartDelay(CIRCULAR_UNREVEAL_DELAY) .setDuration(MENU_ANIMATION_DURATION / 2); } if (mCustomView != null) { mCustomView.animate().alpha(0f).scaleX(0.7f).setStartDelay(CIRCULAR_UNREVEAL_DELAY) .setDuration(CIRCULAR_UNREVEAL_DURATION); } } }