List of usage examples for android.animation ObjectAnimator setDuration
@Override @NonNull public ObjectAnimator setDuration(long duration)
From source file:com.phonemetra.turbo.launcher.Folder.java
public void animateOpen() { positionAndSizeAsIcon();//from w ww. j a v a 2s. c o m if (!(getParent() instanceof DragLayer)) return; centerAboutIcon(); PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 1); PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 1.0f); PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 1.0f); final ObjectAnimator oa = LauncherAnimUtils.ofPropertyValuesHolder(this, alpha, scaleX, scaleY); oa.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { sendCustomAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED, String.format(getContext().getString(R.string.folder_opened), mContent.getCountX(), mContent.getCountY())); mState = STATE_ANIMATING; } @Override public void onAnimationEnd(Animator animation) { mState = STATE_OPEN; setLayerType(LAYER_TYPE_NONE, null); setFocusOnFirstChild(); } }); oa.setDuration(mExpandDuration); setLayerType(LAYER_TYPE_HARDWARE, null); oa.start(); // Make sure the folder picks up the last drag move even if the finger doesn't move. if (mDragController.isDragging()) { mDragController.forceTouchMove(); } }
From source file:com.android.launcher3.folder.Folder.java
public void animateClosed() { if (!(getParent() instanceof DragLayer)) return;// w w w .ja v a 2s . c om final ObjectAnimator oa = LauncherAnimUtils.ofViewAlphaAndScale(this, 0, 0.9f, 0.9f); oa.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { setLayerType(LAYER_TYPE_NONE, null); close(true); } @Override public void onAnimationStart(Animator animation) { Utilities.sendCustomAccessibilityEvent(Folder.this, AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED, getContext().getString(R.string.folder_closed)); mState = STATE_ANIMATING; } }); oa.setDuration(mExpandDuration); setLayerType(LAYER_TYPE_HARDWARE, null); oa.start(); }
From source file:com.bartoszlipinski.viewpropertyobjectanimator.ViewPropertyObjectAnimator.java
@SuppressLint("NewApi") public ObjectAnimator get() { if (hasView()) { Collection<PropertyValuesHolder> holders = mPropertyHoldersMap.values(); ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(mView.get(), holders.toArray(new PropertyValuesHolder[holders.size()])); if (mWithLayer) { animator.addListener(new AnimatorListenerAdapter() { int mCurrentLayerType = View.LAYER_TYPE_NONE; @Override/*ww w . j ava2s.c o m*/ public void onAnimationStart(Animator animation) { if (hasView()) { View view = mView.get(); mCurrentLayerType = view.getLayerType(); view.setLayerType(View.LAYER_TYPE_HARDWARE, null); if (ViewCompat.isAttachedToWindow(view)) { view.buildLayer(); } } } @Override public void onAnimationEnd(Animator animation) { if (hasView()) { mView.get().setLayerType(mCurrentLayerType, null); } } }); } if (mStartDelay != -1) { animator.setStartDelay(mStartDelay); } if (mDuration != -1) { animator.setDuration(mDuration); } if (mInterpolator != null) { animator.setInterpolator(mInterpolator); } for (Animator.AnimatorListener listener : mListeners) { animator.addListener(listener); } if (mMarginListener != null) { animator.addUpdateListener(mMarginListener); } if (mDimensionListener != null) { animator.addUpdateListener(mDimensionListener); } if (mPaddingListener != null) { animator.addUpdateListener(mPaddingListener); } if (mScrollListener != null) { animator.addUpdateListener(mScrollListener); } if (mPercentListener != null) { animator.addUpdateListener(mPercentListener); } for (ValueAnimator.AnimatorUpdateListener listener : mUpdateListeners) { animator.addUpdateListener(listener); } if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { for (Animator.AnimatorPauseListener listener : mPauseListeners) { animator.addPauseListener(listener); } } return animator; } return ObjectAnimator.ofFloat(null, View.ALPHA, 1, 1); }
From source file:cc.flydev.launcher.Folder.java
public void animateOpen() { positionAndSizeAsIcon();/* ww w.java 2 s . c o m*/ if (!(getParent() instanceof DragLayer)) return; centerAboutIcon(); PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 1); PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 1.0f); PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 1.0f); final ObjectAnimator oa = LauncherAnimUtils.ofPropertyValuesHolder(this, alpha, scaleX, scaleY); oa.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { sendCustomAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED, String.format(getContext().getString(R.string.folder_opened), mContent.getCountX(), mContent.getCountY())); mState = STATE_ANIMATING; } @Override public void onAnimationEnd(Animator animation) { mState = STATE_OPEN; setLayerType(LAYER_TYPE_NONE, null); Cling cling = mLauncher.showFirstRunFoldersCling(); if (cling != null) { cling.bringScrimToFront(); bringToFront(); cling.bringToFront(); } setFocusOnFirstChild(); } }); oa.setDuration(mExpandDuration); setLayerType(LAYER_TYPE_HARDWARE, null); oa.start(); }
From source file:com.stanleyidesis.quotograph.ui.activity.LWQSettingsActivity.java
Animator generateAnimator(View target, boolean dismiss, long startDelay) { float[] fadeIn = new float[] { 0f, 1f }; float[] fadeOut = new float[] { 1f, 0f }; final ObjectAnimator propAnimator = ObjectAnimator.ofPropertyValuesHolder(target, PropertyValuesHolder.ofFloat(View.ALPHA, dismiss ? fadeOut : fadeIn), PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, dismiss ? (target.getHeight() * 2f) : 0f)); propAnimator.setStartDelay(startDelay); propAnimator.setInterpolator(new AccelerateDecelerateInterpolator()); propAnimator.setDuration(240); return propAnimator; }
From source file:org.chromium.chrome.browser.toolbar.ToolbarPhone.java
private ObjectAnimator createExitTabSwitcherAnimation(final boolean animateNormalToolbar) { ObjectAnimator exitAnimation = ObjectAnimator.ofFloat(this, mTabSwitcherModePercentProperty, 0.f); exitAnimation.setDuration(animateNormalToolbar ? TAB_SWITCHER_MODE_EXIT_NORMAL_ANIMATION_DURATION_MS : TAB_SWITCHER_MODE_EXIT_FADE_ANIMATION_DURATION_MS); exitAnimation.setInterpolator(new LinearInterpolator()); exitAnimation.addListener(new AnimatorListenerAdapter() { @Override/* w ww . j a v a2 s . c o m*/ public void onAnimationEnd(Animator animation) { updateViewsForTabSwitcherMode(); } }); return exitAnimation; }
From source file:com.example.launcher3.Folder.java
public void animateOpen() { positionAndSizeAsIcon();//from w w w . ja v a2s .c o m if (!(getParent() instanceof DragLayer)) return; centerAboutIcon(); PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 1); PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 1.0f); PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 1.0f); final ObjectAnimator oa = LauncherAnimUtils.ofPropertyValuesHolder(this, alpha, scaleX, scaleY); oa.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { sendCustomAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED, String.format(getContext().getString(R.string.folder_opened), mContent.getCountX(), mContent.getCountY())); mState = STATE_ANIMATING; } @Override public void onAnimationEnd(Animator animation) { mState = STATE_OPEN; setLayerType(LAYER_TYPE_NONE, null); /* * Cling cling = mLauncher.showFirstRunFoldersCling(); if (cling * != null) { cling.bringScrimToFront(); bringToFront(); * cling.bringToFront(); } */ setFocusOnFirstChild(); } }); oa.setDuration(mExpandDuration); setLayerType(LAYER_TYPE_HARDWARE, null); oa.start(); }
From source file:org.chromium.chrome.browser.toolbar.ToolbarPhone.java
private ObjectAnimator createEnterTabSwitcherModeAnimation() { ObjectAnimator enterAnimation = ObjectAnimator.ofFloat(this, mTabSwitcherModePercentProperty, 1.f); enterAnimation.setDuration(TAB_SWITCHER_MODE_ENTER_ANIMATION_DURATION_MS); enterAnimation.setInterpolator(new LinearInterpolator()); enterAnimation.addListener(new AnimatorListenerAdapter() { @Override/*from www. j a v a 2 s . com*/ public void onAnimationEnd(Animator animation) { // This is to deal with the view going invisible when resuming the activity and // running this animation. The view is still there and clickable but does not // render and only a layout triggers a refresh. See crbug.com/306890. if (!mToggleTabStackButton.isEnabled()) requestLayout(); } }); return enterAnimation; }
From source file:org.chromium.chrome.browser.toolbar.ToolbarPhone.java
private ObjectAnimator createPostExitTabSwitcherAnimation() { ObjectAnimator exitAnimation = ObjectAnimator.ofFloat(this, View.TRANSLATION_Y, -getHeight(), 0.f); exitAnimation.setDuration(TAB_SWITCHER_MODE_POST_EXIT_ANIMATION_DURATION_MS); exitAnimation.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE); exitAnimation.addListener(new AnimatorListenerAdapter() { @Override/* www . j ava 2s. c o m*/ public void onAnimationStart(Animator animation) { updateViewsForTabSwitcherMode(); // On older builds, force an update to ensure the new visuals are used // when bringing in the toolbar. crbug.com/404571 if (Build.VERSION.SDK_INT == Build.VERSION_CODES.JELLY_BEAN) { requestLayout(); } } @Override public void onAnimationEnd(Animator animation) { mDelayedTabSwitcherModeAnimation = null; updateShadowVisibility(); updateViewsForTabSwitcherMode(); } }); return exitAnimation; }
From source file:com.arlib.floatingsearchview.FloatingSearchView.java
private void transitionOutLeftSection(boolean withAnim) { switch (mLeftActionMode) { case LEFT_ACTION_MODE_SHOW_HAMBURGER: closeMenuDrawable(mMenuBtnDrawable, withAnim); break;/*from w w w .j a v a2 s .c om*/ case LEFT_ACTION_MODE_SHOW_SEARCH: changeIcon(mLeftAction, mIconSearch, withAnim); break; case LEFT_ACTION_MODE_SHOW_HOME: //do nothing break; case LEFT_ACTION_MODE_NO_LEFT_ACTION: mLeftAction.setImageDrawable(mIconBackArrow); if (withAnim) { ObjectAnimator searchInputTransXAnim = ViewPropertyObjectAnimator.animate(mSearchInputParent) .translationX(-Util.dpToPx(LEFT_MENU_WIDTH_AND_MARGIN_START_DP)).get(); ObjectAnimator scaleXArrowAnim = ViewPropertyObjectAnimator.animate(mLeftAction).scaleX(0.5f).get(); ObjectAnimator scaleYArrowAnim = ViewPropertyObjectAnimator.animate(mLeftAction).scaleY(0.5f).get(); ObjectAnimator fadeArrowAnim = ViewPropertyObjectAnimator.animate(mLeftAction).alpha(0.5f).get(); scaleXArrowAnim.setDuration(300); scaleYArrowAnim.setDuration(300); fadeArrowAnim.setDuration(300); scaleXArrowAnim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { //restore normal state mLeftAction.setScaleX(1.0f); mLeftAction.setScaleY(1.0f); mLeftAction.setAlpha(1.0f); mLeftAction.setVisibility(View.INVISIBLE); } }); AnimatorSet animSet = new AnimatorSet(); animSet.setDuration(350); animSet.playTogether(scaleXArrowAnim, scaleYArrowAnim, fadeArrowAnim, searchInputTransXAnim); animSet.start(); } else { mLeftAction.setVisibility(View.INVISIBLE); } break; } }