List of usage examples for android.view.animation DecelerateInterpolator DecelerateInterpolator
public DecelerateInterpolator()
From source file:co.dift.ui.SwipeToAction.java
private void swipeLeft() { if (frontView == null) { return;//from w w w . j av a 2s . c om } final View animated = touchedView; frontView.animate().setDuration(SWIPE_ANIMATION_DURATION).setInterpolator(new DecelerateInterpolator()) .setListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { runningAnimationsOn.add(animated); } @Override public void onAnimationEnd(Animator animation) { runningAnimationsOn.remove(animated); if (swipeListener.swipeLeft(touchedViewHolder.getItemData())) { resetPosition(); } else { checkQueue(); } } @Override public void onAnimationCancel(Animator animation) { runningAnimationsOn.remove(animated); } @Override public void onAnimationRepeat(Animator animation) { runningAnimationsOn.add(animated); } }).x(frontViewX - frontViewW); }
From source file:info.bartowski.easteregg.LLand.java
private void start(boolean startPlaying) { L("start(startPlaying=%s)", startPlaying ? "true" : "false"); if (startPlaying) { mPlaying = true;//w ww .ja va 2s .c om t = 0; // there's a sucker born every OBSTACLE_PERIOD mLastPipeTime = getGameTime() - PARAMS.OBSTACLE_PERIOD; if (mSplash != null && mSplash.getAlpha() > 0f) { ViewCompat.setTranslationZ(mSplash, PARAMS.HUD_Z); ViewCompat.animate(mSplash).alpha(0).translationZ(0).setDuration(400); mScoreField.animate().translationY(0).setInterpolator(new DecelerateInterpolator()) .setDuration(1500); } mScoreField.setTextColor(0xFFAAAAAA); mScoreField.setBackground(Utility.getCompatDrawable(getContext(), R.drawable.scorecard)); mDroid.setVisibility(View.VISIBLE); mDroid.setX(mWidth / 2); mDroid.setY(mHeight / 2); } else { mDroid.setVisibility(View.GONE); } if (!mAnimating) { mAnim.start(); mAnimating = true; } }
From source file:com.github.shareme.gwsmaterialuikit.library.viewanimator.AnimationBuilder.java
public ViewAnimator descelerate() { return viewAnimator.interpolator(new DecelerateInterpolator()); }
From source file:com.github.jokar.rxupload.widget.ProgressDownloadView.java
public void drawSuccess() { mTarget = 100;/*from w w w . ja v a 2 s. c o m*/ final ObjectAnimator successAnim = ObjectAnimator.ofFloat(this, "flip", 1, -1); successAnim.setInterpolator(new OvershootInterpolator()); successAnim.setDuration(ANIMATION_DURATION_BASE); ObjectAnimator anim = ObjectAnimator.ofFloat(this, "progress", getProgress(), mTarget); anim.setInterpolator(new DecelerateInterpolator()); anim.setDuration((long) (ANIMATION_DURATION_BASE + Math.abs(mTarget * 10 - getProgress() * 10) / 2)); anim.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { mState = State.STATE_SUCCESS; successAnim.start(); } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); anim.start(); }
From source file:com.aniruddhc.acemusic.player.Drawers.QueueDrawerFragment.java
/** * Animates the pause button to a play button. *///w w w . jav a 2s. co m private void animatePauseToPlay() { //Check to make sure the current icon is the pause icon. if (mPlayPauseButton.getId() != R.drawable.pause_light) return; //Scale out the pause button. final ScaleAnimation scaleOut = new ScaleAnimation(1.0f, 0.0f, 1.0f, 0.0f, mPlayPauseButton.getWidth() / 2, mPlayPauseButton.getHeight() / 2); scaleOut.setDuration(150); scaleOut.setInterpolator(new AccelerateInterpolator()); //Scale in the play button. final ScaleAnimation scaleIn = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, mPlayPauseButton.getWidth() / 2, mPlayPauseButton.getHeight() / 2); scaleIn.setDuration(150); scaleIn.setInterpolator(new DecelerateInterpolator()); scaleOut.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { mPlayPauseButton.setImageResource(R.drawable.play_light); mPlayPauseButton.setPadding(0, 0, -5, 0); mPlayPauseButton.startAnimation(scaleIn); } @Override public void onAnimationRepeat(Animation animation) { } }); scaleIn.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { mPlayPauseButton.setScaleX(1.0f); mPlayPauseButton.setScaleY(1.0f); mPlayPauseButton.setId(R.drawable.play_light); } @Override public void onAnimationRepeat(Animation animation) { } }); mPlayPauseButton.startAnimation(scaleOut); }
From source file:org.zywx.wbpalmstar.engine.EBrowserWidget.java
public boolean exitMySpace(View view) { if (view.getParent() == this) { mBroWindow.setVisibility(VISIBLE); TranslateAnimation anim = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 1.0f); anim.setDuration(300);/*from w w w.j av a 2s . co m*/ DecelerateInterpolator di = new DecelerateInterpolator(); anim.setInterpolator(di); view.startAnimation(anim); removeView(view); return true; } return false; }
From source file:com.mahhaus.scanloto.ScannerActivity.java
private void showHighlightErrorMessageUiAnimated(String message) { lastErrorRecieved = System.currentTimeMillis(); errorMessageLayout.setVisibility(View.VISIBLE); errorMessage.setBackgroundColor(ContextCompat.getColor(this, R.color.anyline_red)); errorMessage.setAlpha(0f);// w w w.j a v a 2s .co m errorMessage.setText(message); if (errorMessageAnimator != null && errorMessageAnimator.isRunning()) { errorMessageAnimator.cancel(); } errorMessageAnimator = ObjectAnimator.ofFloat(errorMessage, "alpha", 0f, 1f); errorMessageAnimator.setDuration(getResources().getInteger(R.integer.error_message_delay)); errorMessageAnimator.setInterpolator(new DecelerateInterpolator()); errorMessageAnimator.setRepeatMode(ValueAnimator.REVERSE); errorMessageAnimator.setRepeatCount(1); errorMessageAnimator.start(); }
From source file:com.mina.breathitout.AnalyzeActivity.java
private void moveRight() { AnalyzeActivity.this.runOnUiThread(new Runnable() { @Override//from ww w. j av a2 s .c om public void run() { mViewFlipper.setInAnimation(AnimationUtils.loadAnimation(mContext, R.anim.left_in)); mViewFlipper.setOutAnimation(AnimationUtils.loadAnimation(mContext, R.anim.left_out)); // controlling animation mViewFlipper.getInAnimation().setAnimationListener(mAnimationListener); if (android.os.Build.VERSION.SDK_INT >= 11) { // will update the "progress" propriety of seekbar until it reaches progress ObjectAnimator progressAnimation = ObjectAnimator.ofInt(progressBar, "progress", lastMaxTime, 0); progressAnimation.setDuration(1000); // 0.5 second progressAnimation.setInterpolator(new DecelerateInterpolator()); progressAnimation.start(); } else progressBar.setProgress(0); // no animation on Gingerbread or lower mViewFlipper.showNext(); } }); }
From source file:com.ktouch.kdc.launcher4.camera.ui.ReviewDrawer.java
/** * Normally closes the review drawer (animation) *///www. ja v a 2 s . c o m public void close() { mIsOpen = false; animate().setDuration(DRAWER_TOGGLE_DURATION).setInterpolator(new DecelerateInterpolator()) .translationY(-getMeasuredHeight()).alpha(0.0f).setListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animator) { } @Override public void onAnimationEnd(Animator animator) { setVisibility(View.GONE); } @Override public void onAnimationCancel(Animator animator) { } @Override public void onAnimationRepeat(Animator animator) { } }).start(); }
From source file:ch.gianulli.flashcards.ui.Flashcard.java
private void expandButtonBar() { mButtonBarShowing = true;// ww w. ja v a 2 s .c o m mButtonBar.setVisibility(View.VISIBLE); mButtonBar.setAlpha(0.0f); final int startingHeight = mCardView.getHeight(); final ViewTreeObserver observer = mCardView.getViewTreeObserver(); observer.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { @Override public boolean onPreDraw() { // We don't want to continue getting called for every listview drawing. if (observer.isAlive()) { observer.removeOnPreDrawListener(this); } final int endingHeight = mCardView.getHeight(); final int distance = endingHeight - startingHeight; mCardView.getLayoutParams().height = startingHeight; mCardView.requestLayout(); ValueAnimator heightAnimator = ValueAnimator.ofFloat(0f, 1f).setDuration(300); heightAnimator.setInterpolator(new DecelerateInterpolator()); heightAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animator) { Float value = (Float) animator.getAnimatedValue(); mCardView.getLayoutParams().height = (int) (value * distance + startingHeight); mCardView.requestLayout(); } }); heightAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mCardView.getLayoutParams().height = ViewGroup.LayoutParams.WRAP_CONTENT; } }); mButtonBar.setLayerType(View.LAYER_TYPE_HARDWARE, null); ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(mButtonBar, "alpha", 0.0f, 1.0f); alphaAnimator.setInterpolator(new DecelerateInterpolator()); alphaAnimator.setDuration(300); alphaAnimator.setStartDelay(100); AnimatorSet set = new AnimatorSet(); set.playTogether(heightAnimator, alphaAnimator); set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mButtonBar.setLayerType(View.LAYER_TYPE_SOFTWARE, null); } }); set.start(); return false; } }); }