diff options
author | Winson <winsonc@google.com> | 2016-07-22 13:38:31 -0700 |
---|---|---|
committer | Winson <winsonc@google.com> | 2016-07-22 15:07:23 -0700 |
commit | 61d9e78f23efcf43be1945d4233780ac89db99d9 (patch) | |
tree | 50b225beef87986be36201146b0e7d68f9758894 /src/com/android/launcher3/LauncherStateTransitionAnimation.java | |
parent | 58368b15152052fb479891f0d3aba30ab3794fba (diff) | |
download | android_packages_apps_Trebuchet-61d9e78f23efcf43be1945d4233780ac89db99d9.tar.gz android_packages_apps_Trebuchet-61d9e78f23efcf43be1945d4233780ac89db99d9.tar.bz2 android_packages_apps_Trebuchet-61d9e78f23efcf43be1945d4233780ac89db99d9.zip |
Ensure we still build the hw layers when pulling up all apps.
Bug: 30310330
Change-Id: I0d9f2fe01230bdb333c098b5515fc196ac2da2dc
Diffstat (limited to 'src/com/android/launcher3/LauncherStateTransitionAnimation.java')
-rw-r--r-- | src/com/android/launcher3/LauncherStateTransitionAnimation.java | 58 |
1 files changed, 51 insertions, 7 deletions
diff --git a/src/com/android/launcher3/LauncherStateTransitionAnimation.java b/src/com/android/launcher3/LauncherStateTransitionAnimation.java index 5c7e670a9..1fe0813e1 100644 --- a/src/com/android/launcher3/LauncherStateTransitionAnimation.java +++ b/src/com/android/launcher3/LauncherStateTransitionAnimation.java @@ -250,7 +250,7 @@ public class LauncherStateTransitionAnimation { final View contentView = toView.getContentView(); playCommonTransitionAnimations(toWorkspaceState, fromView, toView, - animated, initialized, animation, revealDuration, layerViews); + animated, initialized, animation, layerViews); if (!animated || !initialized) { if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP && toWorkspaceState == Workspace.State.NORMAL_HIDDEN) { @@ -414,11 +414,22 @@ public class LauncherStateTransitionAnimation { return animation; } else if (animType == PULLUP) { + // We are animating the content view alpha, so ensure we have a layer for it + layerViews.put(contentView, BUILD_AND_SET_LAYER); + animation.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { dispatchOnLauncherTransitionEnd(fromView, animated, false); dispatchOnLauncherTransitionEnd(toView, animated, false); + + // Disable all necessary layers + for (View v : layerViews.keySet()) { + if (layerViews.get(v) == BUILD_AND_SET_LAYER) { + v.setLayerType(View.LAYER_TYPE_NONE, null); + } + } + cleanupAnimation(); pCb.onTransitionComplete(); } @@ -435,9 +446,20 @@ public class LauncherStateTransitionAnimation { // we waited for a layout/draw pass if (mCurrentAnimation != stateAnimation) return; + dispatchOnLauncherTransitionStart(fromView, animated, false); dispatchOnLauncherTransitionStart(toView, animated, false); + // Enable all necessary layers + for (View v : layerViews.keySet()) { + if (layerViews.get(v) == BUILD_AND_SET_LAYER) { + v.setLayerType(View.LAYER_TYPE_HARDWARE, null); + } + if (Utilities.ATLEAST_LOLLIPOP && v.isAttachedToWindow()) { + v.buildLayer(); + } + } + toView.requestFocus(); stateAnimation.start(); } @@ -453,7 +475,7 @@ public class LauncherStateTransitionAnimation { */ private void playCommonTransitionAnimations( Workspace.State toWorkspaceState, View fromView, View toView, - boolean animated, boolean initialized, AnimatorSet animation, int revealDuration, + boolean animated, boolean initialized, AnimatorSet animation, HashMap<View, Integer> layerViews) { // Create the workspace animation. // NOTE: this call apparently also sets the state for the workspace if !animated @@ -580,7 +602,7 @@ public class LauncherStateTransitionAnimation { boolean multiplePagesVisible = toWorkspaceState.hasMultipleVisiblePages; playCommonTransitionAnimations(toWorkspaceState, fromWorkspace, null, - animated, animated, animation, revealDuration, layerViews); + animated, animated, animation, layerViews); if (animated) { dispatchOnLauncherTransitionPrepare(fromWorkspace, animated, multiplePagesVisible); @@ -661,6 +683,8 @@ public class LauncherStateTransitionAnimation { res.getInteger(R.integer.config_overlayItemsAlphaStagger); final View toView = mLauncher.getWorkspace(); + final View revealView = fromView.getRevealView(); + final View contentView = fromView.getContentView(); final HashMap<View, Integer> layerViews = new HashMap<>(); @@ -673,7 +697,7 @@ public class LauncherStateTransitionAnimation { boolean multiplePagesVisible = toWorkspaceState.hasMultipleVisiblePages; playCommonTransitionAnimations(toWorkspaceState, fromView, toView, - animated, initialized, animation, revealDuration, layerViews); + animated, initialized, animation, layerViews); if (!animated || !initialized) { if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP && fromWorkspaceState == Workspace.State.NORMAL_HIDDEN) { @@ -695,9 +719,6 @@ public class LauncherStateTransitionAnimation { return null; } if (animType == CIRCULAR_REVEAL) { - final View revealView = fromView.getRevealView(); - final View contentView = fromView.getContentView(); - // hideAppsCustomizeHelper is called in some cases when it is already hidden // don't perform all these no-op animations. In particularly, this was causing // the all-apps button to pop in and out. @@ -864,6 +885,9 @@ public class LauncherStateTransitionAnimation { return animation; } else if (animType == PULLUP) { + // We are animating the content view alpha, so ensure we have a layer for it + layerViews.put(contentView, BUILD_AND_SET_LAYER); + animation.addListener(new AnimatorListenerAdapter() { boolean canceled = false; @Override @@ -876,10 +900,19 @@ public class LauncherStateTransitionAnimation { if (canceled) return; dispatchOnLauncherTransitionEnd(fromView, animated, false); dispatchOnLauncherTransitionEnd(toView, animated, false); + // Run any queued runnables if (onCompleteRunnable != null) { onCompleteRunnable.run(); } + + // Disable all necessary layers + for (View v : layerViews.keySet()) { + if (layerViews.get(v) == BUILD_AND_SET_LAYER) { + v.setLayerType(View.LAYER_TYPE_NONE, null); + } + } + cleanupAnimation(); pCb.onTransitionComplete(); } @@ -898,9 +931,20 @@ public class LauncherStateTransitionAnimation { // we waited for a layout/draw pass if (mCurrentAnimation != stateAnimation) return; + dispatchOnLauncherTransitionStart(fromView, animated, false); dispatchOnLauncherTransitionStart(toView, animated, false); + // Enable all necessary layers + for (View v : layerViews.keySet()) { + if (layerViews.get(v) == BUILD_AND_SET_LAYER) { + v.setLayerType(View.LAYER_TYPE_HARDWARE, null); + } + if (Utilities.ATLEAST_LOLLIPOP && v.isAttachedToWindow()) { + v.buildLayer(); + } + } + // Focus the new view toView.requestFocus(); stateAnimation.start(); |