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
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 8.0 KiB After Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 705 B After Width: | Height: | Size: 744 B |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 462 B After Width: | Height: | Size: 476 B |
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 900 B After Width: | Height: | Size: 928 B |
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.4 KiB |
|
@ -22,6 +22,7 @@ import android.animation.AnimatorListenerAdapter;
|
|||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.PropertyValuesHolder;
|
||||
import android.animation.TimeInterpolator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
|
@ -82,6 +83,7 @@ import android.view.Surface;
|
|||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.View.OnLongClickListener;
|
||||
import android.view.ViewAnimationUtils;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
|
||||
|
@ -90,6 +92,7 @@ import android.view.WindowManager;
|
|||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.view.animation.AccelerateInterpolator;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Advanceable;
|
||||
import android.widget.FrameLayout;
|
||||
|
@ -3202,10 +3205,12 @@ public class Launcher extends Activity
|
|||
final View fromView = mWorkspace;
|
||||
final AppsCustomizeTabHost toView = mAppsCustomizeTabHost;
|
||||
|
||||
final ArrayList<View> layerViews = new ArrayList<View>();
|
||||
|
||||
Workspace.State workspaceState = contentType == AppsCustomizePagedView.ContentType.Widgets ?
|
||||
Workspace.State.OVERVIEW_HIDDEN : Workspace.State.NORMAL_HIDDEN;
|
||||
Animator workspaceAnim =
|
||||
mWorkspace.getChangeStateAnimation(workspaceState, animated);
|
||||
mWorkspace.getChangeStateAnimation(workspaceState, animated, layerViews);
|
||||
if (!LauncherAppState.isDisableAllApps()
|
||||
|| contentType == AppsCustomizePagedView.ContentType.Widgets) {
|
||||
// Set the content type for the all apps/widgets space
|
||||
|
@ -3214,7 +3219,6 @@ public class Launcher extends Activity
|
|||
|
||||
if (animated) {
|
||||
mStateAnimation = LauncherAnimUtils.createAnimatorSet();
|
||||
|
||||
final AppsCustomizePagedView content = (AppsCustomizePagedView)
|
||||
toView.findViewById(R.id.apps_customize_pane_content);
|
||||
|
||||
|
@ -3231,32 +3235,46 @@ public class Launcher extends Activity
|
|||
}
|
||||
|
||||
// Hide the real page background, and swap in the fake one
|
||||
revealView.setVisibility(View.VISIBLE);
|
||||
content.setPageBackgroundsVisible(false);
|
||||
revealView.setVisibility(View.VISIBLE);
|
||||
// We need to hide this view as the animation start will be posted.
|
||||
revealView.setAlpha(0);
|
||||
|
||||
int width = revealView.getMeasuredWidth();
|
||||
int height = revealView.getMeasuredHeight();
|
||||
|
||||
float revealRadius = (float) Math.sqrt((width * width) / 4 + (height * height) / 4);
|
||||
|
||||
revealView.setTranslationY(0);
|
||||
revealView.setTranslationX(0);
|
||||
|
||||
// Get the y delta between the center of the page and the center of the all apps button
|
||||
int[] allAppsToPanelDelta = Utilities.getCenterDeltaInScreenSpace(revealView,
|
||||
getAllAppsButton(), null);
|
||||
float yDrift = isWidgetTray ? height / 2 : allAppsToPanelDelta[1];
|
||||
float xDrift = isWidgetTray ? 0 : allAppsToPanelDelta[0];
|
||||
|
||||
float initAlpha = isWidgetTray ? 0.3f : 1f;
|
||||
float alpha = 0;
|
||||
float xDrift = 0;
|
||||
float yDrift = 0;
|
||||
if (material) {
|
||||
alpha = isWidgetTray ? 0.3f : 1f;
|
||||
yDrift = isWidgetTray ? height / 2 : allAppsToPanelDelta[1];
|
||||
xDrift = isWidgetTray ? 0 : allAppsToPanelDelta[0];
|
||||
} else {
|
||||
yDrift = 2 * height / 3;
|
||||
xDrift = 0;
|
||||
}
|
||||
final float initAlpha = alpha;
|
||||
|
||||
revealView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
|
||||
layerViews.add(revealView);
|
||||
PropertyValuesHolder panelAlpha = PropertyValuesHolder.ofFloat("alpha", initAlpha, 1f);
|
||||
PropertyValuesHolder panelDriftY =
|
||||
PropertyValuesHolder.ofFloat("translationY", yDrift, 0);
|
||||
PropertyValuesHolder panelDriftX =
|
||||
PropertyValuesHolder.ofFloat("translationX", xDrift, 0);
|
||||
|
||||
ObjectAnimator panelAlphaAndDrift =
|
||||
LauncherAnimUtils.ofPropertyValuesHolder(revealView, panelAlpha, panelDriftY, panelDriftX);
|
||||
ObjectAnimator panelAlphaAndDrift = ObjectAnimator.ofPropertyValuesHolder(revealView,
|
||||
panelAlpha, panelDriftY, panelDriftX);
|
||||
|
||||
panelAlphaAndDrift.setDuration(revealDuration);
|
||||
panelAlphaAndDrift.setInterpolator(new LogDecelerateInterpolator(100, 0));
|
||||
|
||||
|
@ -3265,15 +3283,17 @@ public class Launcher extends Activity
|
|||
if (page != null) {
|
||||
page.setVisibility(View.VISIBLE);
|
||||
page.setLayerType(View.LAYER_TYPE_HARDWARE, null);
|
||||
layerViews.add(page);
|
||||
|
||||
ObjectAnimator pageDrift = LauncherAnimUtils.ofFloat(page, "translationY", yDrift, 0);
|
||||
ObjectAnimator pageDrift = ObjectAnimator.ofFloat(page, "translationY", yDrift, 0);
|
||||
page.setTranslationY(yDrift);
|
||||
pageDrift.setDuration(revealDuration);
|
||||
pageDrift.setInterpolator(new LogDecelerateInterpolator(100, 0));
|
||||
pageDrift.setStartDelay(itemsAlphaStagger);
|
||||
mStateAnimation.play(pageDrift);
|
||||
|
||||
page.setAlpha(0f);
|
||||
ObjectAnimator itemsAlpha = LauncherAnimUtils.ofFloat(page, "alpha", 0f, 1f);
|
||||
ObjectAnimator itemsAlpha = ObjectAnimator.ofFloat(page, "alpha", 0f, 1f);
|
||||
itemsAlpha.setDuration(revealDuration);
|
||||
itemsAlpha.setInterpolator(new AccelerateInterpolator(1.5f));
|
||||
itemsAlpha.setStartDelay(itemsAlphaStagger);
|
||||
|
@ -3283,7 +3303,7 @@ public class Launcher extends Activity
|
|||
View pageIndicators = toView.findViewById(R.id.apps_customize_page_indicator);
|
||||
pageIndicators.setAlpha(0.01f);
|
||||
ObjectAnimator indicatorsAlpha =
|
||||
LauncherAnimUtils.ofFloat(pageIndicators, "alpha", 1f);
|
||||
ObjectAnimator.ofFloat(pageIndicators, "alpha", 1f);
|
||||
indicatorsAlpha.setDuration(revealDuration);
|
||||
mStateAnimation.play(indicatorsAlpha);
|
||||
|
||||
|
@ -3292,7 +3312,7 @@ public class Launcher extends Activity
|
|||
int allAppsButtonSize = LauncherAppState.getInstance().
|
||||
getDynamicGrid().getDeviceProfile().allAppsButtonVisualSize;
|
||||
float startRadius = isWidgetTray ? 0 : allAppsButtonSize / 2;
|
||||
Animator reveal = LauncherAnimUtils.createCircularReveal(revealView, width / 2,
|
||||
Animator reveal = ViewAnimationUtils.createCircularReveal(revealView, width / 2,
|
||||
height / 2, startRadius, revealRadius);
|
||||
reveal.setDuration(revealDuration);
|
||||
reveal.setInterpolator(new LogDecelerateInterpolator(100, 0));
|
||||
|
@ -3309,7 +3329,6 @@ public class Launcher extends Activity
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
mStateAnimation.play(reveal);
|
||||
}
|
||||
|
||||
|
@ -3332,29 +3351,14 @@ public class Launcher extends Activity
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
// Prepare the position
|
||||
toView.bringToFront();
|
||||
toView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
|
||||
boolean delayAnim = false;
|
||||
if (workspaceAnim != null) {
|
||||
mStateAnimation.play(workspaceAnim);
|
||||
}
|
||||
|
||||
dispatchOnLauncherTransitionPrepare(fromView, animated, false);
|
||||
dispatchOnLauncherTransitionPrepare(toView, animated, false);
|
||||
|
||||
// If any of the objects being animated haven't been measured/laid out
|
||||
// yet, delay the animation until we get a layout pass
|
||||
if ((((LauncherTransitionable) toView).getContent().getMeasuredWidth() == 0) ||
|
||||
(mWorkspace.getMeasuredWidth() == 0) ||
|
||||
(toView.getMeasuredWidth() == 0)) {
|
||||
delayAnim = true;
|
||||
}
|
||||
|
||||
final AnimatorSet stateAnimation = mStateAnimation;
|
||||
final Runnable startAnimRunnable = new Runnable() {
|
||||
public void run() {
|
||||
|
@ -3364,22 +3368,20 @@ public class Launcher extends Activity
|
|||
return;
|
||||
dispatchOnLauncherTransitionStart(fromView, animated, false);
|
||||
dispatchOnLauncherTransitionStart(toView, animated, false);
|
||||
LauncherAnimUtils.startAnimationAfterNextDraw(mStateAnimation, toView);
|
||||
|
||||
revealView.setAlpha(initAlpha);
|
||||
if (Utilities.isLmp()) {
|
||||
for (int i = 0; i < layerViews.size(); i++) {
|
||||
View v = layerViews.get(i);
|
||||
if (v != null) v.buildLayer();
|
||||
}
|
||||
}
|
||||
mStateAnimation.start();
|
||||
}
|
||||
};
|
||||
if (delayAnim) {
|
||||
toView.bringToFront();
|
||||
toView.setVisibility(View.VISIBLE);
|
||||
final ViewTreeObserver observer = toView.getViewTreeObserver();
|
||||
observer.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
|
||||
public void onGlobalLayout() {
|
||||
startAnimRunnable.run();
|
||||
toView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
startAnimRunnable.run();
|
||||
}
|
||||
toView.post(startAnimRunnable);
|
||||
} else {
|
||||
toView.setTranslationX(0.0f);
|
||||
toView.setTranslationY(0.0f);
|
||||
|
@ -3431,18 +3433,22 @@ public class Launcher extends Activity
|
|||
final View fromView = mAppsCustomizeTabHost;
|
||||
final View toView = mWorkspace;
|
||||
Animator workspaceAnim = null;
|
||||
final ArrayList<View> layerViews = new ArrayList<View>();
|
||||
|
||||
if (toState == Workspace.State.NORMAL) {
|
||||
workspaceAnim = mWorkspace.getChangeStateAnimation(
|
||||
toState, animated);
|
||||
toState, animated, layerViews);
|
||||
} else if (toState == Workspace.State.SPRING_LOADED ||
|
||||
toState == Workspace.State.OVERVIEW) {
|
||||
workspaceAnim = mWorkspace.getChangeStateAnimation(
|
||||
toState, animated);
|
||||
toState, animated, layerViews);
|
||||
}
|
||||
|
||||
showHotseat(animated);
|
||||
if (animated) {
|
||||
mStateAnimation = LauncherAnimUtils.createAnimatorSet();
|
||||
if (workspaceAnim != null) {
|
||||
mStateAnimation.play(workspaceAnim);
|
||||
}
|
||||
|
||||
final AppsCustomizePagedView content = (AppsCustomizePagedView)
|
||||
fromView.findViewById(R.id.apps_customize_pane_content);
|
||||
|
@ -3450,8 +3456,13 @@ public class Launcher extends Activity
|
|||
final View page = content.getPageAt(content.getNextPage());
|
||||
final View revealView = fromView.findViewById(R.id.fake_page);
|
||||
|
||||
// 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.
|
||||
if (fromView.getVisibility() == View.VISIBLE) {
|
||||
AppsCustomizePagedView.ContentType contentType = content.getContentType();
|
||||
final boolean isWidgetTray = contentType == AppsCustomizePagedView.ContentType.Widgets;
|
||||
final boolean isWidgetTray =
|
||||
contentType == AppsCustomizePagedView.ContentType.Widgets;
|
||||
|
||||
if (isWidgetTray) {
|
||||
revealView.setBackground(res.getDrawable(R.drawable.quantum_panel_dark));
|
||||
|
@ -3471,30 +3482,47 @@ public class Launcher extends Activity
|
|||
revealView.setTranslationY(0);
|
||||
int[] allAppsToPanelDelta = Utilities.getCenterDeltaInScreenSpace(revealView,
|
||||
allAppsButton, null);
|
||||
float yDrift = isWidgetTray ? height / 2 : allAppsToPanelDelta[1];
|
||||
float xDrift = isWidgetTray ? 0 : allAppsToPanelDelta[0];
|
||||
|
||||
float xDrift = 0;
|
||||
float yDrift = 0;
|
||||
if (material) {
|
||||
yDrift = isWidgetTray ? height / 2 : allAppsToPanelDelta[1];
|
||||
xDrift = isWidgetTray ? 0 : allAppsToPanelDelta[0];
|
||||
} else {
|
||||
yDrift = 5 * height / 4;
|
||||
xDrift = 0;
|
||||
}
|
||||
|
||||
revealView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
|
||||
TimeInterpolator decelerateInterpolator = material ?
|
||||
new LogDecelerateInterpolator(100, 0) :
|
||||
new LogDecelerateInterpolator(30, 0);
|
||||
|
||||
// The vertical motion of the apps panel should be delayed by one frame
|
||||
// from the conceal animation in order to give the right feel. We correpsondingly
|
||||
// shorten the duration so that the slide and conceal end at the same time.
|
||||
ObjectAnimator panelDriftY = LauncherAnimUtils.ofFloat(revealView, "translationY", 0, yDrift);
|
||||
ObjectAnimator panelDriftY = LauncherAnimUtils.ofFloat(revealView, "translationY",
|
||||
0, yDrift);
|
||||
panelDriftY.setDuration(revealDuration - SINGLE_FRAME_DELAY);
|
||||
panelDriftY.setStartDelay(itemsAlphaStagger + SINGLE_FRAME_DELAY);
|
||||
panelDriftY.setInterpolator(new LogDecelerateInterpolator(100, 0));
|
||||
panelDriftY.setInterpolator(decelerateInterpolator);
|
||||
mStateAnimation.play(panelDriftY);
|
||||
|
||||
ObjectAnimator panelDriftX = LauncherAnimUtils.ofFloat(revealView, "translationX", 0, xDrift);
|
||||
ObjectAnimator panelDriftX = LauncherAnimUtils.ofFloat(revealView, "translationX",
|
||||
0, xDrift);
|
||||
panelDriftX.setDuration(revealDuration - SINGLE_FRAME_DELAY);
|
||||
panelDriftX.setStartDelay(itemsAlphaStagger + SINGLE_FRAME_DELAY);
|
||||
panelDriftX.setInterpolator(new LogDecelerateInterpolator(100, 0));
|
||||
panelDriftX.setInterpolator(decelerateInterpolator);
|
||||
mStateAnimation.play(panelDriftX);
|
||||
|
||||
if (isWidgetTray) {
|
||||
ObjectAnimator panelAlpha = LauncherAnimUtils.ofFloat(revealView, "alpha", 1f, 0.4f);
|
||||
if (isWidgetTray || !material) {
|
||||
float finalAlpha = material ? 0.4f : 0f;
|
||||
revealView.setAlpha(1f);
|
||||
ObjectAnimator panelAlpha = LauncherAnimUtils.ofFloat(revealView, "alpha",
|
||||
1f, finalAlpha);
|
||||
panelAlpha.setDuration(revealDuration);
|
||||
panelAlpha.setInterpolator(new LogDecelerateInterpolator(100, 0));
|
||||
panelAlpha.setInterpolator(material ? decelerateInterpolator :
|
||||
new AccelerateInterpolator(1.5f));
|
||||
mStateAnimation.play(panelAlpha);
|
||||
}
|
||||
|
||||
|
@ -3503,15 +3531,16 @@ public class Launcher extends Activity
|
|||
|
||||
ObjectAnimator pageDrift = LauncherAnimUtils.ofFloat(page, "translationY",
|
||||
0, yDrift);
|
||||
page.setTranslationY(0);
|
||||
pageDrift.setDuration(revealDuration - SINGLE_FRAME_DELAY);
|
||||
pageDrift.setInterpolator(new LogDecelerateInterpolator(100, 0));
|
||||
pageDrift.setInterpolator(decelerateInterpolator);
|
||||
pageDrift.setStartDelay(itemsAlphaStagger + SINGLE_FRAME_DELAY);
|
||||
mStateAnimation.play(pageDrift);
|
||||
|
||||
page.setAlpha(1f);
|
||||
ObjectAnimator itemsAlpha = LauncherAnimUtils.ofFloat(page, "alpha", 1f, 0f);
|
||||
itemsAlpha.setDuration(100);
|
||||
itemsAlpha.setInterpolator(new LogDecelerateInterpolator(100, 0));
|
||||
itemsAlpha.setInterpolator(decelerateInterpolator);
|
||||
mStateAnimation.play(itemsAlpha);
|
||||
}
|
||||
|
||||
|
@ -3554,9 +3583,6 @@ public class Launcher extends Activity
|
|||
dispatchOnLauncherTransitionPrepare(fromView, animated, true);
|
||||
dispatchOnLauncherTransitionPrepare(toView, animated, true);
|
||||
mAppsCustomizeContent.stopScrolling();
|
||||
|
||||
if (workspaceAnim != null) {
|
||||
mStateAnimation.play(workspaceAnim);
|
||||
}
|
||||
|
||||
mStateAnimation.addListener(new AnimatorListenerAdapter() {
|
||||
|
@ -3578,9 +3604,26 @@ public class Launcher extends Activity
|
|||
}
|
||||
});
|
||||
|
||||
dispatchOnLauncherTransitionStart(fromView, animated, true);
|
||||
dispatchOnLauncherTransitionStart(toView, animated, true);
|
||||
LauncherAnimUtils.startAnimationAfterNextDraw(mStateAnimation, toView);
|
||||
final AnimatorSet stateAnimation = mStateAnimation;
|
||||
final Runnable startAnimRunnable = new Runnable() {
|
||||
public void run() {
|
||||
// Check that mStateAnimation hasn't changed while
|
||||
// we waited for a layout/draw pass
|
||||
if (mStateAnimation != stateAnimation)
|
||||
return;
|
||||
dispatchOnLauncherTransitionStart(fromView, animated, false);
|
||||
dispatchOnLauncherTransitionStart(toView, animated, false);
|
||||
|
||||
if (Utilities.isLmp()) {
|
||||
for (int i = 0; i < layerViews.size(); i++) {
|
||||
View v = layerViews.get(i);
|
||||
if (v != null) v.buildLayer();
|
||||
}
|
||||
}
|
||||
mStateAnimation.start();
|
||||
}
|
||||
};
|
||||
fromView.post(startAnimRunnable);
|
||||
} else {
|
||||
fromView.setVisibility(View.GONE);
|
||||
dispatchOnLauncherTransitionPrepare(fromView, animated, true);
|
||||
|
@ -3724,25 +3767,6 @@ public class Launcher extends Activity
|
|||
// TODO
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the hotseat area.
|
||||
*/
|
||||
void showHotseat(boolean animated) {
|
||||
if (!LauncherAppState.getInstance().isScreenLarge()) {
|
||||
if (animated) {
|
||||
if (mHotseat.getAlpha() != 1f) {
|
||||
int duration = 0;
|
||||
if (mSearchDropTargetBar != null) {
|
||||
duration = mSearchDropTargetBar.getTransitionInDuration();
|
||||
}
|
||||
mHotseat.animate().alpha(1f).setDuration(duration);
|
||||
}
|
||||
} else {
|
||||
mHotseat.setAlpha(1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides the hotseat area.
|
||||
*/
|
||||
|
|
|
@ -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<View> 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<View> 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();
|
||||
}
|
||||
|
||||
|
|