From 2854d256192a8260ddeb2f2e94bc1a2fc5f6ef71 Mon Sep 17 00:00:00 2001 From: Adam Cohen Date: Wed, 27 Aug 2014 16:04:07 -0700 Subject: All apps transition work -> Fix icons popping in -> Fix issue 17259204 -> posting animation start and buildLayer to allow first frame to be ready. This becomes necessary with RevealAnimator on the render thread, since it can't use FirstFrameAnimatorHelper any longer. -> adding a bit better transition for K, issue 17252683 -> updating a few assets Change-Id: I0b193b4b3b511492a2fad6230cd91e3f0de634f0 --- src/com/android/launcher3/Workspace.java | 47 +++++++++++++++----------------- 1 file changed, 22 insertions(+), 25 deletions(-) (limited to 'src/com/android/launcher3/Workspace.java') diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 9d9730617..732b9ba4a 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -1212,14 +1212,6 @@ public class Workspace extends SmoothPagedView enableChildrenCache(mCurrentPage - 1, mCurrentPage + 1); } } - - // If we are not fading in adjacent screens, we still need to restore the alpha in case the - // user scrolls while we are transitioning (should not affect dispatchDraw optimizations) - if (!mWorkspaceFadeInAdjacentScreens) { - for (int i = 0; i < getChildCount(); ++i) { - ((CellLayout) getPageAt(i)).setShortcutAndWidgetAlpha(1f); - } - } } protected void onPageEndMoving() { @@ -2054,8 +2046,9 @@ public class Workspace extends SmoothPagedView mNewAlphas = new float[childCount]; } - Animator getChangeStateAnimation(final State state, boolean animated) { - return getChangeStateAnimation(state, animated, 0, -1); + Animator getChangeStateAnimation(final State state, boolean animated, + ArrayList layerViews) { + return getChangeStateAnimation(state, animated, 0, -1, layerViews); } @Override @@ -2191,6 +2184,11 @@ public class Workspace extends SmoothPagedView private static final int HIDE_WORKSPACE_DURATION = 100; Animator getChangeStateAnimation(final State state, boolean animated, int delay, int snapPage) { + return getChangeStateAnimation(state, animated, delay, snapPage, null); + } + + Animator getChangeStateAnimation(final State state, boolean animated, int delay, int snapPage, + ArrayList layerViews) { if (mState == state) { return null; } @@ -2312,6 +2310,9 @@ public class Workspace extends SmoothPagedView cl.setBackgroundAlpha(mNewBackgroundAlphas[i]); cl.setShortcutAndWidgetAlpha(mNewAlphas[i]); } else { + if (layerViews != null) { + layerViews.add(cl); + } if (mOldAlphas[i] != mNewAlphas[i] || currentAlpha != mNewAlphas[i]) { LauncherViewPropertyAnimator alphaAnim = new LauncherViewPropertyAnimator(cl.getShortcutsAndWidgets()); @@ -2359,6 +2360,17 @@ public class Workspace extends SmoothPagedView .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. + hotseat.setLayerType(View.LAYER_TYPE_HARDWARE, null); + searchBar.setLayerType(View.LAYER_TYPE_HARDWARE, null); + overviewPanel.setLayerType(View.LAYER_TYPE_HARDWARE, null); + if (layerViews != null) { + layerViews.add(hotseat); + layerViews.add(searchBar); + layerViews.add(overviewPanel); + } + if (workspaceToOverview) { pageIndicatorAlpha.setInterpolator(new DecelerateInterpolator(2)); hotseatAlpha.setInterpolator(new DecelerateInterpolator(2)); @@ -2504,21 +2516,6 @@ public class Workspace extends SmoothPagedView private void onTransitionEnd() { mIsSwitchingState = false; updateChildrenLayersEnabled(false); - // The code in getChangeStateAnimation to determine initialAlpha and finalAlpha will ensure - // ensure that only the current page is visible during (and subsequently, after) the - // transition animation. If fade adjacent pages is disabled, then re-enable the page - // visibility after the transition animation. - if (!mWorkspaceFadeInAdjacentScreens) { - for (int i = 0; i < getChildCount(); i++) { - final CellLayout cl = (CellLayout) getChildAt(i); - cl.setShortcutAndWidgetAlpha(1f); - } - } else { - for (int i = 0; i < numCustomPages(); i++) { - final CellLayout cl = (CellLayout) getChildAt(i); - cl.setShortcutAndWidgetAlpha(1f); - } - } showCustomContentIfNecessary(); } -- cgit v1.2.3