List of usage examples for android.animation AnimatorSet setStartDelay
@Override public void setStartDelay(long startDelay)
From source file:com.apptentive.android.sdk.module.messagecenter.view.MessageCenterActivityContent.java
private void deleteItemWithAnimation(final View v, final Animator.AnimatorListener al, final ValueAnimator.AnimatorUpdateListener vl, long delay) { if (v == null) { return;/*from w w w .jav a2 s . c o m*/ } AnimatorSet animatorSet = AnimationUtil.buildListViewRowRemoveAnimator(v, al, vl); animatorSet.setStartDelay(delay); animatorSet.start(); }
From source file:com.dk.animation.effect.out.HingeOut.java
@Override public void startAnimation(final ViewHolder holder, long duration, final BaseItemAnimator animator) { ViewCompat.animate(holder.itemView).cancel(); AnimatorSet set = new AnimatorSet(); View target = holder.itemView; int abs = Math.random() > 0.5 ? -1 : 1; float x, y;/*from w w w . j a v a2s . c om*/ if (abs > 0) { x = target.getPaddingLeft(); y = target.getPaddingTop(); } else { x = target.getWidth(); y = target.getPaddingTop(); } set.setDuration(animator.getRemoveDuration()); set.addListener(new AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { animator.dispatchAddFinished(holder); animator.mAddAnimations.remove(holder); animator.dispatchFinishedWhenDone(); } @Override public void onAnimationCancel(Animator animation) { } }); set.playTogether( ObjectAnimator.ofFloat(target, "rotation", 0, abs * 80, abs * 60, abs * 80, abs * 60, abs * 60), ObjectAnimator.ofFloat(target, "translationY", 0, 0, 0, 0, 0, 700), ObjectAnimator.ofFloat(target, "alpha", 1, 1, 1, 1, 1, 0), ObjectAnimator.ofFloat(target, "pivotX", x, x, x, x, x, x), ObjectAnimator.ofFloat(target, "pivotY", y, y, y, y, y, y)); set.setStartDelay(mDelay * mDelayCount); set.setDuration(animator.getAddDuration()); set.start(); animator.mAddAnimations.add(holder); }
From source file:org.telegram.ui.Components.ChatAttachAlert.java
@SuppressLint("NewApi") private void startRevealAnimation(final boolean open) { containerView.setTranslationY(0);//from w w w . j av a 2 s . c o m final AnimatorSet animatorSet = new AnimatorSet(); View view = delegate.getRevealView(); if (view.getVisibility() == View.VISIBLE && ((ViewGroup) view.getParent()).getVisibility() == View.VISIBLE) { final int coords[] = new int[2]; view.getLocationInWindow(coords); float top; if (Build.VERSION.SDK_INT <= 19) { top = AndroidUtilities.displaySize.y - containerView.getMeasuredHeight() - AndroidUtilities.statusBarHeight; } else { top = containerView.getY(); } revealX = coords[0] + view.getMeasuredWidth() / 2; revealY = (int) (coords[1] + view.getMeasuredHeight() / 2 - top); if (Build.VERSION.SDK_INT <= 19) { revealY -= AndroidUtilities.statusBarHeight; } } else { revealX = AndroidUtilities.displaySize.x / 2 + backgroundPaddingLeft; revealY = (int) (AndroidUtilities.displaySize.y - containerView.getY()); } int corners[][] = new int[][] { { 0, 0 }, { 0, AndroidUtilities.dp(304) }, { containerView.getMeasuredWidth(), 0 }, { containerView.getMeasuredWidth(), AndroidUtilities.dp(304) } }; int finalRevealRadius = 0; int y = revealY - scrollOffsetY + backgroundPaddingTop; for (int a = 0; a < 4; a++) { finalRevealRadius = Math.max(finalRevealRadius, (int) Math.ceil(Math.sqrt((revealX - corners[a][0]) * (revealX - corners[a][0]) + (y - corners[a][1]) * (y - corners[a][1])))); } int finalRevealX = revealX <= containerView.getMeasuredWidth() ? revealX : containerView.getMeasuredWidth(); ArrayList<Animator> animators = new ArrayList<>(3); animators.add(ObjectAnimator.ofFloat(this, "revealRadius", open ? 0 : finalRevealRadius, open ? finalRevealRadius : 0)); animators.add(ObjectAnimator.ofInt(backDrawable, "alpha", open ? 51 : 0)); if (Build.VERSION.SDK_INT >= 21) { try { animators.add(ViewAnimationUtils.createCircularReveal(containerView, finalRevealX, revealY, open ? 0 : finalRevealRadius, open ? finalRevealRadius : 0)); } catch (Exception e) { FileLog.e("tmessages", e); } animatorSet.setDuration(320); } else { if (!open) { animatorSet.setDuration(200); containerView.setPivotX( revealX <= containerView.getMeasuredWidth() ? revealX : containerView.getMeasuredWidth()); containerView.setPivotY(revealY); animators.add(ObjectAnimator.ofFloat(containerView, "scaleX", 0.0f)); animators.add(ObjectAnimator.ofFloat(containerView, "scaleY", 0.0f)); animators.add(ObjectAnimator.ofFloat(containerView, "alpha", 0.0f)); } else { animatorSet.setDuration(250); containerView.setScaleX(1); containerView.setScaleY(1); containerView.setAlpha(1); if (Build.VERSION.SDK_INT <= 19) { animatorSet.setStartDelay(20); } } } animatorSet.playTogether(animators); animatorSet.addListener(new AnimatorListenerAdapter() { public void onAnimationEnd(Animator animation) { if (currentSheetAnimation != null && currentSheetAnimation.equals(animation)) { currentSheetAnimation = null; onRevealAnimationEnd(open); containerView.invalidate(); containerView.setLayerType(View.LAYER_TYPE_NONE, null); if (!open) { try { dismissInternal(); } catch (Exception e) { FileLog.e("tmessages", e); } } } } @Override public void onAnimationCancel(Animator animation) { if (currentSheetAnimation != null && animatorSet.equals(animation)) { currentSheetAnimation = null; } } }); if (open) { innerAnimators.clear(); NotificationCenter.getInstance() .setAllowedNotificationsDutingAnimation(new int[] { NotificationCenter.dialogsNeedReload }); NotificationCenter.getInstance().setAnimationInProgress(true); revealAnimationInProgress = true; int count = Build.VERSION.SDK_INT <= 19 ? 11 : 8; for (int a = 0; a < count; a++) { if (Build.VERSION.SDK_INT <= 19) { if (a < 8) { views[a].setScaleX(0.1f); views[a].setScaleY(0.1f); } views[a].setAlpha(0.0f); } else { views[a].setScaleX(0.7f); views[a].setScaleY(0.7f); } InnerAnimator innerAnimator = new InnerAnimator(); int buttonX = views[a].getLeft() + views[a].getMeasuredWidth() / 2; int buttonY = views[a].getTop() + attachView.getTop() + views[a].getMeasuredHeight() / 2; float dist = (float) Math.sqrt( (revealX - buttonX) * (revealX - buttonX) + (revealY - buttonY) * (revealY - buttonY)); float vecX = (revealX - buttonX) / dist; float vecY = (revealY - buttonY) / dist; views[a].setPivotX(views[a].getMeasuredWidth() / 2 + vecX * AndroidUtilities.dp(20)); views[a].setPivotY(views[a].getMeasuredHeight() / 2 + vecY * AndroidUtilities.dp(20)); innerAnimator.startRadius = dist - AndroidUtilities.dp(27 * 3); views[a].setTag(R.string.AppName, 1); animators = new ArrayList<>(); final AnimatorSet animatorSetInner; if (a < 8) { animators.add(ObjectAnimator.ofFloat(views[a], "scaleX", 0.7f, 1.05f)); animators.add(ObjectAnimator.ofFloat(views[a], "scaleY", 0.7f, 1.05f)); animatorSetInner = new AnimatorSet(); animatorSetInner.playTogether(ObjectAnimator.ofFloat(views[a], "scaleX", 1.0f), ObjectAnimator.ofFloat(views[a], "scaleY", 1.0f)); animatorSetInner.setDuration(100); animatorSetInner.setInterpolator(decelerateInterpolator); } else { animatorSetInner = null; } if (Build.VERSION.SDK_INT <= 19) { animators.add(ObjectAnimator.ofFloat(views[a], "alpha", 1.0f)); } innerAnimator.animatorSet = new AnimatorSet(); innerAnimator.animatorSet.playTogether(animators); innerAnimator.animatorSet.setDuration(150); innerAnimator.animatorSet.setInterpolator(decelerateInterpolator); innerAnimator.animatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (animatorSetInner != null) { animatorSetInner.start(); } } }); innerAnimators.add(innerAnimator); } } currentSheetAnimation = animatorSet; animatorSet.start(); }
From source file:org.telegram.ui.ArticleViewer.java
private void showActionBar(int delay) { AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playTogether(ObjectAnimator.ofFloat(backButton, "alpha", 1.0f), ObjectAnimator.ofFloat(shareContainer, "alpha", 1.0f)); animatorSet.setDuration(150);//from ww w. ja v a2s .c om animatorSet.setStartDelay(delay); animatorSet.start(); }
From source file:com.phonemetra.turbo.launcher.AsyncTaskCallback.java
Animator getChangeStateAnimation(final State state, boolean animated, int delay, int snapPage) { if (mState == state) { return null; }/*from ww w . j a v a 2 s .c o m*/ // Initialize animation arrays for the first time if necessary initAnimationArrays(); AnimatorSet anim = animated ? LauncherAnimUtils.createAnimatorSet() : null; 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 stateIsOverview = (state == State.OVERVIEW); float finalBackgroundAlpha = stateIsOverview ? 1.0f : 0f; float finalPageIndicatorAlpha = stateIsOverview ? 0f : 1f; float finalOverviewPanelAlpha = stateIsOverview ? 1f : 0f; float finalWorkspaceTranslationY = stateIsOverview ? getOverviewModeTranslationY() : 0; boolean workspaceToOverview = (oldStateIsNormal && stateIsOverview); boolean overviewToWorkspace = (oldStateIsOverview && stateIsNormal); mNewScale = 1.0f; if (state != State.NORMAL) { if (stateIsOverview) { mNewScale = mOverviewModeShrinkFactor; } } final int duration = getResources().getInteger(R.integer.config_overviewTransitionTime); for (int i = 0; i < getChildCount(); i++) { final CellLayout cl = (CellLayout) getChildAt(i); float finalAlpha = 1f; if (stateIsOverview) { cl.setVisibility(VISIBLE); cl.setTranslationX(0f); cl.setTranslationY(0f); cl.setPivotX(cl.getMeasuredWidth() * 0.5f); cl.setPivotY(cl.getMeasuredHeight() * 0.5f); cl.setRotation(0f); cl.setRotationY(0f); cl.setRotationX(0f); cl.setScaleX(1f); cl.setScaleY(1f); cl.setShortcutAndWidgetAlpha(1f); } mOldAlphas[i] = cl.getShortcutsAndWidgets().getAlpha(); mNewAlphas[i] = finalAlpha; if (animated) { mOldBackgroundAlphas[i] = cl.getBackgroundAlpha(); mNewBackgroundAlphas[i] = finalBackgroundAlpha; } else { cl.setBackgroundAlpha(finalBackgroundAlpha); cl.setShortcutAndWidgetAlpha(finalAlpha); } } final View overviewPanel = mLauncher.getOverviewPanel(); if (animated) { anim.setDuration(duration); LauncherViewPropertyAnimator scale = new LauncherViewPropertyAnimator(this); scale.scaleX(mNewScale).scaleY(mNewScale).translationY(finalWorkspaceTranslationY) .setInterpolator(mZoomInInterpolator); anim.play(scale); ValueAnimator invalidate = ValueAnimator.ofFloat(0f, 1f); invalidate.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { invalidate(); } }); anim.play(invalidate); ObjectAnimator pageIndicatorAlpha = null; if (getPageIndicator() != null) { pageIndicatorAlpha = ObjectAnimator.ofFloat(getPageIndicator(), "alpha", finalPageIndicatorAlpha); } ObjectAnimator overviewPanelAlpha = ObjectAnimator.ofFloat(overviewPanel, "alpha", finalOverviewPanelAlpha); overviewPanelAlpha.addListener(new AlphaUpdateListener(overviewPanel)); if (overviewToWorkspace) { overviewPanelAlpha.setInterpolator(new DecelerateInterpolator(2)); } if (getPageIndicator() != null) { pageIndicatorAlpha.addListener(new AlphaUpdateListener(getPageIndicator())); } anim.play(overviewPanelAlpha); anim.play(pageIndicatorAlpha); for (int index = 0; index < getChildCount(); index++) { final int i = index; final CellLayout cl = (CellLayout) getChildAt(i); if (mOldAlphas[i] == 0 && mNewAlphas[i] == 0) { cl.setBackgroundAlpha(mNewBackgroundAlphas[i]); cl.getShortcutsAndWidgets().setAlpha(mNewAlphas[i]); } else { LauncherViewPropertyAnimator a = new LauncherViewPropertyAnimator(cl.getShortcutsAndWidgets()); a.alpha(mNewAlphas[i]).setDuration(duration).setInterpolator(mZoomInInterpolator); anim.play(a); if (mOldBackgroundAlphas[i] != 0 || mNewBackgroundAlphas[i] != 0) { ValueAnimator bgAnim = LauncherAnimUtils.ofFloat(cl, 0f, 1f); bgAnim.setInterpolator(mZoomInInterpolator); bgAnim.addUpdateListener(new LauncherAnimatorUpdateListener() { public void onAnimationUpdate(float a, float b) { cl.setBackgroundAlpha(a * mOldBackgroundAlphas[i] + b * mNewBackgroundAlphas[i]); } }); anim.play(bgAnim); } } } anim.setStartDelay(delay); } else { overviewPanel.setAlpha(finalOverviewPanelAlpha); AlphaUpdateListener.updateVisibility(overviewPanel); if (getPageIndicator() != null) { getPageIndicator().setAlpha(finalPageIndicatorAlpha); AlphaUpdateListener.updateVisibility(getPageIndicator()); } setScaleX(mNewScale); setScaleY(mNewScale); setTranslationY(finalWorkspaceTranslationY); } return anim; }
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 w w w . j av a2 s. c o 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; }
From source file:com.android.launcher2.Workspace.java
Animator getChangeStateAnimation(final State state, boolean animated, int delay) { if (mState == state) { return null; }/*from ww w.j a v a 2 s . co m*/ // Initialize animation arrays for the first time if necessary initAnimationArrays(); AnimatorSet anim = animated ? LauncherAnimUtils.createAnimatorSet() : null; // Stop any scrolling, move to the current page right away setCurrentPage(getNextPage()); final State oldState = mState; final boolean oldStateIsNormal = (oldState == State.NORMAL); final boolean oldStateIsSpringLoaded = (oldState == State.SPRING_LOADED); final boolean oldStateIsSmall = (oldState == State.SMALL); mState = state; final boolean stateIsNormal = (state == State.NORMAL); final boolean stateIsSpringLoaded = (state == State.SPRING_LOADED); final boolean stateIsSmall = (state == State.SMALL); float finalScaleFactor = 1.0f; float finalBackgroundAlpha = stateIsSpringLoaded ? 1.0f : 0f; float translationX = 0; float translationY = 0; boolean zoomIn = true; if (state != State.NORMAL) { finalScaleFactor = mSpringLoadedShrinkFactor - (stateIsSmall ? 0.1f : 0); setPageSpacing(mSpringLoadedPageSpacing); if (oldStateIsNormal && stateIsSmall) { zoomIn = false; setLayoutScale(finalScaleFactor); updateChildrenLayersEnabled(false); } else { finalBackgroundAlpha = 1.0f; setLayoutScale(finalScaleFactor); } } else { setPageSpacing(mOriginalPageSpacing); setLayoutScale(1.0f); } final int duration = zoomIn ? getResources().getInteger(R.integer.config_workspaceUnshrinkTime) : getResources().getInteger(R.integer.config_appsCustomizeWorkspaceShrinkTime); for (int i = 0; i < getChildCount(); i++) { final CellLayout cl = (CellLayout) getChildAt(i); float finalAlpha = (!mWorkspaceFadeInAdjacentScreens || stateIsSpringLoaded || (i == mCurrentPage)) ? 1f : 0f; float currentAlpha = cl.getShortcutsAndWidgets().getAlpha(); float initialAlpha = currentAlpha; // Determine the pages alpha during the state transition if ((oldStateIsSmall && stateIsNormal) || (oldStateIsNormal && stateIsSmall)) { // To/from workspace - only show the current page unless the transition is not // animated and the animation end callback below doesn't run; // or, if we're in spring-loaded mode if (i == mCurrentPage || !animated || oldStateIsSpringLoaded) { finalAlpha = 1f; } else { initialAlpha = 0f; finalAlpha = 0f; } } mOldAlphas[i] = initialAlpha; mNewAlphas[i] = finalAlpha; if (animated) { mOldTranslationXs[i] = cl.getTranslationX(); mOldTranslationYs[i] = cl.getTranslationY(); mOldScaleXs[i] = cl.getScaleX(); mOldScaleYs[i] = cl.getScaleY(); mOldBackgroundAlphas[i] = cl.getBackgroundAlpha(); mNewTranslationXs[i] = translationX; mNewTranslationYs[i] = translationY; mNewScaleXs[i] = finalScaleFactor; mNewScaleYs[i] = finalScaleFactor; mNewBackgroundAlphas[i] = finalBackgroundAlpha; } else { cl.setTranslationX(translationX); cl.setTranslationY(translationY); cl.setScaleX(finalScaleFactor); cl.setScaleY(finalScaleFactor); cl.setBackgroundAlpha(finalBackgroundAlpha); cl.setShortcutAndWidgetAlpha(finalAlpha); } } if (animated) { for (int index = 0; index < getChildCount(); index++) { final int i = index; final CellLayout cl = (CellLayout) getChildAt(i); float currentAlpha = cl.getShortcutsAndWidgets().getAlpha(); if (mOldAlphas[i] == 0 && mNewAlphas[i] == 0) { cl.setTranslationX(mNewTranslationXs[i]); cl.setTranslationY(mNewTranslationYs[i]); cl.setScaleX(mNewScaleXs[i]); cl.setScaleY(mNewScaleYs[i]); cl.setBackgroundAlpha(mNewBackgroundAlphas[i]); cl.setShortcutAndWidgetAlpha(mNewAlphas[i]); cl.setRotationY(mNewRotationYs[i]); } else { LauncherViewPropertyAnimator a = new LauncherViewPropertyAnimator(cl); a.translationX(mNewTranslationXs[i]).translationY(mNewTranslationYs[i]).scaleX(mNewScaleXs[i]) .scaleY(mNewScaleYs[i]).setDuration(duration).setInterpolator(mZoomInInterpolator); anim.play(a); if (mOldAlphas[i] != mNewAlphas[i] || currentAlpha != mNewAlphas[i]) { LauncherViewPropertyAnimator alphaAnim = new LauncherViewPropertyAnimator( cl.getShortcutsAndWidgets()); alphaAnim.alpha(mNewAlphas[i]).setDuration(duration).setInterpolator(mZoomInInterpolator); anim.play(alphaAnim); } if (mOldBackgroundAlphas[i] != 0 || mNewBackgroundAlphas[i] != 0) { ValueAnimator bgAnim = LauncherAnimUtils.ofFloat(0f, 1f).setDuration(duration); bgAnim.setInterpolator(mZoomInInterpolator); bgAnim.addUpdateListener(new LauncherAnimatorUpdateListener() { public void onAnimationUpdate(float a, float b) { cl.setBackgroundAlpha(a * mOldBackgroundAlphas[i] + b * mNewBackgroundAlphas[i]); } }); anim.play(bgAnim); } } } buildPageHardwareLayers(); anim.setStartDelay(delay); } if (stateIsSpringLoaded) { // Right now we're covered by Apps Customize // Show the background gradient immediately, so the gradient will // be showing once AppsCustomize disappears animateBackgroundGradient( getResources().getInteger(R.integer.config_appsCustomizeSpringLoadedBgAlpha) / 100f, false); } else { // Fade the background gradient away animateBackgroundGradient(0f, true); } return anim; }
From source file:com.xhr.launcher.Workspace.java
Animator getChangeStateAnimation(final State state, boolean animated, int delay, int snapPage) { if (mState == state) { return null; }// w w w .j av a2 s .c o m // Initialize animation arrays for the first time if necessary initAnimationArrays(); AnimatorSet anim = animated ? LauncherAnimUtils.createAnimatorSet() : null; final State oldState = mState; final boolean oldStateIsNormal = (oldState == State.NORMAL); final boolean oldStateIsSpringLoaded = (oldState == State.SPRING_LOADED); final boolean oldStateIsSmall = (oldState == State.SMALL); final boolean oldStateIsOverview = (oldState == State.OVERVIEW); setState(state); final boolean stateIsNormal = (state == State.NORMAL); final boolean stateIsSpringLoaded = (state == State.SPRING_LOADED); final boolean stateIsSmall = (state == State.SMALL); final boolean stateIsOverview = (state == State.OVERVIEW); float finalBackgroundAlpha = (stateIsSpringLoaded || stateIsOverview) ? 1.0f : 0f; float finalHotseatAndPageIndicatorAlpha = (stateIsOverview || stateIsSmall) ? 0f : 1f; float finalOverviewPanelAlpha = stateIsOverview ? 1f : 0f; float finalSearchBarAlpha = !stateIsNormal ? 0f : 1f; float finalWorkspaceTranslationY = stateIsOverview ? getOverviewModeTranslationY() : 0; boolean workspaceToAllApps = (oldStateIsNormal && stateIsSmall); boolean allAppsToWorkspace = (oldStateIsSmall && stateIsNormal); boolean workspaceToOverview = (oldStateIsNormal && stateIsOverview); boolean overviewToWorkspace = (oldStateIsOverview && stateIsNormal); mNewScale = 1.0f; if (oldStateIsOverview) { disableFreeScroll(snapPage); } else if (stateIsOverview) { enableFreeScroll(); } if (state != State.NORMAL) { if (stateIsSpringLoaded) { mNewScale = mSpringLoadedShrinkFactor; } else if (stateIsOverview) { mNewScale = mOverviewModeShrinkFactor; } else if (stateIsSmall) { mNewScale = mOverviewModeShrinkFactor - 0.3f; } if (workspaceToAllApps) { updateChildrenLayersEnabled(false); } } final int duration; if (workspaceToAllApps) { 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); } for (int i = 0; i < getChildCount(); i++) { final CellLayout cl = (CellLayout) getChildAt(i); boolean isCurrentPage = (i == getNextPage()); float initialAlpha = cl.getShortcutsAndWidgets().getAlpha(); float finalAlpha = stateIsSmall ? 0f : 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 && isCurrentPage) { initialAlpha = 0f; } else if (!isCurrentPage) { initialAlpha = finalAlpha = 0f; } cl.setShortcutAndWidgetAlpha(initialAlpha); } } mOldAlphas[i] = initialAlpha; mNewAlphas[i] = finalAlpha; if (animated) { mOldBackgroundAlphas[i] = cl.getBackgroundAlpha(); mNewBackgroundAlphas[i] = finalBackgroundAlpha; } else { cl.setBackgroundAlpha(finalBackgroundAlpha); cl.setShortcutAndWidgetAlpha(finalAlpha); } } final View searchBar = mLauncher.getQsbBar(); final View overviewPanel = mLauncher.getOverviewPanel(); final View hotseat = mLauncher.getHotseat(); if (animated) { anim.setDuration(duration); LauncherViewPropertyAnimator scale = new LauncherViewPropertyAnimator(this); scale.scaleX(mNewScale).scaleY(mNewScale).translationY(finalWorkspaceTranslationY) .setInterpolator(mZoomInInterpolator); anim.play(scale); for (int index = 0; index < getChildCount(); index++) { final int i = index; final CellLayout cl = (CellLayout) getChildAt(i); float currentAlpha = cl.getShortcutsAndWidgets().getAlpha(); if (mOldAlphas[i] == 0 && mNewAlphas[i] == 0) { cl.setBackgroundAlpha(mNewBackgroundAlphas[i]); cl.setShortcutAndWidgetAlpha(mNewAlphas[i]); } else { if (mOldAlphas[i] != mNewAlphas[i] || currentAlpha != mNewAlphas[i]) { LauncherViewPropertyAnimator alphaAnim = new LauncherViewPropertyAnimator( cl.getShortcutsAndWidgets()); alphaAnim.alpha(mNewAlphas[i]).setInterpolator(mZoomInInterpolator); anim.play(alphaAnim); } if (mOldBackgroundAlphas[i] != 0 || mNewBackgroundAlphas[i] != 0) { ValueAnimator bgAnim = LauncherAnimUtils.ofFloat(cl, 0f, 1f); bgAnim.setInterpolator(mZoomInInterpolator); bgAnim.addUpdateListener(new LauncherAnimatorUpdateListener() { public void onAnimationUpdate(float a, float b) { cl.setBackgroundAlpha(a * mOldBackgroundAlphas[i] + b * mNewBackgroundAlphas[i]); } }); anim.play(bgAnim); } } } ObjectAnimator pageIndicatorAlpha = null; if (getPageIndicator() != null) { pageIndicatorAlpha = ObjectAnimator.ofFloat(getPageIndicator(), "alpha", finalHotseatAndPageIndicatorAlpha); } ObjectAnimator hotseatAlpha = ObjectAnimator.ofFloat(hotseat, "alpha", finalHotseatAndPageIndicatorAlpha); ObjectAnimator searchBarAlpha = ObjectAnimator.ofFloat(searchBar, "alpha", finalSearchBarAlpha); ObjectAnimator overviewPanelAlpha = ObjectAnimator.ofFloat(overviewPanel, "alpha", finalOverviewPanelAlpha); overviewPanelAlpha.addListener(new AlphaUpdateListener(overviewPanel)); hotseatAlpha.addListener(new AlphaUpdateListener(hotseat)); searchBarAlpha.addListener(new AlphaUpdateListener(searchBar)); if (workspaceToOverview) { hotseatAlpha.setInterpolator(new DecelerateInterpolator(2)); } else if (overviewToWorkspace) { overviewPanelAlpha.setInterpolator(new DecelerateInterpolator(2)); } if (getPageIndicator() != null) { pageIndicatorAlpha.addListener(new AlphaUpdateListener(getPageIndicator())); } anim.play(overviewPanelAlpha); anim.play(hotseatAlpha); anim.play(searchBarAlpha); anim.play(pageIndicatorAlpha); anim.setStartDelay(delay); } else { overviewPanel.setAlpha(finalOverviewPanelAlpha); AlphaUpdateListener.updateVisibility(overviewPanel); hotseat.setAlpha(finalHotseatAndPageIndicatorAlpha); AlphaUpdateListener.updateVisibility(hotseat); if (getPageIndicator() != null) { getPageIndicator().setAlpha(finalHotseatAndPageIndicatorAlpha); AlphaUpdateListener.updateVisibility(getPageIndicator()); } searchBar.setAlpha(finalSearchBarAlpha); AlphaUpdateListener.updateVisibility(searchBar); updateCustomContentVisibility(); setScaleX(mNewScale); setScaleY(mNewScale); setTranslationY(finalWorkspaceTranslationY); } // mLauncher.updateVoiceButtonProxyVisible(false); if (stateIsSpringLoaded) { // Right now we're covered by Apps Customize // Show the background gradient immediately, so the gradient will // be showing once AppsCustomize disappears animateBackgroundGradient( getResources().getInteger(R.integer.config_appsCustomizeSpringLoadedBgAlpha) / 100f, false); } else if (stateIsOverview) { animateBackgroundGradient( getResources().getInteger(R.integer.config_appsCustomizeSpringLoadedBgAlpha) / 100f, true); } else { // Fade the background gradient away animateBackgroundGradient(0f, animated); } return anim; }
From source file:cc.flydev.launcher.Workspace.java
Animator getChangeStateAnimation(final State state, boolean animated, int delay, int snapPage) { if (mState == state) { return null; }// ww w . j a va 2s .c o m // Initialize animation arrays for the first time if necessary initAnimationArrays(); AnimatorSet anim = animated ? LauncherAnimUtils.createAnimatorSet() : null; final State oldState = mState; final boolean oldStateIsNormal = (oldState == State.NORMAL); final boolean oldStateIsSpringLoaded = (oldState == State.SPRING_LOADED); final boolean oldStateIsSmall = (oldState == State.SMALL); final boolean oldStateIsOverview = (oldState == State.OVERVIEW); setState(state); final boolean stateIsNormal = (state == State.NORMAL); final boolean stateIsSpringLoaded = (state == State.SPRING_LOADED); final boolean stateIsSmall = (state == State.SMALL); final boolean stateIsOverview = (state == State.OVERVIEW); float finalBackgroundAlpha = (stateIsSpringLoaded || stateIsOverview) ? 1.0f : 0f; float finalHotseatAndPageIndicatorAlpha = (stateIsOverview || stateIsSmall) ? 0f : 1f; float finalOverviewPanelAlpha = stateIsOverview ? 1f : 0f; float finalSearchBarAlpha = !stateIsNormal ? 0f : 1f; float finalWorkspaceTranslationY = stateIsOverview ? getOverviewModeTranslationY() : 0; boolean workspaceToAllApps = (oldStateIsNormal && stateIsSmall); boolean allAppsToWorkspace = (oldStateIsSmall && stateIsNormal); boolean workspaceToOverview = (oldStateIsNormal && stateIsOverview); boolean overviewToWorkspace = (oldStateIsOverview && stateIsNormal); mNewScale = 1.0f; if (oldStateIsOverview) { disableFreeScroll(snapPage); } else if (stateIsOverview) { enableFreeScroll(); } if (state != State.NORMAL) { if (stateIsSpringLoaded) { mNewScale = mSpringLoadedShrinkFactor; } else if (stateIsOverview) { mNewScale = mOverviewModeShrinkFactor; } else if (stateIsSmall) { mNewScale = mOverviewModeShrinkFactor - 0.3f; } if (workspaceToAllApps) { updateChildrenLayersEnabled(false); } } final int duration; if (workspaceToAllApps) { 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); } for (int i = 0; i < getChildCount(); i++) { final CellLayout cl = (CellLayout) getChildAt(i); boolean isCurrentPage = (i == getNextPage()); float initialAlpha = cl.getShortcutsAndWidgets().getAlpha(); float finalAlpha = stateIsSmall ? 0f : 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 && isCurrentPage) { initialAlpha = 0f; } else if (!isCurrentPage) { initialAlpha = finalAlpha = 0f; } cl.setShortcutAndWidgetAlpha(initialAlpha); } } mOldAlphas[i] = initialAlpha; mNewAlphas[i] = finalAlpha; if (animated) { mOldBackgroundAlphas[i] = cl.getBackgroundAlpha(); mNewBackgroundAlphas[i] = finalBackgroundAlpha; } else { cl.setBackgroundAlpha(finalBackgroundAlpha); cl.setShortcutAndWidgetAlpha(finalAlpha); } } final View searchBar = mLauncher.getQsbBar(); final View overviewPanel = mLauncher.getOverviewPanel(); final View hotseat = mLauncher.getHotseat(); if (animated) { anim.setDuration(duration); LauncherViewPropertyAnimator scale = new LauncherViewPropertyAnimator(this); scale.scaleX(mNewScale).scaleY(mNewScale).translationY(finalWorkspaceTranslationY) .setInterpolator(mZoomInInterpolator); anim.play(scale); for (int index = 0; index < getChildCount(); index++) { final int i = index; final CellLayout cl = (CellLayout) getChildAt(i); float currentAlpha = cl.getShortcutsAndWidgets().getAlpha(); if (mOldAlphas[i] == 0 && mNewAlphas[i] == 0) { cl.setBackgroundAlpha(mNewBackgroundAlphas[i]); cl.setShortcutAndWidgetAlpha(mNewAlphas[i]); } else { if (mOldAlphas[i] != mNewAlphas[i] || currentAlpha != mNewAlphas[i]) { LauncherViewPropertyAnimator alphaAnim = new LauncherViewPropertyAnimator( cl.getShortcutsAndWidgets()); alphaAnim.alpha(mNewAlphas[i]).setInterpolator(mZoomInInterpolator); anim.play(alphaAnim); } if (mOldBackgroundAlphas[i] != 0 || mNewBackgroundAlphas[i] != 0) { ValueAnimator bgAnim = LauncherAnimUtils.ofFloat(cl, 0f, 1f); bgAnim.setInterpolator(mZoomInInterpolator); bgAnim.addUpdateListener(new LauncherAnimatorUpdateListener() { public void onAnimationUpdate(float a, float b) { cl.setBackgroundAlpha(a * mOldBackgroundAlphas[i] + b * mNewBackgroundAlphas[i]); } }); anim.play(bgAnim); } } } ObjectAnimator pageIndicatorAlpha = null; if (getPageIndicator() != null) { pageIndicatorAlpha = ObjectAnimator.ofFloat(getPageIndicator(), "alpha", finalHotseatAndPageIndicatorAlpha); } ObjectAnimator hotseatAlpha = ObjectAnimator.ofFloat(hotseat, "alpha", finalHotseatAndPageIndicatorAlpha); ObjectAnimator searchBarAlpha = ObjectAnimator.ofFloat(searchBar, "alpha", finalSearchBarAlpha); ObjectAnimator overviewPanelAlpha = ObjectAnimator.ofFloat(overviewPanel, "alpha", finalOverviewPanelAlpha); overviewPanelAlpha.addListener(new AlphaUpdateListener(overviewPanel)); hotseatAlpha.addListener(new AlphaUpdateListener(hotseat)); searchBarAlpha.addListener(new AlphaUpdateListener(searchBar)); if (workspaceToOverview) { hotseatAlpha.setInterpolator(new DecelerateInterpolator(2)); } else if (overviewToWorkspace) { overviewPanelAlpha.setInterpolator(new DecelerateInterpolator(2)); } if (getPageIndicator() != null) { pageIndicatorAlpha.addListener(new AlphaUpdateListener(getPageIndicator())); } anim.play(overviewPanelAlpha); anim.play(hotseatAlpha); anim.play(searchBarAlpha); anim.play(pageIndicatorAlpha); anim.setStartDelay(delay); } else { overviewPanel.setAlpha(finalOverviewPanelAlpha); AlphaUpdateListener.updateVisibility(overviewPanel); hotseat.setAlpha(finalHotseatAndPageIndicatorAlpha); AlphaUpdateListener.updateVisibility(hotseat); if (getPageIndicator() != null) { getPageIndicator().setAlpha(finalHotseatAndPageIndicatorAlpha); AlphaUpdateListener.updateVisibility(getPageIndicator()); } searchBar.setAlpha(finalSearchBarAlpha); AlphaUpdateListener.updateVisibility(searchBar); updateCustomContentVisibility(); setScaleX(mNewScale); setScaleY(mNewScale); setTranslationY(finalWorkspaceTranslationY); } mLauncher.updateVoiceButtonProxyVisible(false); if (stateIsSpringLoaded) { // Right now we're covered by Apps Customize // Show the background gradient immediately, so the gradient will // be showing once AppsCustomize disappears animateBackgroundGradient( getResources().getInteger(R.integer.config_appsCustomizeSpringLoadedBgAlpha) / 100f, false); } else if (stateIsOverview) { animateBackgroundGradient( getResources().getInteger(R.integer.config_appsCustomizeSpringLoadedBgAlpha) / 100f, true); } else { // Fade the background gradient away animateBackgroundGradient(0f, animated); } return anim; }
From source file:us.shandian.launcher.Workspace.java
Animator getChangeStateAnimation(final State state, boolean animated, int delay, int snapPage) { if (mState == state) { return null; }/*from w w w . j ava 2s . com*/ // Initialize animation arrays for the first time if necessary initAnimationArrays(); AnimatorSet anim = animated ? LauncherAnimUtils.createAnimatorSet() : null; final State oldState = mState; final boolean oldStateIsNormal = (oldState == State.NORMAL); final boolean oldStateIsSpringLoaded = (oldState == State.SPRING_LOADED); final boolean oldStateIsSmall = (oldState == State.SMALL); final boolean oldStateIsOverview = (oldState == State.OVERVIEW); setState(state); final boolean stateIsNormal = (state == State.NORMAL); final boolean stateIsSpringLoaded = (state == State.SPRING_LOADED); final boolean stateIsSmall = (state == State.SMALL); final boolean stateIsOverview = (state == State.OVERVIEW); float finalBackgroundAlpha = (stateIsSpringLoaded || stateIsOverview) ? 1.0f : 0f; float finalHotseatAndPageIndicatorAlpha = (stateIsOverview || stateIsSmall) ? 0f : 1f; float finalOverviewPanelAlpha = stateIsOverview ? 1f : 0f; float finalSearchBarAlpha = !stateIsNormal ? 0f : 1f; float finalWorkspaceTranslationY = stateIsOverview ? getOverviewModeTranslationY() : 0; boolean workspaceToAllApps = (oldStateIsNormal && stateIsSmall); boolean allAppsToWorkspace = (oldStateIsSmall && stateIsNormal); boolean workspaceToOverview = (oldStateIsNormal && stateIsOverview); boolean overviewToWorkspace = (oldStateIsOverview && stateIsNormal); mNewScale = 1.0f; if (oldStateIsOverview) { disableFreeScroll(snapPage); } else if (stateIsOverview) { enableFreeScroll(); } if (state != State.NORMAL) { if (stateIsSpringLoaded) { mNewScale = mSpringLoadedShrinkFactor; } else if (stateIsOverview) { mNewScale = mOverviewModeShrinkFactor; } else if (stateIsSmall) { mNewScale = mOverviewModeShrinkFactor - 0.3f; } if (workspaceToAllApps) { updateChildrenLayersEnabled(false); } } final int duration; if (workspaceToAllApps) { 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); } for (int i = 0; i < getChildCount(); i++) { final CellLayout cl = (CellLayout) getChildAt(i); boolean isCurrentPage = (i == getNextPage()); float initialAlpha = cl.getShortcutsAndWidgets().getAlpha(); float finalAlpha = stateIsSmall ? 0f : 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 && isCurrentPage) { initialAlpha = 0f; } else if (!isCurrentPage) { initialAlpha = finalAlpha = 0f; } cl.setShortcutAndWidgetAlpha(initialAlpha); } } mOldAlphas[i] = initialAlpha; mNewAlphas[i] = finalAlpha; if (animated) { mOldBackgroundAlphas[i] = cl.getBackgroundAlpha(); mNewBackgroundAlphas[i] = finalBackgroundAlpha; } else { cl.setBackgroundAlpha(finalBackgroundAlpha); cl.setShortcutAndWidgetAlpha(finalAlpha); } } final View searchBar = mLauncher.getQsbBar(); final View overviewPanel = mLauncher.getOverviewPanel(); final View hotseat = mLauncher.getHotseat(); if (animated) { anim.setDuration(duration); LauncherViewPropertyAnimator scale = new LauncherViewPropertyAnimator(this); scale.scaleX(mNewScale).scaleY(mNewScale).translationY(finalWorkspaceTranslationY) .setInterpolator(mZoomInInterpolator); anim.play(scale); for (int index = 0; index < getChildCount(); index++) { final int i = index; final CellLayout cl = (CellLayout) getChildAt(i); float currentAlpha = cl.getShortcutsAndWidgets().getAlpha(); if (mOldAlphas[i] == 0 && mNewAlphas[i] == 0) { cl.setBackgroundAlpha(mNewBackgroundAlphas[i]); cl.setShortcutAndWidgetAlpha(mNewAlphas[i]); } else { if (mOldAlphas[i] != mNewAlphas[i] || currentAlpha != mNewAlphas[i]) { LauncherViewPropertyAnimator alphaAnim = new LauncherViewPropertyAnimator( cl.getShortcutsAndWidgets()); alphaAnim.alpha(mNewAlphas[i]).setInterpolator(mZoomInInterpolator); anim.play(alphaAnim); } if (mOldBackgroundAlphas[i] != 0 || mNewBackgroundAlphas[i] != 0) { ValueAnimator bgAnim = LauncherAnimUtils.ofFloat(cl, 0f, 1f); bgAnim.setInterpolator(mZoomInInterpolator); bgAnim.addUpdateListener(new LauncherAnimatorUpdateListener() { public void onAnimationUpdate(float a, float b) { cl.setBackgroundAlpha(a * mOldBackgroundAlphas[i] + b * mNewBackgroundAlphas[i]); } }); anim.play(bgAnim); } } } ObjectAnimator pageIndicatorAlpha = null; if (getPageIndicator() != null) { pageIndicatorAlpha = ObjectAnimator.ofFloat(getPageIndicator(), "alpha", finalHotseatAndPageIndicatorAlpha); } ObjectAnimator hotseatAlpha = ObjectAnimator.ofFloat(hotseat, "alpha", finalHotseatAndPageIndicatorAlpha); ObjectAnimator searchBarAlpha = ObjectAnimator.ofFloat(searchBar, "alpha", finalSearchBarAlpha); ObjectAnimator overviewPanelAlpha = ObjectAnimator.ofFloat(overviewPanel, "alpha", finalOverviewPanelAlpha); overviewPanelAlpha.addListener(new AlphaUpdateListener(overviewPanel)); hotseatAlpha.addListener(new AlphaUpdateListener(hotseat)); searchBarAlpha.addListener(new AlphaUpdateListener(searchBar)); if (workspaceToOverview) { hotseatAlpha.setInterpolator(new DecelerateInterpolator(2)); } else if (overviewToWorkspace) { overviewPanelAlpha.setInterpolator(new DecelerateInterpolator(2)); } if (getPageIndicator() != null) { pageIndicatorAlpha.addListener(new AlphaUpdateListener(getPageIndicator())); } anim.play(overviewPanelAlpha); anim.play(hotseatAlpha); if (searchBar.getVisibility() != View.GONE) { anim.play(searchBarAlpha); } anim.play(pageIndicatorAlpha); anim.setStartDelay(delay); } else { overviewPanel.setAlpha(finalOverviewPanelAlpha); AlphaUpdateListener.updateVisibility(overviewPanel); hotseat.setAlpha(finalHotseatAndPageIndicatorAlpha); AlphaUpdateListener.updateVisibility(hotseat); if (getPageIndicator() != null) { getPageIndicator().setAlpha(finalHotseatAndPageIndicatorAlpha); AlphaUpdateListener.updateVisibility(getPageIndicator()); } searchBar.setAlpha(finalSearchBarAlpha); AlphaUpdateListener.updateVisibility(searchBar); updateCustomContentVisibility(); setScaleX(mNewScale); setScaleY(mNewScale); setTranslationY(finalWorkspaceTranslationY); } mLauncher.updateVoiceButtonProxyVisible(false); if (stateIsSpringLoaded) { // Right now we're covered by Apps Customize // Show the background gradient immediately, so the gradient will // be showing once AppsCustomize disappears animateBackgroundGradient( getResources().getInteger(R.integer.config_appsCustomizeSpringLoadedBgAlpha) / 100f, false); } else if (stateIsOverview) { animateBackgroundGradient( getResources().getInteger(R.integer.config_appsCustomizeSpringLoadedBgAlpha) / 100f, true); } else { // Fade the background gradient away animateBackgroundGradient(0f, animated); } return anim; }