Merge "Ensure we still build the hw layers when pulling up all apps." into ub-launcher3-calgary
This commit is contained in:
@@ -250,7 +250,7 @@ public class LauncherStateTransitionAnimation {
|
|||||||
|
|
||||||
final View contentView = toView.getContentView();
|
final View contentView = toView.getContentView();
|
||||||
playCommonTransitionAnimations(toWorkspaceState, fromView, toView,
|
playCommonTransitionAnimations(toWorkspaceState, fromView, toView,
|
||||||
animated, initialized, animation, revealDuration, layerViews);
|
animated, initialized, animation, layerViews);
|
||||||
if (!animated || !initialized) {
|
if (!animated || !initialized) {
|
||||||
if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP &&
|
if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP &&
|
||||||
toWorkspaceState == Workspace.State.NORMAL_HIDDEN) {
|
toWorkspaceState == Workspace.State.NORMAL_HIDDEN) {
|
||||||
@@ -414,11 +414,22 @@ public class LauncherStateTransitionAnimation {
|
|||||||
|
|
||||||
return animation;
|
return animation;
|
||||||
} else if (animType == PULLUP) {
|
} 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() {
|
animation.addListener(new AnimatorListenerAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationEnd(Animator animation) {
|
public void onAnimationEnd(Animator animation) {
|
||||||
dispatchOnLauncherTransitionEnd(fromView, animated, false);
|
dispatchOnLauncherTransitionEnd(fromView, animated, false);
|
||||||
dispatchOnLauncherTransitionEnd(toView, 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();
|
cleanupAnimation();
|
||||||
pCb.onTransitionComplete();
|
pCb.onTransitionComplete();
|
||||||
}
|
}
|
||||||
@@ -435,9 +446,20 @@ public class LauncherStateTransitionAnimation {
|
|||||||
// we waited for a layout/draw pass
|
// we waited for a layout/draw pass
|
||||||
if (mCurrentAnimation != stateAnimation)
|
if (mCurrentAnimation != stateAnimation)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dispatchOnLauncherTransitionStart(fromView, animated, false);
|
dispatchOnLauncherTransitionStart(fromView, animated, false);
|
||||||
dispatchOnLauncherTransitionStart(toView, 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();
|
toView.requestFocus();
|
||||||
stateAnimation.start();
|
stateAnimation.start();
|
||||||
}
|
}
|
||||||
@@ -453,7 +475,7 @@ public class LauncherStateTransitionAnimation {
|
|||||||
*/
|
*/
|
||||||
private void playCommonTransitionAnimations(
|
private void playCommonTransitionAnimations(
|
||||||
Workspace.State toWorkspaceState, View fromView, View toView,
|
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) {
|
HashMap<View, Integer> layerViews) {
|
||||||
// Create the workspace animation.
|
// Create the workspace animation.
|
||||||
// NOTE: this call apparently also sets the state for the workspace if !animated
|
// NOTE: this call apparently also sets the state for the workspace if !animated
|
||||||
@@ -580,7 +602,7 @@ public class LauncherStateTransitionAnimation {
|
|||||||
boolean multiplePagesVisible = toWorkspaceState.hasMultipleVisiblePages;
|
boolean multiplePagesVisible = toWorkspaceState.hasMultipleVisiblePages;
|
||||||
|
|
||||||
playCommonTransitionAnimations(toWorkspaceState, fromWorkspace, null,
|
playCommonTransitionAnimations(toWorkspaceState, fromWorkspace, null,
|
||||||
animated, animated, animation, revealDuration, layerViews);
|
animated, animated, animation, layerViews);
|
||||||
|
|
||||||
if (animated) {
|
if (animated) {
|
||||||
dispatchOnLauncherTransitionPrepare(fromWorkspace, animated, multiplePagesVisible);
|
dispatchOnLauncherTransitionPrepare(fromWorkspace, animated, multiplePagesVisible);
|
||||||
@@ -661,6 +683,8 @@ public class LauncherStateTransitionAnimation {
|
|||||||
res.getInteger(R.integer.config_overlayItemsAlphaStagger);
|
res.getInteger(R.integer.config_overlayItemsAlphaStagger);
|
||||||
|
|
||||||
final View toView = mLauncher.getWorkspace();
|
final View toView = mLauncher.getWorkspace();
|
||||||
|
final View revealView = fromView.getRevealView();
|
||||||
|
final View contentView = fromView.getContentView();
|
||||||
|
|
||||||
final HashMap<View, Integer> layerViews = new HashMap<>();
|
final HashMap<View, Integer> layerViews = new HashMap<>();
|
||||||
|
|
||||||
@@ -673,7 +697,7 @@ public class LauncherStateTransitionAnimation {
|
|||||||
boolean multiplePagesVisible = toWorkspaceState.hasMultipleVisiblePages;
|
boolean multiplePagesVisible = toWorkspaceState.hasMultipleVisiblePages;
|
||||||
|
|
||||||
playCommonTransitionAnimations(toWorkspaceState, fromView, toView,
|
playCommonTransitionAnimations(toWorkspaceState, fromView, toView,
|
||||||
animated, initialized, animation, revealDuration, layerViews);
|
animated, initialized, animation, layerViews);
|
||||||
if (!animated || !initialized) {
|
if (!animated || !initialized) {
|
||||||
if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP &&
|
if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP &&
|
||||||
fromWorkspaceState == Workspace.State.NORMAL_HIDDEN) {
|
fromWorkspaceState == Workspace.State.NORMAL_HIDDEN) {
|
||||||
@@ -695,9 +719,6 @@ public class LauncherStateTransitionAnimation {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (animType == CIRCULAR_REVEAL) {
|
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
|
// hideAppsCustomizeHelper is called in some cases when it is already hidden
|
||||||
// don't perform all these no-op animations. In particularly, this was causing
|
// don't perform all these no-op animations. In particularly, this was causing
|
||||||
// the all-apps button to pop in and out.
|
// the all-apps button to pop in and out.
|
||||||
@@ -864,6 +885,9 @@ public class LauncherStateTransitionAnimation {
|
|||||||
|
|
||||||
return animation;
|
return animation;
|
||||||
} else if (animType == PULLUP) {
|
} 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() {
|
animation.addListener(new AnimatorListenerAdapter() {
|
||||||
boolean canceled = false;
|
boolean canceled = false;
|
||||||
@Override
|
@Override
|
||||||
@@ -876,10 +900,19 @@ public class LauncherStateTransitionAnimation {
|
|||||||
if (canceled) return;
|
if (canceled) return;
|
||||||
dispatchOnLauncherTransitionEnd(fromView, animated, false);
|
dispatchOnLauncherTransitionEnd(fromView, animated, false);
|
||||||
dispatchOnLauncherTransitionEnd(toView, animated, false);
|
dispatchOnLauncherTransitionEnd(toView, animated, false);
|
||||||
|
|
||||||
// Run any queued runnables
|
// Run any queued runnables
|
||||||
if (onCompleteRunnable != null) {
|
if (onCompleteRunnable != null) {
|
||||||
onCompleteRunnable.run();
|
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();
|
cleanupAnimation();
|
||||||
pCb.onTransitionComplete();
|
pCb.onTransitionComplete();
|
||||||
}
|
}
|
||||||
@@ -898,9 +931,20 @@ public class LauncherStateTransitionAnimation {
|
|||||||
// we waited for a layout/draw pass
|
// we waited for a layout/draw pass
|
||||||
if (mCurrentAnimation != stateAnimation)
|
if (mCurrentAnimation != stateAnimation)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dispatchOnLauncherTransitionStart(fromView, animated, false);
|
dispatchOnLauncherTransitionStart(fromView, animated, false);
|
||||||
dispatchOnLauncherTransitionStart(toView, 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
|
// Focus the new view
|
||||||
toView.requestFocus();
|
toView.requestFocus();
|
||||||
stateAnimation.start();
|
stateAnimation.start();
|
||||||
|
|||||||
@@ -394,24 +394,14 @@ public class WorkspaceStateTransitionAnimation {
|
|||||||
overviewPanelAlpha.addListener(new AlphaUpdateListener(overviewPanel,
|
overviewPanelAlpha.addListener(new AlphaUpdateListener(overviewPanel,
|
||||||
accessibilityEnabled));
|
accessibilityEnabled));
|
||||||
|
|
||||||
// For animation optimations, we may need to provide the Launcher transition
|
// For animation optimization, we may need to provide the Launcher transition
|
||||||
// with a set of views on which to force build layers in certain scenarios.
|
// with a set of views on which to force build and manage layers in certain scenarios.
|
||||||
overviewPanel.setLayerType(View.LAYER_TYPE_HARDWARE, null);
|
layerViews.put(overviewPanel, LauncherStateTransitionAnimation.BUILD_AND_SET_LAYER);
|
||||||
qsbContainer.setLayerType(View.LAYER_TYPE_HARDWARE, null);
|
layerViews.put(qsbContainer, LauncherStateTransitionAnimation.BUILD_AND_SET_LAYER);
|
||||||
if (layerViews != null) {
|
layerViews.put(mLauncher.getHotseat(),
|
||||||
// If layerViews is not null, we add these views, and indicate that
|
LauncherStateTransitionAnimation.BUILD_AND_SET_LAYER);
|
||||||
// the caller can manage layer state.
|
layerViews.put(mWorkspace.getPageIndicator(),
|
||||||
layerViews.put(overviewPanel, LauncherStateTransitionAnimation.BUILD_AND_SET_LAYER);
|
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (states.workspaceToOverview) {
|
if (states.workspaceToOverview) {
|
||||||
hotseatAlpha.setInterpolator(new DecelerateInterpolator(2));
|
hotseatAlpha.setInterpolator(new DecelerateInterpolator(2));
|
||||||
|
|||||||
Reference in New Issue
Block a user