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:io.romain.passport.ui.AddCityActivity.java
private void hideLoadingSpinner() { ObjectAnimator a = ObjectAnimator.ofFloat(mLoading, View.ALPHA, 1, 0); a.addListener(new SimpleAnimatorListener() { @Override//from w ww. j a v a2s . c o m public void onAnimationEnd(Animator animation) { mLoading.setVisibility(View.GONE); } }); ObjectAnimator b = ObjectAnimator.ofFloat(mContainer, View.ALPHA, 0, 1); b.addListener(new SimpleAnimatorListener() { @Override public void onAnimationStart(Animator animation) { mContainer.setAlpha(0); mContainer.setVisibility(View.VISIBLE); mEditText.requestFocus(); mEditText.setError(getString(R.string.add_city_error)); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, 0); } }); AnimatorSet transition = new AnimatorSet(); transition.playTogether(a, b); transition.setDuration(300); transition.setInterpolator(AnimUtils.getFastOutSlowInInterpolator(this)); transition.start(); }
From source file:io.romain.passport.ui.AddCityActivity.java
private void showLoadingSpinner() { View view = getCurrentFocus(); if (view != null) { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); }//w ww. ja va 2 s .c om ObjectAnimator a = ObjectAnimator.ofFloat(mLoading, View.ALPHA, 0, 1); a.addListener(new SimpleAnimatorListener() { @Override public void onAnimationStart(Animator animation) { mLoading.setAlpha(0); mLoading.setVisibility(View.VISIBLE); } }); ObjectAnimator b = ObjectAnimator.ofFloat(mContainer, View.ALPHA, 1, 0); b.addListener(new SimpleAnimatorListener() { @Override public void onAnimationEnd(Animator animation) { mContainer.setVisibility(View.INVISIBLE); } }); AnimatorSet transition = new AnimatorSet(); transition.playTogether(a, b); transition.setDuration(300); transition.setInterpolator(AnimUtils.getFastOutSlowInInterpolator(this)); transition.start(); }
From source file:com.grepsound.activities.MainActivity.java
/** * This method animates the image fragment into the background by both * scaling and rotating the fragment's view, as well as adding a * translucent dark hover view to inform the user that it is inactive. *//* w w w . j a v a 2 s .co m*/ public void slideBack(Animator.AnimatorListener listener) { // Make sure Toolbar is visible mToolbar.setTranslationY(0); View movingFragmentView = mMainFrag.getView(); PropertyValuesHolder rotateX = PropertyValuesHolder.ofFloat("rotationX", 40f); PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 0.8f); PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 0.8f); ObjectAnimator movingFragmentAnimator = ObjectAnimator.ofPropertyValuesHolder(movingFragmentView, rotateX, scaleX, scaleY); ObjectAnimator darkHoverViewAnimator = ObjectAnimator.ofFloat(mDarkHoverView, "alpha", 0.0f, 0.5f); ObjectAnimator movingFragmentRotator = ObjectAnimator.ofFloat(movingFragmentView, "rotationX", 0); movingFragmentRotator.setStartDelay(getResources().getInteger(R.integer.half_slide_up_down_duration)); AnimatorSet s = new AnimatorSet(); s.playTogether(movingFragmentAnimator, darkHoverViewAnimator, movingFragmentRotator); s.addListener(listener); s.start(); }
From source file:com.google.android.apps.muzei.util.AnimatedMuzeiLogoFragment.java
@Override public void onViewCreated(final View view, @Nullable final Bundle savedInstanceState) { mSubtitleView = view.findViewById(R.id.logo_subtitle); mLogoView = (AnimatedMuzeiLogoView) view.findViewById(R.id.animated_logo); mLogoView.setOnStateChangeListener(new AnimatedMuzeiLogoView.OnStateChangeListener() { @Override//from www. ja v a 2 s . co m public void onStateChange(int state) { if (state == AnimatedMuzeiLogoView.STATE_FILL_STARTED) { mSubtitleView.setAlpha(0); mSubtitleView.setVisibility(View.VISIBLE); mSubtitleView.setTranslationY(-mSubtitleView.getHeight()); // Bug in older versions where set.setInterpolator didn't work AnimatorSet set = new AnimatorSet(); Interpolator interpolator = new OvershootInterpolator(); ObjectAnimator a1 = ObjectAnimator.ofFloat(mLogoView, View.TRANSLATION_Y, 0); ObjectAnimator a2 = ObjectAnimator.ofFloat(mSubtitleView, View.TRANSLATION_Y, 0); ObjectAnimator a3 = ObjectAnimator.ofFloat(mSubtitleView, View.ALPHA, 1); a1.setInterpolator(interpolator); a2.setInterpolator(interpolator); set.setDuration(500).playTogether(a1, a2, a3); set.start(); if (mOnFillStartedCallback != null) { mOnFillStartedCallback.run(); } } } }); if (savedInstanceState == null) { reset(); } }
From source file:la.marsave.fullscreentest.MainActivity.java
/** * This method animates the image fragment into the foreground by both * scaling and rotating the fragment's view, while also removing the * previously added translucent dark hover view. Upon the completion of * this animation, the image fragment regains focus since this method is * called from the onBackStackChanged method. *//*from w w w. j a v a2 s .com*/ public void slideForward() { View movingFragmentView = mInfiniteViewPager; PropertyValuesHolder rotateX = PropertyValuesHolder.ofFloat("rotationX", 40f); PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 1.0f); PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 1.0f); ObjectAnimator movingFragmentAnimator = ObjectAnimator.ofPropertyValuesHolder(movingFragmentView, rotateX, scaleX, scaleY); ObjectAnimator darkHoverViewAnimator = ObjectAnimator.ofFloat(mDarkHoverView, "alpha", 0.5f, 0.0f); ObjectAnimator movingFragmentRotator = ObjectAnimator.ofFloat(movingFragmentView, "rotationX", 0); movingFragmentRotator.setStartDelay(getResources().getInteger(R.integer.half_slide_up_down_duration)); AnimatorSet s = new AnimatorSet(); s.playTogether(movingFragmentAnimator, movingFragmentRotator, darkHoverViewAnimator); s.setStartDelay(getResources().getInteger(R.integer.slide_up_down_duration)); s.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mIsAnimating = false; } }); s.start(); }
From source file:com.waz.zclient.views.menus.ConfirmationMenu.java
public void animateToShow(boolean show) { if (show) {/*ww w . ja v a 2s. c om*/ confirmed = false; cancelled = false; // Init views and post animations to get measured height of message container backgroundView.setAlpha(0); messageContainerView.setVisibility(INVISIBLE); setVisibility(VISIBLE); messageContainerView.post(new Runnable() { @Override public void run() { ObjectAnimator showBackgroundAnimator = ObjectAnimator.ofFloat(backgroundView, View.ALPHA, 0, 1); showBackgroundAnimator.setInterpolator(new Quart.EaseOut()); showBackgroundAnimator .setDuration(getResources().getInteger(R.integer.framework_animation_duration_short)); ObjectAnimator showMessageAnimator = ObjectAnimator.ofFloat(messageContainerView, View.TRANSLATION_Y, messageContainerView.getMeasuredHeight(), 0); showMessageAnimator.setInterpolator(new Expo.EaseOut()); showMessageAnimator .setDuration(getResources().getInteger(R.integer.framework_animation_duration_medium)); showMessageAnimator.setStartDelay(getResources() .getInteger(R.integer.framework_animation__confirmation_menu__show_message_delay)); showMessageAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { messageContainerView.setVisibility(VISIBLE); } }); AnimatorSet showSet = new AnimatorSet(); showSet.playTogether(showBackgroundAnimator, showMessageAnimator); showSet.setDuration(getResources() .getInteger(R.integer.background_accent_color_transition_animation_duration)); showSet.start(); } }); } else { ObjectAnimator hideBackgroundAnimator = ObjectAnimator.ofFloat(backgroundView, View.ALPHA, 1, 0); hideBackgroundAnimator.setInterpolator(new Quart.EaseOut()); hideBackgroundAnimator .setDuration(getResources().getInteger(R.integer.framework_animation_duration_short)); hideBackgroundAnimator.setStartDelay(getResources() .getInteger(R.integer.framework_animation__confirmation_menu__hide_background_delay)); hideBackgroundAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { setVisibility(GONE); boolean checkboxIsSelected = checkBoxView.getVisibility() == VISIBLE && checkBoxView.isSelected(); if (callback != null) { callback.onHideAnimationEnd(confirmed, cancelled, checkboxIsSelected); } } }); ObjectAnimator hideMessageAnimator = ObjectAnimator.ofFloat(messageContainerView, View.TRANSLATION_Y, 0, messageContainerView.getMeasuredHeight()); hideMessageAnimator.setInterpolator(new Expo.EaseIn()); hideMessageAnimator .setDuration(getResources().getInteger(R.integer.framework_animation_duration_medium)); AnimatorSet hideSet = new AnimatorSet(); hideSet.playTogether(hideMessageAnimator, hideBackgroundAnimator); hideSet.start(); } }
From source file:com.truizlop.fabreveallayout.FABRevealLayout.java
private void startRevealAnimation() { View disappearingView = getMainView(); ObjectAnimator fabAnimator = getFABAnimator(); ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(disappearingView, "alpha", 1, 0); AnimatorSet set = new AnimatorSet(); set.play(fabAnimator).with(alphaAnimator); setupAnimationParams(set);//from www .j a v a 2 s .co m set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); fab.setVisibility(GONE); prepareForReveal(); expandCircle(); } }); set.start(); }
From source file:orbin.deskclock.timer.TimerFragment.java
/** * @param timerToRemove the timer to be removed during the animation *//*w w w . ja v a 2s.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) { 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(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 timerToRemove the timer to be removed during the animation *///from w w w. ja v a2 s . c o m 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) { DataModel.getDataModel().removeTimer(timerToRemove); Events.sendTimerEvent(com.wizardsofm.deskclock.R.string.action_delete, com.wizardsofm.deskclock.R.string.label_deskclock); } }); 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:org.deviceconnect.android.deviceplugin.linking.setting.fragment.LinkingHelpFragment.java
private void createAnimation(final View v) { float size = 12.0f * getResources().getDisplayMetrics().density; long time = 1000; List<Animator> animatorList = new ArrayList<>(); ObjectAnimator fadeIn = ObjectAnimator.ofFloat(v, "translationY", -size, 0); fadeIn.setDuration(time);//w w w . j a v a 2 s .c o m animatorList.add(fadeIn); ObjectAnimator fadeOut = ObjectAnimator.ofFloat(v, "translationY", 0, -size); fadeOut.setDuration(time); animatorList.add(fadeOut); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playSequentially(animatorList); animatorSet.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { if (!mDestroy) { animation.start(); } } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); animatorSet.start(); }