summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWinson <winsonc@google.com>2016-07-22 13:38:31 -0700
committerWinson <winsonc@google.com>2016-07-22 15:07:23 -0700
commit61d9e78f23efcf43be1945d4233780ac89db99d9 (patch)
tree50b225beef87986be36201146b0e7d68f9758894
parent58368b15152052fb479891f0d3aba30ab3794fba (diff)
downloadandroid_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
-rw-r--r--src/com/android/launcher3/LauncherStateTransitionAnimation.java58
-rw-r--r--src/com/android/launcher3/WorkspaceStateTransitionAnimation.java26
2 files changed, 59 insertions, 25 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();
diff --git a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
index c2631b07f..598ba741a 100644
--- a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
+++ b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
@@ -394,24 +394,14 @@ public class WorkspaceStateTransitionAnimation {
overviewPanelAlpha.addListener(new AlphaUpdateListener(overviewPanel,
accessibilityEnabled));
- // 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);
- qsbContainer.setLayerType(View.LAYER_TYPE_HARDWARE, null);
- if (layerViews != null) {
- // If layerViews is not null, we add these views, and indicate that
- // the caller can manage layer state.
- layerViews.put(overviewPanel, LauncherStateTransitionAnimation.BUILD_AND_SET_LAYER);
- layerViews.put(qsbContainer, LauncherStateTransitionAnimation.BUILD_AND_SET_LAYER);
-
- layerViews.put(mLauncher.getHotseat(),
- LauncherStateTransitionAnimation.BUILD_AND_SET_LAYER);
- layerViews.put(mWorkspace.getPageIndicator(),
- LauncherStateTransitionAnimation.BUILD_AND_SET_LAYER);
- } else {
- // Otherwise let the animator handle layer management.
- overviewPanelAlpha.withLayer();
- }
+ // For animation optimization, we may need to provide the Launcher transition
+ // with a set of views on which to force build and manage layers in certain scenarios.
+ layerViews.put(overviewPanel, LauncherStateTransitionAnimation.BUILD_AND_SET_LAYER);
+ layerViews.put(qsbContainer, LauncherStateTransitionAnimation.BUILD_AND_SET_LAYER);
+ layerViews.put(mLauncher.getHotseat(),
+ LauncherStateTransitionAnimation.BUILD_AND_SET_LAYER);
+ layerViews.put(mWorkspace.getPageIndicator(),
+ LauncherStateTransitionAnimation.BUILD_AND_SET_LAYER);
if (states.workspaceToOverview) {
hotseatAlpha.setInterpolator(new DecelerateInterpolator(2));