List of usage examples for android.animation AnimatorSet start
@SuppressWarnings("unchecked") @Override public void start()
Starting this AnimatorSet
will, in turn, start the animations for which it is responsible.
From source file:orbin.deskclock.timer.TimerFragment.java
/** * @param toView one of {@link #mTimersView} or {@link #mCreateTimerView} * @param timerToRemove the timer to be removed during the animation; {@code null} if no timer * should be removed/*from w w w. jav a 2s . c o m*/ */ private void animateToView(View toView, final Timer timerToRemove) { if (mCurrentView == toView) { throw new IllegalStateException("toView is already the current view"); } final boolean toTimers = toView == mTimersView; // Avoid double-taps by enabling/disabling the set of buttons active on the new view. updateFab(DISABLE_BUTTONS); final long duration = UiDataModel.getUiDataModel().getShortAnimationDuration(); final Animator rotateFrom = ObjectAnimator.ofFloat(mCurrentView, SCALE_X, 1, 0); rotateFrom.setDuration(duration); rotateFrom.setInterpolator(new DecelerateInterpolator()); rotateFrom.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (timerToRemove != null) { DataModel.getDataModel().removeTimer(timerToRemove); Events.sendTimerEvent(R.string.action_delete, R.string.label_deskclock); } mCurrentView.setScaleX(1); if (toTimers) { showTimersView(FAB_AND_BUTTONS_SHRINK_AND_EXPAND); } else { showCreateTimerView(FAB_AND_BUTTONS_SHRINK_AND_EXPAND); } } }); final Animator rotateTo = ObjectAnimator.ofFloat(toView, SCALE_X, 0, 1); rotateTo.setDuration(duration); rotateTo.setInterpolator(new AccelerateInterpolator()); final AnimatorSet animatorSet = new AnimatorSet(); animatorSet.play(rotateFrom).before(rotateTo); animatorSet.start(); }
From source file:com.waz.zclient.pages.main.conversation.SingleImageFragment.java
private void saveImageToDevice() { enableSaveImageButton(false);//from w w w .ja va 2 s . c o m if (animatingSaveBitmapLoadHandle != null) { animatingSaveBitmapLoadHandle.cancel(); } final ImageAsset image = getImage(); final ImageAsset.BitmapCallback bitmapCallback = new ImageAsset.BitmapCallback() { @Override public void onBitmapLoaded(Bitmap bitmap, boolean b) { Timber.i("Got bitmap for save animation."); if (animatingSaveBitmapLoadHandle != null) { animatingSaveBitmapLoadHandle.cancel(); animatingSaveBitmapLoadHandle = null; } animatingSaveImageView.setImageBitmap(bitmap); saveImageView.setImageDrawable(messageTouchImageView.getDrawable()); saveImageViewContainer.setVisibility(View.VISIBLE); AnimatorSet animation = getSaveImageAnimation(image); animation.start(); } @Override public void onBitmapLoadingFailed() { Timber.i("Failed loading bitmap for save animation."); if (animatingSaveBitmapLoadHandle != null) { animatingSaveBitmapLoadHandle.cancel(); animatingSaveBitmapLoadHandle = null; } image.saveImageToGallery(SingleImageFragment.this); } }; animatingSaveBitmapLoadHandle = image.getSingleBitmap( ViewUtils.getOrientationIndependentDisplayHeight(getActivity()) / 2, bitmapCallback); }
From source file:com.stasbar.knowyourself.timer.TimerFragment.java
/** * @param timerToRemove the timer to be removed during the animation *//*from w w w . j av a 2 s . com*/ private void animateTimerRemove(final Timer timerToRemove) { final long duration = UiDataModel.getUiDataModel().getShortAnimationDuration(); final Animator fadeOut = ObjectAnimator.ofFloat(mViewPager, ALPHA, 1, 0); fadeOut.setDuration(duration); fadeOut.setInterpolator(new DecelerateInterpolator()); fadeOut.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { LogUtils.d("animateTimerRemove"); DataModel.getDataModel().removeTimer(timerToRemove); } }); final Animator fadeIn = ObjectAnimator.ofFloat(mViewPager, ALPHA, 0, 1); fadeIn.setDuration(duration); fadeIn.setInterpolator(new AccelerateInterpolator()); final AnimatorSet animatorSet = new AnimatorSet(); animatorSet.play(fadeOut).before(fadeIn); animatorSet.start(); }
From source file:com.wizardsofm.deskclock.timer.TimerFragment.java
/** * @param toView one of {@link #mTimersView} or {@link #mCreateTimerView} * @param timerToRemove the timer to be removed during the animation; {@code null} if no timer * should be removed/*from w w w. j a v a 2 s . co m*/ */ private void animateToView(View toView, final Timer timerToRemove) { if (mCurrentView == toView) { throw new IllegalStateException("toView is already the current view"); } final boolean toTimers = toView == mTimersView; // Avoid double-taps by enabling/disabling the set of buttons active on the new view. updateFab(UpdateType.DISABLE_BUTTONS); final long duration = UiDataModel.getUiDataModel().getShortAnimationDuration(); final Animator rotateFrom = ObjectAnimator.ofFloat(mCurrentView, SCALE_X, 1, 0); rotateFrom.setDuration(duration); rotateFrom.setInterpolator(new DecelerateInterpolator()); rotateFrom.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (timerToRemove != null) { DataModel.getDataModel().removeTimer(timerToRemove); Events.sendTimerEvent(com.wizardsofm.deskclock.R.string.action_delete, com.wizardsofm.deskclock.R.string.label_deskclock); } mCurrentView.setScaleX(1); if (toTimers) { showTimersView(UpdateType.FAB_AND_BUTTONS_SHRINK_AND_EXPAND); } else { showCreateTimerView(UpdateType.FAB_AND_BUTTONS_SHRINK_AND_EXPAND); } } }); final Animator rotateTo = ObjectAnimator.ofFloat(toView, SCALE_X, 0, 1); rotateTo.setDuration(duration); rotateTo.setInterpolator(new AccelerateInterpolator()); final AnimatorSet animatorSet = new AnimatorSet(); animatorSet.play(rotateFrom).before(rotateTo); animatorSet.start(); }
From source file:com.android.deskclock.timer.TimerFragment.java
/** * @param timerToRemove the timer to be removed during the animation *///from ww w . ja va2s . c o m private void animateTimerRemove(final Timer timerToRemove) { final Animator fadeOut = ObjectAnimator.ofFloat(mViewPager, ALPHA, 1, 0); fadeOut.setDuration(mShortAnimationDuration); fadeOut.setInterpolator(new DecelerateInterpolator()); fadeOut.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { DataModel.getDataModel().removeTimer(timerToRemove); Events.sendTimerEvent(R.string.action_delete, R.string.label_deskclock); } }); final Animator fadeIn = ObjectAnimator.ofFloat(mViewPager, ALPHA, 0, 1); fadeIn.setDuration(mShortAnimationDuration); fadeIn.setInterpolator(new AccelerateInterpolator()); final AnimatorSet animatorSet = new AnimatorSet(); animatorSet.play(fadeOut).before(fadeIn); animatorSet.start(); }
From source file:com.truizlop.fabreveallayout.FABRevealLayout.java
private void startHideAnimation() { Animator contractAnimator = circularExpandingView.contract(); View disappearingView = getSecondaryView(); ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(disappearingView, "alpha", 1, 0); AnimatorSet set = new AnimatorSet(); set.play(contractAnimator).with(alphaAnimator); setupAnimationParams(set);/*from w w w . j a v a 2 s . c o m*/ set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); fab.setVisibility(VISIBLE); circularExpandingView.setVisibility(GONE); moveFABToOriginalLocation(); } }); set.start(); }
From source file:com.stasbar.knowyourself.timer.TimerFragment.java
/** * @param toView one of {@link #mTimersView} or {@link #mCreateTimerView} * @param timerToRemove the timer to be removed during the animation; {@code null} if no timer * should be removed *//*from ww w. j a v a 2s .c o m*/ private void animateToView(View toView, final Timer timerToRemove) { if (mCurrentView == toView) { return; } final boolean toTimers = toView == mTimersView; final long duration = UiDataModel.getUiDataModel().getShortAnimationDuration(); final Animator rotateFrom = ObjectAnimator.ofFloat(mCurrentView, SCALE_X, 1, 0); rotateFrom.setDuration(duration); rotateFrom.setInterpolator(new DecelerateInterpolator()); rotateFrom.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (timerToRemove != null) { DataModel.getDataModel().removeTimer(timerToRemove); ((MainActivity) getActivity()).stopActivity(activityItem, timerToRemove); } mCurrentView.setScaleX(1); if (toTimers) { showTimersView(); } else { showCreateTimerView(); } } }); final Animator rotateTo = ObjectAnimator.ofFloat(toView, SCALE_X, 0, 1); rotateTo.setDuration(duration); rotateTo.setInterpolator(new AccelerateInterpolator()); final AnimatorSet animatorSet = new AnimatorSet(); animatorSet.play(rotateFrom).before(rotateTo); animatorSet.start(); }
From source file:org.videolan.vlc.gui.view.FastScroller.java
private void showBubble() { AnimatorSet animatorSet = new AnimatorSet(); bubble.setPivotX(bubble.getWidth()); bubble.setPivotY(bubble.getHeight()); bubble.setVisibility(VISIBLE);//from w ww . jav a 2s . c o m Animator growerX = ObjectAnimator.ofFloat(bubble, SCALE_X, 0f, 1f).setDuration(HANDLE_ANIMATION_DURATION); Animator growerY = ObjectAnimator.ofFloat(bubble, SCALE_Y, 0f, 1f).setDuration(HANDLE_ANIMATION_DURATION); Animator alpha = ObjectAnimator.ofFloat(bubble, ALPHA, 0f, 1f).setDuration(HANDLE_ANIMATION_DURATION); animatorSet.playTogether(growerX, growerY, alpha); animatorSet.start(); }
From source file:com.artemchep.horario.ui.widgets.ContainersLayout.java
private void animateInFrameDetails() { frameDetails.setVisibility(View.VISIBLE); ViewUtils.onLaidOut(frameDetails, new Runnable() { @Override/* w ww . j a va2 s . c om*/ public void run() { ObjectAnimator alpha = ofFloat(frameDetails, View.ALPHA, 0.4f, 1f); ObjectAnimator translate = ofFloat(frameDetails, View.TRANSLATION_Y, frameDetails.getHeight() * 0.3f, 0f); AnimatorSet set = new AnimatorSet(); set.playTogether(alpha, translate); set.setDuration(ANIM_DURATION); set.setInterpolator(new LinearOutSlowInInterpolator()); set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); frameMaster.setVisibility(View.GONE); } }); set.start(); } }); }
From source file:com.android.deskclock.timer.TimerFragment.java
/** * @param toView one of {@link #mTimersView} or {@link #mCreateTimerView} * @param timerToRemove the timer to be removed during the animation; {@code null} if no timer * should be removed/*from w w w. j a v a 2 s .co m*/ */ private void animateToView(View toView, final Timer timerToRemove) { if (mCurrentView == toView) { throw new IllegalStateException("toView is already the current view"); } final boolean toTimers = toView == mTimersView; // Avoid double-taps by enabling/disabling the set of buttons active on the new view. mLeftButton.setEnabled(toTimers); mRightButton.setEnabled(toTimers); mCancelCreateButton.setEnabled(!toTimers); final Animator rotateFrom = ObjectAnimator.ofFloat(mCurrentView, SCALE_X, 1, 0); rotateFrom.setDuration(mShortAnimationDuration); rotateFrom.setInterpolator(new DecelerateInterpolator()); rotateFrom.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (timerToRemove != null) { DataModel.getDataModel().removeTimer(timerToRemove); Events.sendTimerEvent(R.string.action_delete, R.string.label_deskclock); } mCurrentView.setScaleX(1); if (toTimers) { showTimersView(); } else { showCreateTimerView(); } } }); final Animator rotateTo = ObjectAnimator.ofFloat(toView, SCALE_X, 0, 1); rotateTo.setDuration(mShortAnimationDuration); rotateTo.setInterpolator(new AccelerateInterpolator()); final float preScale = toTimers ? 0 : 1; final float postScale = toTimers ? 1 : 0; final Animator fabAnimator = getScaleAnimator(mFab, preScale, postScale); final Animator leftButtonAnimator = getScaleAnimator(mLeftButton, preScale, postScale); final Animator rightButtonAnimator = getScaleAnimator(mRightButton, preScale, postScale); final AnimatorSet buttons = new AnimatorSet(); buttons.setDuration(toTimers ? mMediumAnimationDuration : mShortAnimationDuration); buttons.play(leftButtonAnimator).with(rightButtonAnimator).with(fabAnimator); buttons.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mLeftButton.setVisibility(toTimers ? VISIBLE : INVISIBLE); mRightButton.setVisibility(toTimers ? VISIBLE : INVISIBLE); mFab.setScaleX(1); mFab.setScaleY(1); mLeftButton.setScaleX(1); mLeftButton.setScaleY(1); mRightButton.setScaleX(1); mRightButton.setScaleY(1); } }); final AnimatorSet animatorSet = new AnimatorSet(); animatorSet.play(rotateFrom).before(rotateTo).with(buttons); animatorSet.start(); }