List of usage examples for android.view.animation AccelerateDecelerateInterpolator AccelerateDecelerateInterpolator
public AccelerateDecelerateInterpolator()
From source file:com.microsoft.mimickeralarm.ringing.AlarmRingingFragment.java
private void initializeClockAnimation(View view) { // Show a growing clock and then shrinking again repeatedly PropertyValuesHolder scaleXAnimation = PropertyValuesHolder.ofFloat(View.SCALE_X, 1f, 1.2f, 1f); PropertyValuesHolder scaleYAnimation = PropertyValuesHolder.ofFloat(View.SCALE_Y, 1f, 1.2f, 1f); mClockAnimation = ObjectAnimator.ofPropertyValuesHolder(mAlarmRingingClock, scaleXAnimation, scaleYAnimation);//from w w w . java 2 s . c o m mClockAnimation.setDuration(CLOCK_ANIMATION_DURATION); mClockAnimation.setInterpolator(new AccelerateDecelerateInterpolator()); mClockAnimation.setRepeatCount(ValueAnimator.INFINITE); mLeftArrowImage = (ImageView) view.findViewById(R.id.alarm_ringing_left_arrow); mLeftArrowImage.setBackgroundResource(R.drawable.ringing_left_arrow_animation); mRightArrowImage = (ImageView) view.findViewById(R.id.alarm_ringing_right_arrow); mRightArrowImage.setBackgroundResource(R.drawable.ringing_right_arrow_animation); mLeftArrowAnimation = (AnimationDrawable) mLeftArrowImage.getBackground(); mRightArrowAnimation = (AnimationDrawable) mRightArrowImage.getBackground(); }
From source file:com.stanleyidesis.quotograph.ui.activity.LWQActivateActivity.java
@Subscribe public void onEvent(final FirstLaunchTaskEvent firstLaunchTaskEvent) { runOnUiThread(new Runnable() { @Override//from ww w . j a v a 2 s. c o m public void run() { if (firstLaunchTaskEvent.didFail()) { if (activeSnackbar != null) { activeSnackbar.dismiss(); } activeSnackbar = build(getString(R.string.first_launch_task_failed)); activeSnackbar.setAction("Retry", new View.OnClickListener() { @Override public void onClick(View v) { progressBar.animate().alpha(1f).setDuration(150) .setInterpolator(new AccelerateDecelerateInterpolator()).start(); activeSnackbar.dismiss(); firstLaunchTask = new LWQFirstLaunchTask(); firstLaunchTask.execute(); } }); activeSnackbar.show(); progressBar.animate().alpha(0f).setDuration(150) .setInterpolator(new AccelerateDecelerateInterpolator()).start(); return; } firstLaunchTaskCompleted = true; activePageFiveView = activateButton; if (viewPager.getCurrentItem() == Pages.values().length - 1) { activateButton.setEnabled(true); activateButton.setVisibility(View.VISIBLE); activateButton.animate().alpha(1f).setDuration(150) .setInterpolator(new AccelerateDecelerateInterpolator()).start(); progressBar.setEnabled(false); progressBar.animate().alpha(0f).setDuration(100) .setInterpolator(new AccelerateDecelerateInterpolator()).start(); if (activeSnackbar != null) { new Handler().postDelayed(new Runnable() { @Override public void run() { if (activeSnackbar == null) { return; } activeSnackbar.dismiss(); activeSnackbar = null; } }, 5000); } } } }); }
From source file:com.hamzahrmalik.calculator2.Calculator.java
private void reveal(View sourceView, int colorRes, AnimatorListener listener) { final ViewGroupOverlay groupOverlay = (ViewGroupOverlay) getWindow().getDecorView().getOverlay(); final Rect displayRect = new Rect(); mDisplayView.getGlobalVisibleRect(displayRect); // Make reveal cover the display and status bar. final View revealView = new View(this); revealView.setBottom(displayRect.bottom); revealView.setLeft(displayRect.left); revealView.setRight(displayRect.right); revealView.setBackgroundColor(getResources().getColor(colorRes)); groupOverlay.add(revealView);/*from ww w .j av a2s . com*/ final int[] clearLocation = new int[2]; sourceView.getLocationInWindow(clearLocation); clearLocation[0] += sourceView.getWidth() / 2; clearLocation[1] += sourceView.getHeight() / 2; final int revealCenterX = clearLocation[0] - revealView.getLeft(); final int revealCenterY = clearLocation[1] - revealView.getTop(); final double x1_2 = Math.pow(revealView.getLeft() - revealCenterX, 2); final double x2_2 = Math.pow(revealView.getRight() - revealCenterX, 2); final double y_2 = Math.pow(revealView.getTop() - revealCenterY, 2); final float revealRadius = (float) Math.max(Math.sqrt(x1_2 + y_2), Math.sqrt(x2_2 + y_2)); final Animator alphaAnimator = ObjectAnimator.ofFloat(revealView, View.ALPHA, 0.0f); alphaAnimator.setDuration(getResources().getInteger(android.R.integer.config_mediumAnimTime)); final AnimatorSet animatorSet = new AnimatorSet(); animatorSet.setInterpolator(new AccelerateDecelerateInterpolator()); animatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animator) { groupOverlay.remove(revealView); mCurrentAnimator = null; } }); mResultEditText.setText(""); mFormulaEditText.setText(""); mCurrentAnimator = animatorSet; animatorSet.start(); }
From source file:fr.shywim.antoinedaniel.ui.fragment.SoundPagerFragment.java
@Override public void onScrollUp() { if (mFab != null) { if (mFabIsOpen) { closeFab(mFab);//from ww w .j ava 2 s. c om } if (!mFabAnimUp) { if (mFabOriginalPosition == -1) { mFabOriginalPosition = mFab.getY(); mFabHiddenPosition = mFabOriginalPosition + mActivity.getResources().getDimension(R.dimen.fab_height) + mActivity.getResources().getDimension(R.dimen.fab_margin); } mFabAnimUp = true; mFabAnimDown = false; if (mFabAnim != null) { mFabAnim.cancel(); mFab.clearAnimation(); } mFabAnim = ObjectAnimator.ofFloat(mFab, "Y", mFabOriginalPosition); mFabAnim.setInterpolator(new AccelerateDecelerateInterpolator()); mFabAnim.start(); } } }
From source file:io.github.douglasjunior.androidSimpleTooltip.SimpleTooltip.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) private synchronized void startFloatingAnimation() { final String property = mGravity == Gravity.TOP || mGravity == Gravity.BOTTOM ? "translationY" : "translationX"; final ObjectAnimator anim1 = ObjectAnimator.ofFloat(mContentLayout, property, -mAnimationPadding, mAnimationPadding);/*from w w w . j a v a 2 s . c o m*/ anim1.setDuration(mAnimationDuration); anim1.setInterpolator(new AccelerateDecelerateInterpolator()); final ObjectAnimator anim2 = ObjectAnimator.ofFloat(mContentLayout, property, mAnimationPadding, -mAnimationPadding); anim2.setDuration(mAnimationDuration); anim2.setInterpolator(new AccelerateDecelerateInterpolator()); AnimatorSet set = new AnimatorSet(); set.playSequentially(anim1, anim2); set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (isShowing()) { animation.start(); } } }); mAnimator = set; mAnimator.start(); }
From source file:net.archenemy.archenemyapp.presenter.MainActivity.java
private void animateYTranslation(final View view, final int y, int duration) { if (view.getAnimation() != null) { return;/* w w w . jav a2s . c o m*/ } AnimatorListener listener = new AnimatorListener() { @Override public void onAnimationCancel(Animator animation) { view.setTranslationY(y); } @Override public void onAnimationEnd(Animator animation) { // make sure the animation ends in the correct end position if (view == tabs) { view.setTranslationY(currentTabTranslationY); return; } if (view == tabsBackground) { view.setTranslationY(currentTabTranslationY - maxTabTranslationY); return; } view.setTranslationY(y); } @Override public void onAnimationRepeat(Animator animation) { } @Override public void onAnimationStart(Animator animation) { } }; view.animate().translationY(y).setInterpolator(new AccelerateDecelerateInterpolator()).setDuration(duration) .setListener(listener).start(); }
From source file:com.awt.supark.LayoutHandler.java
public void pullDown(final MainActivity act) { act.animInProgress = true;/*from w ww.ja va2s .c o m*/ act.CarHandler.updateLicense(act); // ****** BUTTON AND LAYOUT PULL DOWN ANIMATION // Declaring animator ValueAnimator animation = ValueAnimator.ofFloat(0f, 1f); // Sets the animation properties animation.setDuration(act.layoutPullUpDuration); animation.setInterpolator(new AccelerateDecelerateInterpolator()); animation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { float value = (float) animation.getAnimatedValue(); act.tableRowTopHalf.setLayoutParams(new TableRow.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, value)); act.btnMap.setAlpha(value); act.btnCars.setAlpha(value); act.btnStatistics.setAlpha(value); act.btnEtc.setAlpha(value); } }); animation.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { // Starts layout pull down and fade out animation act.otherContent.startAnimation(act.anim_slide_down_fade_out); act.anim_slide_down_fade_out.setFillAfter(true); // Makes layout invisible act.otherContent.setVisibility(View.GONE); } @Override public void onAnimationEnd(Animator animation) { act.contentLinear.setVisibility(View.VISIBLE); // ****** UI ELEMENTS FADE IN ANIMATION ****** // Declaring animator ValueAnimator nextAnimation = ValueAnimator.ofFloat(0.17f, 1f); // Sets the animation properties nextAnimation.setDuration(act.layoutFadeInDuration); nextAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { float value = (float) animation.getAnimatedValue(); act.contentLinear.setAlpha(value); } }); nextAnimation.start(); act.pullUp = false; act.openedLayout = 0; act.animInProgress = false; FragmentTransaction transaction = act.fragmentManager.beginTransaction(); transaction.remove(act.fragmentManager.findFragmentById(R.id.otherContent)); transaction.commit(); } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); animation.start(); }
From source file:eu.siacs.conversations.ui.ServiceBrowserFragment.java
protected void showError(final Throwable e) { getActivity().runOnUiThread(new Runnable() { @Override//from w ww . j a va2 s . c o m public void run() { mRecyclerView.animate().alpha(0.0f).setInterpolator(new AccelerateDecelerateInterpolator()) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mRecyclerView.setVisibility(View.GONE); } }).start(); mProgressView.animate().alpha(0.0f).setInterpolator(new AccelerateDecelerateInterpolator()) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mProgressView.setVisibility(View.GONE); } }).start(); mErrorView.setAlpha(0.0f); mErrorView.setVisibility(View.VISIBLE); mErrorView.animate().alpha(1.0f).setInterpolator(new AccelerateDecelerateInterpolator()).start(); } }); }
From source file:com.sinyuk.jianyimaterial.widgets.FloatingToolbar.java
private void showDefaultImpl() { int rootWidth = mRoot.getWidth(); setScaleX(0f);// w w w . j av a 2 s . co m float endFabX; if (mFabOriginalX > rootWidth / 2f) { endFabX = rootWidth / 2f + (mFabOriginalX - rootWidth / 2f) / 4f; } else { endFabX = rootWidth / 2f - (mFabOriginalX - rootWidth / 2f) / 4f; } if (mFab != null) { PropertyValuesHolder xProperty = PropertyValuesHolder.ofFloat(X, endFabX); PropertyValuesHolder yProperty = PropertyValuesHolder.ofFloat(Y, mFabOriginalY * 1.05f); PropertyValuesHolder scaleXProperty = PropertyValuesHolder.ofFloat(SCALE_X, 0); PropertyValuesHolder scaleYProperty = PropertyValuesHolder.ofFloat(SCALE_Y, 0); ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(mFab, xProperty, yProperty, scaleXProperty, scaleYProperty); animator.setDuration(FAB_MORPH_DURATION); animator.setInterpolator(new AccelerateInterpolator()); animator.start(); } ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(this, "scaleX", 1f); objectAnimator.setDuration(CIRCULAR_REVEAL_DURATION); objectAnimator.setStartDelay(CIRCULAR_REVEAL_DELAY); objectAnimator.setInterpolator(new AccelerateDecelerateInterpolator()); objectAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { super.onAnimationStart(animation); setVisibility(View.VISIBLE); mFab.setVisibility(View.INVISIBLE); } @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); mMorphing = false; } }); objectAnimator.start(); }
From source file:fr.shywim.antoinedaniel.ui.fragment.SoundPagerFragment.java
@Override public void onScrollDown() { if (mFab != null) { if (mFabIsOpen) { closeFab(mFab);/*from w ww . jav a2 s. c o m*/ } if (!mFabAnimDown) { if (mFabOriginalPosition == -1) { mFabOriginalPosition = mFab.getY(); mFabHiddenPosition = mFabOriginalPosition + mActivity.getResources().getDimension(R.dimen.fab_height) + mActivity.getResources().getDimension(R.dimen.fab_margin); } mFabAnimDown = true; mFabAnimUp = false; if (mFabAnim != null) { mFabAnim.cancel(); mFab.clearAnimation(); } mFabAnim = ObjectAnimator.ofFloat(mFab, "Y", mFabHiddenPosition); mFabAnim.setInterpolator(new AccelerateDecelerateInterpolator()); mFabAnim.start(); } } }