List of usage examples for android.animation ObjectAnimator setDuration
@Override @NonNull public ObjectAnimator setDuration(long duration)
From source file:support.plus.reportit.rv.FragmentActivity.java
private void createCustomAnimation() { final FloatingActionMenu menu3 = (FloatingActionMenu) findViewById(R.id.menuShareReport); AnimatorSet set = new AnimatorSet(); ObjectAnimator scaleOutX = ObjectAnimator.ofFloat(menu3.getMenuIconView(), "scaleX", 1.0f, 0.2f); ObjectAnimator scaleOutY = ObjectAnimator.ofFloat(menu3.getMenuIconView(), "scaleY", 1.0f, 0.2f); ObjectAnimator scaleInX = ObjectAnimator.ofFloat(menu3.getMenuIconView(), "scaleX", 0.2f, 1.0f); ObjectAnimator scaleInY = ObjectAnimator.ofFloat(menu3.getMenuIconView(), "scaleY", 0.2f, 1.0f); scaleOutX.setDuration(50); scaleOutY.setDuration(50);// www . j ava 2 s .co m scaleInX.setDuration(150); scaleInY.setDuration(150); scaleInX.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { menu3.getMenuIconView().setImageResource( menu3.isOpened() ? R.drawable.ic_unarchive_white_24dp : R.drawable.ic_done_white_24dp); } }); set.play(scaleOutX).with(scaleOutY); set.play(scaleInX).with(scaleInY).after(scaleOutX); set.setInterpolator(new OvershootInterpolator(2)); menu3.setIconToggleAnimatorSet(set); }
From source file:com.serenegiant.aceparrot.BaseFragment.java
/** * 10??(View)??/*from w w w.ja v a2 s .c om*/ * @param target * @param startDelay */ @SuppressLint("NewApi") protected final void fadeOut(final View target, final long duration, final long startDelay) { // if (DEBUG) Log.v(TAG, "fadeOut,target=" + target); if (target == null) return; target.clearAnimation(); if (target.getVisibility() == View.VISIBLE) { target.setTag(R.id.anim_type, ANIM_FADE_OUT); // ?? target.setScaleX(1.0f); target.setScaleY(1.0f); target.setAlpha(1.0f); final ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(target, "alpha", 1f, 0f); objectAnimator.addListener(mAnimatorListener); if (BuildCheck.isAndroid4_3()) objectAnimator.setAutoCancel(true); // API >= 18 ??????Animator???? objectAnimator.setDuration(duration > 0 ? duration : 500); // 0.5??? objectAnimator.setStartDelay(startDelay > 0 ? startDelay : 0); // ??? objectAnimator.start(); // } }
From source file:com.serenegiant.aceparrot.BaseFragment.java
/** * 01??(View)??//from w w w.ja v a2s .co m * @param target * @param startDelay */ @SuppressLint("NewApi") protected final void zoomIn(final View target, final long duration, final long startDelay) { // if (DEBUG) Log.v(TAG, "zoomIn:target=" + target); if (target == null) return; target.clearAnimation(); target.setVisibility(View.VISIBLE); target.setTag(R.id.anim_type, ANIM_ZOOM_IN); // ??? target.setScaleX(0.0f); target.setScaleY(0.0f); target.setAlpha(1.0f); final PropertyValuesHolder scale_x = PropertyValuesHolder.ofFloat("scaleX", 0.01f, 1f); final PropertyValuesHolder scale_y = PropertyValuesHolder.ofFloat("scaleY", 0.01f, 1f); final ObjectAnimator objectAnimator = ObjectAnimator.ofPropertyValuesHolder(target, scale_x, scale_y); objectAnimator.addListener(mAnimatorListener); if (BuildCheck.isJellyBeanMR2()) objectAnimator.setAutoCancel(true); // API >= 18 ??????Animator???? objectAnimator.setDuration(duration > 0 ? duration : 500); // 0.5??? objectAnimator.setStartDelay(startDelay > 0 ? startDelay : 0); // ??? objectAnimator.start(); // }
From source file:com.serenegiant.aceparrot.BaseFragment.java
/** * 10??(View)??//from w w w. ja v a 2s .c om * @param target * @param startDelay */ @SuppressLint("NewApi") protected final void zoomOut(final View target, final long duration, final long startDelay) { // if (DEBUG) Log.v(TAG, "zoomIn:target=" + target); if (target == null) return; target.clearAnimation(); target.setVisibility(View.VISIBLE); target.setTag(R.id.anim_type, ANIM_ZOOM_OUT); // ??? target.setScaleX(1.0f); target.setScaleY(1.0f); target.setAlpha(1.0f); final PropertyValuesHolder scale_x = PropertyValuesHolder.ofFloat("scaleX", 1f, 0f); final PropertyValuesHolder scale_y = PropertyValuesHolder.ofFloat("scaleY", 1f, 0f); final ObjectAnimator objectAnimator = ObjectAnimator.ofPropertyValuesHolder(target, scale_x, scale_y); objectAnimator.addListener(mAnimatorListener); if (BuildCheck.isJellyBeanMR2()) objectAnimator.setAutoCancel(true); // API >= 18 ??????Animator???? objectAnimator.setDuration(duration > 0 ? duration : 500); // 0.5??? objectAnimator.setStartDelay(startDelay > 0 ? startDelay : 0); // ??? objectAnimator.start(); // }
From source file:com.serenegiant.aceparrot.BaseFragment.java
/** * start?stop????/*from ww w. java2 s.com*/ * @param target * @param type ??????? * @param start [0.0f-1.0f] * @param stop [0.0f-1.0f] * @param duration [] * @param startDelay [] */ @SuppressLint("NewApi") protected final void alphaAnimation(final View target, final int type, final float start, final float stop, final long duration, final long startDelay, final AnimationCallback callback) { // if (DEBUG) Log.v(TAG, "fadeOut,target=" + target); if (target == null) return; target.clearAnimation(); if (target.getVisibility() == View.VISIBLE) { target.setTag(R.id.anim_type, type); target.setTag(R.id.anim_callback, callback); target.setScaleX(1.0f); target.setScaleY(1.0f); target.setAlpha(start); final ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(target, "alpha", start, stop); objectAnimator.addListener(mAnimatorListener); if (BuildCheck.isAndroid4_3()) objectAnimator.setAutoCancel(true); // API >= 18 ??????Animator???? objectAnimator.setDuration(duration > 0 ? duration : 500); // 0.5??? objectAnimator.setStartDelay(startDelay > 0 ? startDelay : 0); // ??? objectAnimator.start(); // } }
From source file:co.ceryle.radiorealbutton.library.RadioRealButtonGroup.java
private ObjectAnimator createAnimator(View view, String property, float value, boolean hasDelay, boolean hasDuration) { ObjectAnimator animator = ObjectAnimator.ofFloat(view, property, value); animator.setInterpolator(interpolatorSelector); if (hasDuration) animator.setDuration(animateSelectorDuration); else//from w ww. jav a 2 s . c o m animator.setDuration(0); if (hasDelay) animator.setStartDelay(animateSelectorDelay); return animator; }
From source file:com.android.tv.settings.dialog.DialogFragment.java
private void fadeIn(View v) { v.setAlpha(0f);//ww w.j ava 2 s.c om ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(v, "alpha", 1f); alphaAnimator .setDuration(v.getContext().getResources().getInteger(android.R.integer.config_mediumAnimTime)); alphaAnimator.start(); }
From source file:com.waz.zclient.pages.main.participants.dialog.ParticipantsDialogFragment.java
/** * @return true if the animation was performed, * false otherwise//from w w w .ja v a 2 s . c o m */ private boolean animateBetweenMainAndDetail(boolean showGroup) { float startDetail; float endDetail; float startMain; float endMain; Interpolator interpolator; if (showGroup) { startDetail = 0; endDetail = dialogFrameLayout.getMeasuredWidth(); startMain = -dialogFrameLayout.getMeasuredHeight(); endMain = 0; interpolator = new Quart.EaseOut(); } else { startDetail = dialogFrameLayout.getMeasuredWidth(); endDetail = 0; startMain = 0; endMain = -dialogFrameLayout.getMeasuredHeight(); interpolator = new Quart.EaseOut(); } if (MathUtils.floatEqual(mainParticipantsContainer.getTranslationX(), endMain) && MathUtils.floatEqual(detailParticipantContainer.getTranslationX(), endDetail)) { return false; } ObjectAnimator slideInDetailParticipantAnimation = ObjectAnimator.ofFloat(detailParticipantContainer, View.TRANSLATION_X, startDetail, endDetail); slideInDetailParticipantAnimation .setDuration(getResources().getInteger(R.integer.framework_animation_duration_long)); slideInDetailParticipantAnimation.setInterpolator(interpolator); ObjectAnimator slideOutMainAnimation = ObjectAnimator.ofFloat(mainParticipantsContainer, View.TRANSLATION_X, startMain, endMain); slideOutMainAnimation.setDuration(getResources().getInteger(R.integer.framework_animation_duration_long)); slideOutMainAnimation.setInterpolator(interpolator); AnimatorSet participantTransition = new AnimatorSet(); participantTransition.playTogether(slideOutMainAnimation, slideInDetailParticipantAnimation); participantTransition.start(); return true; }
From source file:com.android.tv.settings.dialog.DialogFragment.java
private Animator createAlphaAnimator(View v, float fromAlpha, float toAlpha) { ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(v, "alpha", fromAlpha, toAlpha); alphaAnimator.setDuration(getResources().getInteger(android.R.integer.config_longAnimTime)); return alphaAnimator; }
From source file:com.android.tv.settings.dialog.DialogFragment.java
private Animator createTranslateAlphaAnimator(View v, float fromTranslateX, float toTranslateX, float fromAlpha, float toAlpha) { ObjectAnimator translateAnimator = ObjectAnimator.ofFloat(v, "translationX", fromTranslateX, toTranslateX); translateAnimator.setDuration(getResources().getInteger(android.R.integer.config_longAnimTime)); Animator alphaAnimator = createAlphaAnimator(v, fromAlpha, toAlpha); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.play(translateAnimator).with(alphaAnimator); return animatorSet; }