List of usage examples for android.animation Animator setInterpolator
public abstract void setInterpolator(TimeInterpolator value);
From source file:com.android.mail.browse.ConversationItemView.java
/** * Grow the height of the item and fade it in when bringing a conversation * back from a destructive action.//from ww w . j a v a 2 s . c o m */ public Animator createUndoAnimation() { ObjectAnimator height = createHeightAnimation(true); Animator fade = ObjectAnimator.ofFloat(this, "alpha", 0, 1.0f); fade.setDuration(sShrinkAnimationDuration); fade.setInterpolator(new DecelerateInterpolator(2.0f)); AnimatorSet transitionSet = new AnimatorSet(); transitionSet.playTogether(height, fade); transitionSet.addListener(new HardwareLayerEnabler(this)); return transitionSet; }
From source file:com.android.launcher3.folder.Folder.java
public void animateOpen() { if (!(getParent() instanceof DragLayer)) return;/*from w w w .j a v a 2s . com*/ mContent.completePendingPageChanges(); if (!mDragInProgress) { // Open on the first page. mContent.snapToPageImmediately(0); } // This is set to true in close(), but isn't reset to false until onDropCompleted(). This // leads to an inconsistent state if you drag out of the folder and drag back in without // dropping. One resulting issue is that replaceFolderWithFinalItem() can be called twice. mDeleteFolderOnDropCompleted = false; Animator openFolderAnim = null; final Runnable onCompleteRunnable; if (!Utilities.ATLEAST_LOLLIPOP) { positionAndSizeAsIcon(); centerAboutIcon(); final ObjectAnimator oa = LauncherAnimUtils.ofViewAlphaAndScale(this, 1, 1, 1); oa.setDuration(mExpandDuration); openFolderAnim = oa; setLayerType(LAYER_TYPE_HARDWARE, null); onCompleteRunnable = new Runnable() { @Override public void run() { setLayerType(LAYER_TYPE_NONE, null); } }; } else { prepareReveal(); centerAboutIcon(); AnimatorSet anim = LauncherAnimUtils.createAnimatorSet(); int width = getPaddingLeft() + getPaddingRight() + mContent.getDesiredWidth(); int height = getFolderHeight(); float transX = -0.075f * (width / 2 - getPivotX()); float transY = -0.075f * (height / 2 - getPivotY()); setTranslationX(transX); setTranslationY(transY); PropertyValuesHolder tx = PropertyValuesHolder.ofFloat(TRANSLATION_X, transX, 0); PropertyValuesHolder ty = PropertyValuesHolder.ofFloat(TRANSLATION_Y, transY, 0); Animator drift = ObjectAnimator.ofPropertyValuesHolder(this, tx, ty); drift.setDuration(mMaterialExpandDuration); drift.setStartDelay(mMaterialExpandStagger); drift.setInterpolator(new LogDecelerateInterpolator(100, 0)); int rx = (int) Math.max(Math.max(width - getPivotX(), 0), getPivotX()); int ry = (int) Math.max(Math.max(height - getPivotY(), 0), getPivotY()); float radius = (float) Math.hypot(rx, ry); Animator reveal = new CircleRevealOutlineProvider((int) getPivotX(), (int) getPivotY(), 0, radius) .createRevealAnimator(this); reveal.setDuration(mMaterialExpandDuration); reveal.setInterpolator(new LogDecelerateInterpolator(100, 0)); mContent.setAlpha(0f); Animator iconsAlpha = ObjectAnimator.ofFloat(mContent, "alpha", 0f, 1f); iconsAlpha.setDuration(mMaterialExpandDuration); iconsAlpha.setStartDelay(mMaterialExpandStagger); iconsAlpha.setInterpolator(new AccelerateInterpolator(1.5f)); mFooter.setAlpha(0f); Animator textAlpha = ObjectAnimator.ofFloat(mFooter, "alpha", 0f, 1f); textAlpha.setDuration(mMaterialExpandDuration); textAlpha.setStartDelay(mMaterialExpandStagger); textAlpha.setInterpolator(new AccelerateInterpolator(1.5f)); anim.play(drift); anim.play(iconsAlpha); anim.play(textAlpha); anim.play(reveal); openFolderAnim = anim; mContent.setLayerType(LAYER_TYPE_HARDWARE, null); mFooter.setLayerType(LAYER_TYPE_HARDWARE, null); onCompleteRunnable = new Runnable() { @Override public void run() { mContent.setLayerType(LAYER_TYPE_NONE, null); mFooter.setLayerType(LAYER_TYPE_NONE, null); mLauncher.getUserEventDispatcher().resetElapsedContainerMillis(); } }; } openFolderAnim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { Utilities.sendCustomAccessibilityEvent(Folder.this, AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED, mContent.getAccessibilityDescription()); mState = STATE_ANIMATING; } @Override public void onAnimationEnd(Animator animation) { mState = STATE_OPEN; onCompleteRunnable.run(); mContent.setFocusOnFirstChild(); } }); // Footer animation if (mContent.getPageCount() > 1 && !mInfo.hasOption(FolderInfo.FLAG_MULTI_PAGE_ANIMATION)) { int footerWidth = mContent.getDesiredWidth() - mFooter.getPaddingLeft() - mFooter.getPaddingRight(); float textWidth = mFolderName.getPaint().measureText(mFolderName.getText().toString()); float translation = (footerWidth - textWidth) / 2; mFolderName.setTranslationX(mContent.mIsRtl ? -translation : translation); mPageIndicator.prepareEntryAnimation(); // Do not update the flag if we are in drag mode. The flag will be updated, when we // actually drop the icon. final boolean updateAnimationFlag = !mDragInProgress; openFolderAnim.addListener(new AnimatorListenerAdapter() { @SuppressLint("InlinedApi") @Override public void onAnimationEnd(Animator animation) { mFolderName.animate().setDuration(FOLDER_NAME_ANIMATION_DURATION).translationX(0) .setInterpolator(Utilities.ATLEAST_LOLLIPOP ? AnimationUtils.loadInterpolator(mLauncher, android.R.interpolator.fast_out_slow_in) : new LogDecelerateInterpolator(100, 0)); mPageIndicator.playEntryAnimation(); if (updateAnimationFlag) { mInfo.setOption(FolderInfo.FLAG_MULTI_PAGE_ANIMATION, true, mLauncher); } } }); } else { mFolderName.setTranslationX(0); } mPageIndicator.stopAllAnimations(); openFolderAnim.start(); // Make sure the folder picks up the last drag move even if the finger doesn't move. if (mDragController.isDragging()) { mDragController.forceTouchMove(); } mContent.verifyVisibleHighResIcons(mContent.getNextPage()); }
From source file:com.numix.calculator.EventListener.java
private void deleteAnimation(View view) { final TextView colorLayout = (TextView) view.getRootView().findViewById(R.id.deleteColor); final LinearLayout displayView = (LinearLayout) view.getRootView().findViewById(R.id.displayLayout); final CalculatorDisplay calculatorDisplay = (CalculatorDisplay) view.getRootView() .findViewById(R.id.display); int finalRadius = Math.max(displayView.getWidth(), displayView.getHeight()); // create the animator for this view (the start radius is zero) Animator colorAnim; colorAnim = ViewAnimationUtils.createCircularReveal(colorLayout, (int) displayView.getRight(), (int) displayView.getBottom(), 0, finalRadius); final AlphaAnimation fadeAnim = new AlphaAnimation(1.0f, 0.0f); final AlphaAnimation fadeDisplay = new AlphaAnimation(1.0f, 0.0f); fadeAnim.setDuration(250);//from www . java 2 s.com fadeAnim.setInterpolator(new AccelerateInterpolator()); fadeAnim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { colorLayout.setVisibility(View.GONE); } @Override public void onAnimationRepeat(Animation animation) { } }); fadeDisplay.setDuration(250); fadeDisplay.setInterpolator(new AccelerateInterpolator()); fadeDisplay.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { mHandler.onClear(); displayView.setAlpha(1.0f); } @Override public void onAnimationRepeat(Animation animation) { } }); colorAnim.setInterpolator(new AccelerateInterpolator()); colorAnim.addListener(new android.animation.Animator.AnimatorListener() { @Override public void onAnimationStart(android.animation.Animator animation) { calculatorDisplay.startAnimation(fadeDisplay); } @Override public void onAnimationRepeat(android.animation.Animator animation) { } @Override public void onAnimationEnd(android.animation.Animator animation) { colorLayout.startAnimation(fadeAnim); } @Override public void onAnimationCancel(android.animation.Animator animation) { } }); colorLayout.setVisibility(View.VISIBLE); colorAnim.start(); }
From source file:org.numixproject.hermes.activity.ConversationActivity.java
private void hideConversationLayout() { // previously visible view // get the center for the clipping circle int cx = (conversationLayout.getLeft() + conversationLayout.getRight()) / 2; int cy = (conversationLayout.getTop() + conversationLayout.getBottom()) / 2; // get the initial radius for the clipping circle int initialRadius = conversationLayout.getWidth(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { // create the animation (the final radius is zero) Animator anim = ViewAnimationUtils.createCircularReveal(conversationLayout, cx, cy, initialRadius, 0); anim.setInterpolator(new AccelerateDecelerateInterpolator()); // make the view invisible when the animation is done anim.addListener(new AnimatorListenerAdapter() { @Override/* w w w . j ava 2s .c om*/ public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); conversationLayout.setVisibility(View.INVISIBLE); } }); // start the animation anim.start(); } else { conversationLayout.setAlpha(1.f); conversationLayout.setScaleX(1.f); conversationLayout.setScaleY(1.f); conversationLayout.animate().alpha(0.f).scaleX(0.f).scaleY(0.f).setDuration(300) .setInterpolator(new AccelerateDecelerateInterpolator()).start(); } conversationLayout.setVisibility(View.INVISIBLE); }
From source file:android.support.transition.Transition.java
/** * This is a utility method used by subclasses to handle standard parts of * setting up and running an Animator: it sets the {@link #getDuration() * duration} and the {@link #getStartDelay() startDelay}, starts the * animation, and, when the animator ends, calls {@link #end()}. * * @param animator The Animator to be run during this transition. * * @hide//from w w w . j ava 2 s .co m */ protected void animate(Animator animator) { // TODO: maybe pass auto-end as a boolean parameter? if (animator == null) { end(); } else { if (getDuration() >= 0) { animator.setDuration(getDuration()); } if (getStartDelay() >= 0) { animator.setStartDelay(getStartDelay()); } if (getInterpolator() != null) { animator.setInterpolator(getInterpolator()); } animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { end(); animation.removeListener(this); } }); animator.start(); } }
From source file:org.chromium.chrome.browser.toolbar.ToolbarPhone.java
private void populateUrlFocusingAnimatorSet(List<Animator> animators) { Animator animator = ObjectAnimator.ofFloat(this, mUrlFocusChangePercentProperty, 1f); animator.setDuration(URL_FOCUS_CHANGE_ANIMATION_DURATION_MS); animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE); animators.add(animator);/*w w w . j a va2 s . co m*/ for (int i = 0; i < mLocationBar.getChildCount(); i++) { View childView = mLocationBar.getChildAt(i); if (childView == mLocationBar.getFirstViewVisibleWhenFocused()) break; animator = ObjectAnimator.ofFloat(childView, ALPHA, 0); animator.setDuration(URL_FOCUS_CHANGE_ANIMATION_DURATION_MS); animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE); animators.add(animator); } float density = getContext().getResources().getDisplayMetrics().density; boolean isRtl = ApiCompatibilityUtils.isLayoutRtl(this); float toolbarButtonTranslationX = MathUtils.flipSignIf(URL_FOCUS_TOOLBAR_BUTTONS_TRANSLATION_X_DP, isRtl) * density; animator = ObjectAnimator.ofFloat(mMenuButtonWrapper, TRANSLATION_X, toolbarButtonTranslationX); animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); animator.setInterpolator(BakedBezierInterpolator.FADE_OUT_CURVE); animators.add(animator); animator = ObjectAnimator.ofFloat(mMenuButtonWrapper, ALPHA, 0); animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); animator.setInterpolator(BakedBezierInterpolator.FADE_OUT_CURVE); animators.add(animator); if (mToggleTabStackButton != null) { animator = ObjectAnimator.ofFloat(mToggleTabStackButton, TRANSLATION_X, toolbarButtonTranslationX); animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); animator.setInterpolator(BakedBezierInterpolator.FADE_OUT_CURVE); animators.add(animator); animator = ObjectAnimator.ofFloat(mToggleTabStackButton, ALPHA, 0); animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); animator.setInterpolator(BakedBezierInterpolator.FADE_OUT_CURVE); animators.add(animator); } }
From source file:org.chromium.chrome.browser.toolbar.ToolbarPhone.java
private void populateUrlClearFocusingAnimatorSet(List<Animator> animators) { Animator animator = ObjectAnimator.ofFloat(this, mUrlFocusChangePercentProperty, 0f); animator.setDuration(URL_FOCUS_CHANGE_ANIMATION_DURATION_MS); animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE); animators.add(animator);//ww w . j ava2 s. co m animator = ObjectAnimator.ofFloat(mMenuButtonWrapper, TRANSLATION_X, 0); animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); animator.setStartDelay(URL_CLEAR_FOCUS_MENU_DELAY_MS); animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE); animators.add(animator); animator = ObjectAnimator.ofFloat(mMenuButtonWrapper, ALPHA, 1); animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); animator.setStartDelay(URL_CLEAR_FOCUS_MENU_DELAY_MS); animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE); animators.add(animator); if (mToggleTabStackButton != null) { animator = ObjectAnimator.ofFloat(mToggleTabStackButton, TRANSLATION_X, 0); animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); animator.setStartDelay(URL_CLEAR_FOCUS_TABSTACK_DELAY_MS); animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE); animators.add(animator); animator = ObjectAnimator.ofFloat(mToggleTabStackButton, ALPHA, 1); animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); animator.setStartDelay(URL_CLEAR_FOCUS_TABSTACK_DELAY_MS); animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE); animators.add(animator); } for (int i = 0; i < mLocationBar.getChildCount(); i++) { View childView = mLocationBar.getChildAt(i); if (childView == mLocationBar.getFirstViewVisibleWhenFocused()) break; animator = ObjectAnimator.ofFloat(childView, ALPHA, 1); animator.setStartDelay(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS); animator.setDuration(URL_CLEAR_FOCUS_MENU_DELAY_MS); animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE); animators.add(animator); } if (isLocationBarShownInNTP() && mNtpSearchBoxScrollPercent == 0f) return; // The call to getLayout() can return null briefly during text changes, but as it // is only needed for RTL calculations, we proceed if the location bar is showing // LTR content. boolean isLocationBarRtl = ApiCompatibilityUtils.isLayoutRtl(mLocationBar); if (!isLocationBarRtl || mUrlBar.getLayout() != null) { int urlBarStartScrollX = 0; if (isLocationBarRtl) { urlBarStartScrollX = (int) mUrlBar.getLayout().getPrimaryHorizontal(0); urlBarStartScrollX -= mUrlBar.getWidth(); } // If the scroll position matches the current scroll position, do not trigger // this animation as it will cause visible jumps when going from cleared text // back to page URLs (despite it continually calling setScrollX with the same // number). if (mUrlBar.getScrollX() != urlBarStartScrollX) { animator = ObjectAnimator.ofInt(mUrlBar, buildUrlScrollProperty(mLocationBar, isLocationBarRtl), urlBarStartScrollX); animator.setDuration(URL_FOCUS_CHANGE_ANIMATION_DURATION_MS); animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE); animators.add(animator); } } }
From source file:android.transitions.everywhere.Transition.java
/** * This is a utility method used by subclasses to handle standard parts of * setting up and running an Animator: it sets the {@link #getDuration() * duration} and the {@link #getStartDelay() startDelay}, starts the * animation, and, when the animator ends, calls {@link #end()}. * * @param animator The Animator to be run during this transition. * @hide//from www. j a v a 2 s.c o m */ protected void animate(Animator animator) { // TODO: maybe pass auto-end as a boolean parameter? if (animator == null) { end(); } else { if (getDuration() >= 0) { animator.setDuration(getDuration()); } if (getStartDelay() >= 0) { animator.setStartDelay(getStartDelay() + animator.getStartDelay()); } if (getInterpolator() != null) { animator.setInterpolator(getInterpolator()); } animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { end(); animation.removeListener(this); } }); animator.start(); } }
From source file:org.numixproject.hermes.activity.ConversationActivity.java
private void showConversationLayout() { // get the final radius for the clipping circle int finalRadius = Math.max(roomsLayout.getWidth(), roomsLayout.getHeight()); final FrameLayout colorLayout = (FrameLayout) findViewById(R.id.colorLayout); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { // create the animator for this view (the start radius is zero) Animator colorAnim; colorAnim = ViewAnimationUtils.createCircularReveal(colorLayout, (int) roomsLayout.getLeft(), (int) roomsLayout.getTop(), 0, finalRadius); final AlphaAnimation fadeAnim = new AlphaAnimation(1.0f, 0.0f); fadeAnim.setDuration(250);// w w w. ja va2 s . c o m fadeAnim.setInterpolator(new AccelerateInterpolator()); fadeAnim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { conversationLayout.setVisibility(View.VISIBLE); } @Override public void onAnimationEnd(Animation animation) { colorLayout.setVisibility(View.GONE); invalidateOptionsMenu(); } @Override public void onAnimationRepeat(Animation animation) { } }); colorAnim.setInterpolator(new AccelerateInterpolator()); colorAnim.addListener(new android.animation.Animator.AnimatorListener() { @Override public void onAnimationStart(android.animation.Animator animation) { } @Override public void onAnimationRepeat(android.animation.Animator animation) { } @Override public void onAnimationEnd(android.animation.Animator animation) { colorLayout.startAnimation(fadeAnim); } @Override public void onAnimationCancel(android.animation.Animator animation) { } }); colorLayout.setVisibility(View.VISIBLE); colorAnim.start(); } else { conversationLayout.setVisibility(View.VISIBLE); conversationLayout.setAlpha(0.f); conversationLayout.setScaleX(0.f); conversationLayout.setScaleY(0.f); conversationLayout.animate().alpha(1.f).scaleX(1.f).scaleY(1.f).setDuration(300).start(); } }
From source file:com.android.leanlauncher.Workspace.java
Animator getChangeStateAnimation(final State state, boolean animated, int delay, ArrayList<View> layerViews) { if (mState == state) { return null; }/*from ww w. j a va 2 s .co m*/ AnimatorSet anim = animated ? LauncherAnimUtils.createAnimatorSet() : null; // We only want a single instance of a workspace animation to be running at once, so // we cancel any incomplete transition. if (mStateAnimator != null) { mStateAnimator.cancel(); } mStateAnimator = anim; final State oldState = mState; final boolean oldStateIsNormal = (oldState == State.NORMAL); final boolean oldStateIsOverview = (oldState == State.OVERVIEW); setState(state); final boolean stateIsNormal = (state == State.NORMAL); final boolean stateIsSpringLoaded = (state == State.SPRING_LOADED); final boolean stateIsNormalHidden = (state == State.NORMAL_HIDDEN); final boolean stateIsOverviewHidden = (state == State.OVERVIEW_HIDDEN); final boolean stateIsOverview = (state == State.OVERVIEW); float finalBackgroundAlpha = (stateIsSpringLoaded || stateIsOverview) ? 1.0f : 0f; float finalOverviewPanelAlpha = stateIsOverview ? 1f : 0f; float finalWorkspaceTranslationY = stateIsOverview || stateIsOverviewHidden ? getOverviewModeTranslationY() : 0; boolean workspaceToAllApps = (oldStateIsNormal && stateIsNormalHidden); boolean overviewToAllApps = (oldStateIsOverview && stateIsOverviewHidden); boolean allAppsToWorkspace = (stateIsNormalHidden && stateIsNormal); boolean workspaceToOverview = (oldStateIsNormal && stateIsOverview); boolean overviewToWorkspace = (oldStateIsOverview && stateIsNormal); mNewScale = 1.0f; if (state != State.NORMAL) { if (stateIsSpringLoaded) { mNewScale = mSpringLoadedShrinkFactor; } else if (stateIsOverview || stateIsOverviewHidden) { mNewScale = mOverviewModeShrinkFactor; } } final int duration; if (workspaceToAllApps || overviewToAllApps) { duration = HIDE_WORKSPACE_DURATION; //getResources().getInteger(R.integer.config_workspaceUnshrinkTime); } else if (workspaceToOverview || overviewToWorkspace) { duration = getResources().getInteger(R.integer.config_overviewTransitionTime); } else { duration = getResources().getInteger(R.integer.config_appsCustomizeWorkspaceShrinkTime); } final CellLayout cl = mWorkspace; float initialAlpha = cl.getShortcutsAndWidgets().getAlpha(); float finalAlpha; if (stateIsNormalHidden || stateIsOverviewHidden) { finalAlpha = 0f; } else { finalAlpha = 1f; } // If we are animating to/from the small state, then hide the side pages and fade the // current page in if (!mIsSwitchingState) { if (workspaceToAllApps || allAppsToWorkspace) { if (allAppsToWorkspace) { initialAlpha = 0f; } cl.setShortcutAndWidgetAlpha(initialAlpha); } } float oldAlpha = initialAlpha; float newAlpha = finalAlpha; if (animated) { mOldBackgroundAlpha = cl.getBackgroundAlpha(); mNewBackgroundAlpha = finalBackgroundAlpha; } else { cl.setBackgroundAlpha(finalBackgroundAlpha); cl.setShortcutAndWidgetAlpha(finalAlpha); } final View overviewPanel = mLauncher.getOverviewPanel(); if (animated) { LauncherViewPropertyAnimator scale = new LauncherViewPropertyAnimator(this); scale.scaleX(mNewScale).scaleY(mNewScale).translationY(finalWorkspaceTranslationY).setDuration(duration) .setInterpolator(mZoomInInterpolator); anim.play(scale); float currentAlpha = cl.getShortcutsAndWidgets().getAlpha(); if (oldAlpha == 0 && newAlpha == 0) { cl.setBackgroundAlpha(mNewBackgroundAlpha); cl.setShortcutAndWidgetAlpha(newAlpha); } else { if (layerViews != null) { layerViews.add(cl); } if (oldAlpha != newAlpha || currentAlpha != newAlpha) { LauncherViewPropertyAnimator alphaAnim = new LauncherViewPropertyAnimator( cl.getShortcutsAndWidgets()); alphaAnim.alpha(newAlpha).setDuration(duration).setInterpolator(mZoomInInterpolator); anim.play(alphaAnim); } if (mOldBackgroundAlpha != 0 || mNewBackgroundAlpha != 0) { ValueAnimator bgAnim = LauncherAnimUtils.ofFloat(cl, 0f, 1f); bgAnim.setInterpolator(mZoomInInterpolator); bgAnim.setDuration(duration); bgAnim.addUpdateListener(new LauncherAnimatorUpdateListener() { public void onAnimationUpdate(float a, float b) { cl.setBackgroundAlpha(a * mOldBackgroundAlpha + b * mNewBackgroundAlpha); } }); anim.play(bgAnim); } } Animator overviewPanelAlpha = new LauncherViewPropertyAnimator(overviewPanel) .alpha(finalOverviewPanelAlpha).withLayer(); overviewPanelAlpha.addListener(new AlphaUpdateListener(overviewPanel)); // For animation optimations, we may need to provide the Launcher transition // with a set of views on which to force build layers in certain scenarios. overviewPanel.setLayerType(View.LAYER_TYPE_HARDWARE, null); if (layerViews != null) { layerViews.add(overviewPanel); } if (workspaceToOverview) { overviewPanelAlpha.setInterpolator(null); } else if (overviewToWorkspace) { overviewPanelAlpha.setInterpolator(new DecelerateInterpolator(2)); } overviewPanelAlpha.setDuration(duration); anim.play(overviewPanelAlpha); anim.setStartDelay(delay); anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mStateAnimator = null; } }); } else { overviewPanel.setAlpha(finalOverviewPanelAlpha); AlphaUpdateListener.updateVisibility(overviewPanel); setScaleX(mNewScale); setScaleY(mNewScale); setTranslationY(finalWorkspaceTranslationY); } if (stateIsNormal) { animateBackgroundGradient(0f, animated); } else { animateBackgroundGradient(getResources().getInteger(R.integer.config_workspaceScrimAlpha) / 100f, animated); } return anim; }