resolved conflicts for merge of 0ad33066 to ub-launcher3-master
Change-Id: I5dbbaaf9fb03ed3003174154ea7d7dbae9048a70
This commit is contained in:
commit
2a87fe8c41
9 files changed
+297
-312
No files matched your search
@@ -79,13 +79,6 @@ import java.util.HashMap;
|
||||
*/
|
||||
public class LauncherStateTransitionAnimation {
|
||||
|
||||
/**
|
||||
* Callbacks made during the state transition
|
||||
*/
|
||||
interface Callbacks {
|
||||
public void onStateTransitionHideSearchBar();
|
||||
}
|
||||
|
||||
/**
|
||||
* Private callbacks made during transition setup.
|
||||
*/
|
||||
@@ -111,12 +104,10 @@ public class LauncherStateTransitionAnimation {
|
||||
public static final int SINGLE_FRAME_DELAY = 16;
|
||||
|
||||
@Thunk Launcher mLauncher;
|
||||
@Thunk Callbacks mCb;
|
||||
@Thunk AnimatorSet mStateAnimation;
|
||||
@Thunk AnimatorSet mCurrentAnimation;
|
||||
|
||||
public LauncherStateTransitionAnimation(Launcher l, Callbacks cb) {
|
||||
public LauncherStateTransitionAnimation(Launcher l) {
|
||||
mLauncher = l;
|
||||
mCb = cb;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -125,8 +116,8 @@ public class LauncherStateTransitionAnimation {
|
||||
* @param startSearchAfterTransition Immediately starts app search after the transition to
|
||||
* All Apps is completed.
|
||||
*/
|
||||
public void startAnimationToAllApps(final boolean animated,
|
||||
final boolean startSearchAfterTransition) {
|
||||
public void startAnimationToAllApps(final Workspace.State fromWorkspaceState,
|
||||
final boolean animated, final boolean startSearchAfterTransition) {
|
||||
final AllAppsContainerView toView = mLauncher.getAppsView();
|
||||
final View buttonView = mLauncher.getAllAppsButton();
|
||||
PrivateTransitionCallbacks cb = new PrivateTransitionCallbacks() {
|
||||
@@ -159,15 +150,16 @@ public class LauncherStateTransitionAnimation {
|
||||
}
|
||||
};
|
||||
// Only animate the search bar if animating from spring loaded mode back to all apps
|
||||
startAnimationToOverlay(Workspace.State.NORMAL_HIDDEN, buttonView, toView,
|
||||
toView.getContentView(), toView.getRevealView(), toView.getSearchBarView(),
|
||||
animated, true /* hideSearchBar */, cb);
|
||||
mCurrentAnimation = startAnimationToOverlay(fromWorkspaceState,
|
||||
Workspace.State.NORMAL_HIDDEN, buttonView, toView, toView.getContentView(),
|
||||
toView.getRevealView(), toView.getSearchBarView(), animated, cb);
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts an animation to the widgets view.
|
||||
*/
|
||||
public void startAnimationToWidgets(final boolean animated) {
|
||||
public void startAnimationToWidgets(final Workspace.State fromWorkspaceState,
|
||||
final boolean animated) {
|
||||
final WidgetsContainerView toView = mLauncher.getWidgetsView();
|
||||
final View buttonView = mLauncher.getWidgetsButton();
|
||||
PrivateTransitionCallbacks cb = new PrivateTransitionCallbacks() {
|
||||
@@ -176,17 +168,17 @@ public class LauncherStateTransitionAnimation {
|
||||
return 0.3f;
|
||||
}
|
||||
};
|
||||
startAnimationToOverlay(Workspace.State.OVERVIEW_HIDDEN, buttonView, toView,
|
||||
toView.getContentView(), toView.getRevealView(), null, animated,
|
||||
true /* hideSearchBar */, cb);
|
||||
mCurrentAnimation = startAnimationToOverlay(fromWorkspaceState,
|
||||
Workspace.State.OVERVIEW_HIDDEN, buttonView, toView, toView.getContentView(),
|
||||
toView.getRevealView(), null, animated, cb);
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts and animation to the workspace from the current overlay view.
|
||||
*/
|
||||
public void startAnimationToWorkspace(final Launcher.State fromState,
|
||||
final Workspace.State toWorkspaceState,
|
||||
final boolean animated, final Runnable onCompleteRunnable) {
|
||||
final Workspace.State fromWorkspaceState, final Workspace.State toWorkspaceState,
|
||||
final boolean animated, final Runnable onCompleteRunnable) {
|
||||
if (toWorkspaceState != Workspace.State.NORMAL &&
|
||||
toWorkspaceState != Workspace.State.SPRING_LOADED &&
|
||||
toWorkspaceState != Workspace.State.OVERVIEW) {
|
||||
@@ -194,9 +186,11 @@ public class LauncherStateTransitionAnimation {
|
||||
}
|
||||
|
||||
if (fromState == Launcher.State.APPS || fromState == Launcher.State.APPS_SPRING_LOADED) {
|
||||
startAnimationToWorkspaceFromAllApps(toWorkspaceState, animated, onCompleteRunnable);
|
||||
startAnimationToWorkspaceFromAllApps(fromWorkspaceState, toWorkspaceState,
|
||||
animated, onCompleteRunnable);
|
||||
} else {
|
||||
startAnimationToWorkspaceFromWidgets(toWorkspaceState, animated, onCompleteRunnable);
|
||||
startAnimationToWorkspaceFromWidgets(fromWorkspaceState, toWorkspaceState,
|
||||
animated, onCompleteRunnable);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,10 +198,11 @@ public class LauncherStateTransitionAnimation {
|
||||
* Creates and starts a new animation to a particular overlay view.
|
||||
*/
|
||||
@SuppressLint("NewApi")
|
||||
private void startAnimationToOverlay(final Workspace.State toWorkspaceState,
|
||||
final View buttonView, final View toView, final View contentView, final View revealView,
|
||||
final View overlaySearchBarView, final boolean animated, final boolean hideSearchBar,
|
||||
final PrivateTransitionCallbacks pCb) {
|
||||
private AnimatorSet startAnimationToOverlay(final Workspace.State fromWorkspaceState,
|
||||
final Workspace.State toWorkspaceState, final View buttonView, final View toView,
|
||||
final View contentView, final View revealView, final View overlaySearchBarView,
|
||||
final boolean animated, final PrivateTransitionCallbacks pCb) {
|
||||
final AnimatorSet animation = LauncherAnimUtils.createAnimatorSet();
|
||||
final Resources res = mLauncher.getResources();
|
||||
final boolean material = Utilities.isLmpOrAbove();
|
||||
final int revealDuration = res.getInteger(R.integer.config_overlayRevealTime);
|
||||
@@ -227,11 +222,13 @@ public class LauncherStateTransitionAnimation {
|
||||
// Create the workspace animation.
|
||||
// NOTE: this call apparently also sets the state for the workspace if !animated
|
||||
Animator workspaceAnim = mLauncher.startWorkspaceStateChangeAnimation(toWorkspaceState,
|
||||
animated, overlaySearchBarView != null /* hasOverlaySearchBar */, layerViews);
|
||||
animated, layerViews);
|
||||
|
||||
// Animate the search bar
|
||||
startWorkspaceSearchBarAnimation(animation, fromWorkspaceState, toWorkspaceState,
|
||||
animated ? revealDuration : 0, overlaySearchBarView);
|
||||
|
||||
if (animated && initialized) {
|
||||
mStateAnimation = LauncherAnimUtils.createAnimatorSet();
|
||||
|
||||
// Setup the reveal view animation
|
||||
int width = revealView.getMeasuredWidth();
|
||||
int height = revealView.getMeasuredHeight();
|
||||
@@ -271,7 +268,7 @@ public class LauncherStateTransitionAnimation {
|
||||
|
||||
// Play the animation
|
||||
layerViews.put(revealView, BUILD_AND_SET_LAYER);
|
||||
mStateAnimation.play(panelAlphaAndDrift);
|
||||
animation.play(panelAlphaAndDrift);
|
||||
|
||||
if (overlaySearchBarView != null) {
|
||||
overlaySearchBarView.setAlpha(0f);
|
||||
@@ -279,7 +276,7 @@ public class LauncherStateTransitionAnimation {
|
||||
searchBarAlpha.setDuration(100);
|
||||
searchBarAlpha.setInterpolator(new AccelerateInterpolator(1.5f));
|
||||
layerViews.put(overlaySearchBarView, BUILD_AND_SET_LAYER);
|
||||
mStateAnimation.play(searchBarAlpha);
|
||||
animation.play(searchBarAlpha);
|
||||
}
|
||||
|
||||
// Setup the animation for the content view
|
||||
@@ -294,13 +291,13 @@ public class LauncherStateTransitionAnimation {
|
||||
pageDrift.setDuration(revealDuration);
|
||||
pageDrift.setInterpolator(new LogDecelerateInterpolator(100, 0));
|
||||
pageDrift.setStartDelay(itemsAlphaStagger);
|
||||
mStateAnimation.play(pageDrift);
|
||||
animation.play(pageDrift);
|
||||
|
||||
ObjectAnimator itemsAlpha = ObjectAnimator.ofFloat(contentView, "alpha", 0f, 1f);
|
||||
itemsAlpha.setDuration(revealDuration);
|
||||
itemsAlpha.setInterpolator(new AccelerateInterpolator(1.5f));
|
||||
itemsAlpha.setStartDelay(itemsAlphaStagger);
|
||||
mStateAnimation.play(itemsAlpha);
|
||||
animation.play(itemsAlpha);
|
||||
|
||||
if (material) {
|
||||
float startRadius = pCb.getMaterialRevealViewStartFinalRadius();
|
||||
@@ -313,10 +310,10 @@ public class LauncherStateTransitionAnimation {
|
||||
if (listener != null) {
|
||||
reveal.addListener(listener);
|
||||
}
|
||||
mStateAnimation.play(reveal);
|
||||
animation.play(reveal);
|
||||
}
|
||||
|
||||
mStateAnimation.addListener(new AnimatorListenerAdapter() {
|
||||
animation.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
dispatchOnLauncherTransitionEnd(fromView, animated, false);
|
||||
@@ -332,12 +329,8 @@ public class LauncherStateTransitionAnimation {
|
||||
}
|
||||
}
|
||||
|
||||
if (hideSearchBar) {
|
||||
mCb.onStateTransitionHideSearchBar();
|
||||
}
|
||||
|
||||
// This can hold unnecessary references to views.
|
||||
mStateAnimation = null;
|
||||
cleanupAnimation();
|
||||
pCb.onTransitionComplete();
|
||||
}
|
||||
|
||||
@@ -345,7 +338,7 @@ public class LauncherStateTransitionAnimation {
|
||||
|
||||
// Play the workspace animation
|
||||
if (workspaceAnim != null) {
|
||||
mStateAnimation.play(workspaceAnim);
|
||||
animation.play(workspaceAnim);
|
||||
}
|
||||
|
||||
// Dispatch the prepare transition signal
|
||||
@@ -353,12 +346,12 @@ public class LauncherStateTransitionAnimation {
|
||||
dispatchOnLauncherTransitionPrepare(toView, animated, false);
|
||||
|
||||
|
||||
final AnimatorSet stateAnimation = mStateAnimation;
|
||||
final AnimatorSet stateAnimation = animation;
|
||||
final Runnable startAnimRunnable = new Runnable() {
|
||||
public void run() {
|
||||
// Check that mStateAnimation hasn't changed while
|
||||
// Check that mCurrentAnimation hasn't changed while
|
||||
// we waited for a layout/draw pass
|
||||
if (mStateAnimation != stateAnimation)
|
||||
if (mCurrentAnimation != stateAnimation)
|
||||
return;
|
||||
dispatchOnLauncherTransitionStart(fromView, animated, false);
|
||||
dispatchOnLauncherTransitionStart(toView, animated, false);
|
||||
@@ -377,12 +370,14 @@ public class LauncherStateTransitionAnimation {
|
||||
// Focus the new view
|
||||
toView.requestFocus();
|
||||
|
||||
mStateAnimation.start();
|
||||
stateAnimation.start();
|
||||
}
|
||||
};
|
||||
toView.bringToFront();
|
||||
toView.setVisibility(View.VISIBLE);
|
||||
toView.post(startAnimRunnable);
|
||||
|
||||
return animation;
|
||||
} else {
|
||||
toView.setTranslationX(0.0f);
|
||||
toView.setTranslationY(0.0f);
|
||||
@@ -394,10 +389,6 @@ public class LauncherStateTransitionAnimation {
|
||||
// Show the content view
|
||||
contentView.setVisibility(View.VISIBLE);
|
||||
|
||||
if (hideSearchBar) {
|
||||
mCb.onStateTransitionHideSearchBar();
|
||||
}
|
||||
|
||||
dispatchOnLauncherTransitionPrepare(fromView, animated, false);
|
||||
dispatchOnLauncherTransitionStart(fromView, animated, false);
|
||||
dispatchOnLauncherTransitionEnd(fromView, animated, false);
|
||||
@@ -405,18 +396,19 @@ public class LauncherStateTransitionAnimation {
|
||||
dispatchOnLauncherTransitionStart(toView, animated, false);
|
||||
dispatchOnLauncherTransitionEnd(toView, animated, false);
|
||||
pCb.onTransitionComplete();
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts and animation to the workspace from the apps view.
|
||||
*/
|
||||
private void startAnimationToWorkspaceFromAllApps(final Workspace.State toWorkspaceState,
|
||||
final boolean animated, final Runnable onCompleteRunnable) {
|
||||
private void startAnimationToWorkspaceFromAllApps(final Workspace.State fromWorkspaceState,
|
||||
final Workspace.State toWorkspaceState, final boolean animated,
|
||||
final Runnable onCompleteRunnable) {
|
||||
AllAppsContainerView appsView = mLauncher.getAppsView();
|
||||
PrivateTransitionCallbacks cb = new PrivateTransitionCallbacks() {
|
||||
int[] mAllAppsToPanelDelta;
|
||||
|
||||
@Override
|
||||
float getMaterialRevealViewFinalAlpha(View revealView) {
|
||||
// No alpha anim from all apps
|
||||
@@ -448,16 +440,18 @@ public class LauncherStateTransitionAnimation {
|
||||
}
|
||||
};
|
||||
// Only animate the search bar if animating to spring loaded mode from all apps
|
||||
startAnimationToWorkspaceFromOverlay(toWorkspaceState, mLauncher.getAllAppsButton(),
|
||||
appsView, appsView.getContentView(), appsView.getRevealView(),
|
||||
appsView.getSearchBarView(), animated, onCompleteRunnable, cb);
|
||||
mCurrentAnimation = startAnimationToWorkspaceFromOverlay(fromWorkspaceState, toWorkspaceState,
|
||||
mLauncher.getAllAppsButton(), appsView, appsView.getContentView(),
|
||||
appsView.getRevealView(), appsView.getSearchBarView(), animated,
|
||||
onCompleteRunnable, cb);
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts and animation to the workspace from the widgets view.
|
||||
*/
|
||||
private void startAnimationToWorkspaceFromWidgets(final Workspace.State toWorkspaceState,
|
||||
final boolean animated, final Runnable onCompleteRunnable) {
|
||||
private void startAnimationToWorkspaceFromWidgets(final Workspace.State fromWorkspaceState,
|
||||
final Workspace.State toWorkspaceState, final boolean animated,
|
||||
final Runnable onCompleteRunnable) {
|
||||
final WidgetsContainerView widgetsView = mLauncher.getWidgetsView();
|
||||
PrivateTransitionCallbacks cb = new PrivateTransitionCallbacks() {
|
||||
@Override
|
||||
@@ -475,18 +469,21 @@ public class LauncherStateTransitionAnimation {
|
||||
};
|
||||
}
|
||||
};
|
||||
startAnimationToWorkspaceFromOverlay(toWorkspaceState, mLauncher.getWidgetsButton(),
|
||||
widgetsView, widgetsView.getContentView(), widgetsView.getRevealView(), null,
|
||||
animated, onCompleteRunnable, cb);
|
||||
}
|
||||
mCurrentAnimation = startAnimationToWorkspaceFromOverlay(fromWorkspaceState,
|
||||
toWorkspaceState, mLauncher.getWidgetsButton(), widgetsView,
|
||||
widgetsView.getContentView(), widgetsView.getRevealView(), null, animated,
|
||||
onCompleteRunnable, cb);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and starts a new animation to the workspace.
|
||||
*/
|
||||
private void startAnimationToWorkspaceFromOverlay(final Workspace.State toWorkspaceState,
|
||||
final View buttonView, final View fromView, final View contentView,
|
||||
final View revealView, final View overlaySearchBarView, final boolean animated,
|
||||
final Runnable onCompleteRunnable, final PrivateTransitionCallbacks pCb) {
|
||||
private AnimatorSet startAnimationToWorkspaceFromOverlay(final Workspace.State fromWorkspaceState,
|
||||
final Workspace.State toWorkspaceState, final View buttonView,
|
||||
final View fromView, final View contentView, final View revealView,
|
||||
final View overlaySearchBarView, final boolean animated, final Runnable onCompleteRunnable,
|
||||
final PrivateTransitionCallbacks pCb) {
|
||||
final AnimatorSet animation = LauncherAnimUtils.createAnimatorSet();
|
||||
final Resources res = mLauncher.getResources();
|
||||
final boolean material = Utilities.isLmpOrAbove();
|
||||
final int revealDuration = res.getInteger(R.integer.config_overlayRevealTime);
|
||||
@@ -506,15 +503,16 @@ public class LauncherStateTransitionAnimation {
|
||||
// Create the workspace animation.
|
||||
// NOTE: this call apparently also sets the state for the workspace if !animated
|
||||
Animator workspaceAnim = mLauncher.startWorkspaceStateChangeAnimation(toWorkspaceState,
|
||||
animated, overlaySearchBarView != null /* hasOverlaySearchBar */,
|
||||
layerViews);
|
||||
animated, layerViews);
|
||||
|
||||
// Animate the search bar
|
||||
startWorkspaceSearchBarAnimation(animation, fromWorkspaceState, toWorkspaceState,
|
||||
animated ? revealDuration : 0, overlaySearchBarView);
|
||||
|
||||
if (animated && initialized) {
|
||||
mStateAnimation = LauncherAnimUtils.createAnimatorSet();
|
||||
|
||||
// Play the workspace animation
|
||||
if (workspaceAnim != null) {
|
||||
mStateAnimation.play(workspaceAnim);
|
||||
animation.play(workspaceAnim);
|
||||
}
|
||||
|
||||
// hideAppsCustomizeHelper is called in some cases when it is already hidden
|
||||
@@ -553,14 +551,14 @@ public class LauncherStateTransitionAnimation {
|
||||
panelDriftY.setDuration(revealDuration - SINGLE_FRAME_DELAY);
|
||||
panelDriftY.setStartDelay(itemsAlphaStagger + SINGLE_FRAME_DELAY);
|
||||
panelDriftY.setInterpolator(decelerateInterpolator);
|
||||
mStateAnimation.play(panelDriftY);
|
||||
animation.play(panelDriftY);
|
||||
|
||||
ObjectAnimator panelDriftX = ObjectAnimator.ofFloat(revealView, "translationX",
|
||||
0, revealViewToXDrift);
|
||||
panelDriftX.setDuration(revealDuration - SINGLE_FRAME_DELAY);
|
||||
panelDriftX.setStartDelay(itemsAlphaStagger + SINGLE_FRAME_DELAY);
|
||||
panelDriftX.setInterpolator(decelerateInterpolator);
|
||||
mStateAnimation.play(panelDriftX);
|
||||
animation.play(panelDriftX);
|
||||
|
||||
// Setup animation for the reveal panel alpha
|
||||
final float revealViewToAlpha = !material ? 0f :
|
||||
@@ -571,7 +569,7 @@ public class LauncherStateTransitionAnimation {
|
||||
panelAlpha.setDuration(material ? revealDuration : 150);
|
||||
panelAlpha.setStartDelay(material ? 0 : itemsAlphaStagger + SINGLE_FRAME_DELAY);
|
||||
panelAlpha.setInterpolator(decelerateInterpolator);
|
||||
mStateAnimation.play(panelAlpha);
|
||||
animation.play(panelAlpha);
|
||||
}
|
||||
|
||||
// Setup the animation for the content view
|
||||
@@ -584,13 +582,13 @@ public class LauncherStateTransitionAnimation {
|
||||
pageDrift.setDuration(revealDuration - SINGLE_FRAME_DELAY);
|
||||
pageDrift.setInterpolator(decelerateInterpolator);
|
||||
pageDrift.setStartDelay(itemsAlphaStagger + SINGLE_FRAME_DELAY);
|
||||
mStateAnimation.play(pageDrift);
|
||||
animation.play(pageDrift);
|
||||
|
||||
contentView.setAlpha(1f);
|
||||
ObjectAnimator itemsAlpha = ObjectAnimator.ofFloat(contentView, "alpha", 1f, 0f);
|
||||
itemsAlpha.setDuration(100);
|
||||
itemsAlpha.setInterpolator(decelerateInterpolator);
|
||||
mStateAnimation.play(itemsAlpha);
|
||||
animation.play(itemsAlpha);
|
||||
|
||||
if (overlaySearchBarView != null) {
|
||||
overlaySearchBarView.setAlpha(1f);
|
||||
@@ -599,7 +597,7 @@ public class LauncherStateTransitionAnimation {
|
||||
searchAlpha.setInterpolator(decelerateInterpolator);
|
||||
searchAlpha.setStartDelay(material ? 0 : itemsAlphaStagger + SINGLE_FRAME_DELAY);
|
||||
layerViews.put(overlaySearchBarView, BUILD_AND_SET_LAYER);
|
||||
mStateAnimation.play(searchAlpha);
|
||||
animation.play(searchAlpha);
|
||||
}
|
||||
|
||||
if (material) {
|
||||
@@ -615,14 +613,14 @@ public class LauncherStateTransitionAnimation {
|
||||
if (listener != null) {
|
||||
reveal.addListener(listener);
|
||||
}
|
||||
mStateAnimation.play(reveal);
|
||||
animation.play(reveal);
|
||||
}
|
||||
|
||||
dispatchOnLauncherTransitionPrepare(fromView, animated, true);
|
||||
dispatchOnLauncherTransitionPrepare(toView, animated, true);
|
||||
}
|
||||
|
||||
mStateAnimation.addListener(new AnimatorListenerAdapter() {
|
||||
animation.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
fromView.setVisibility(View.GONE);
|
||||
@@ -652,18 +650,19 @@ public class LauncherStateTransitionAnimation {
|
||||
}
|
||||
|
||||
// This can hold unnecessary references to views.
|
||||
mStateAnimation = null;
|
||||
cleanupAnimation();
|
||||
pCb.onTransitionComplete();
|
||||
}
|
||||
});
|
||||
|
||||
final AnimatorSet stateAnimation = mStateAnimation;
|
||||
final AnimatorSet stateAnimation = animation;
|
||||
final Runnable startAnimRunnable = new Runnable() {
|
||||
public void run() {
|
||||
// Check that mStateAnimation hasn't changed while
|
||||
// Check that mCurrentAnimation hasn't changed while
|
||||
// we waited for a layout/draw pass
|
||||
if (mStateAnimation != stateAnimation)
|
||||
if (mCurrentAnimation != stateAnimation)
|
||||
return;
|
||||
|
||||
dispatchOnLauncherTransitionStart(fromView, animated, false);
|
||||
dispatchOnLauncherTransitionStart(toView, animated, false);
|
||||
|
||||
@@ -677,10 +676,12 @@ public class LauncherStateTransitionAnimation {
|
||||
v.buildLayer();
|
||||
}
|
||||
}
|
||||
mStateAnimation.start();
|
||||
stateAnimation.start();
|
||||
}
|
||||
};
|
||||
fromView.post(startAnimRunnable);
|
||||
|
||||
return animation;
|
||||
} else {
|
||||
fromView.setVisibility(View.GONE);
|
||||
dispatchOnLauncherTransitionPrepare(fromView, animated, true);
|
||||
@@ -695,9 +696,44 @@ public class LauncherStateTransitionAnimation {
|
||||
if (onCompleteRunnable != null) {
|
||||
onCompleteRunnable.run();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Coordinates the workspace search bar animation along with the launcher state animation.
|
||||
*/
|
||||
private void startWorkspaceSearchBarAnimation(AnimatorSet animation,
|
||||
final Workspace.State fromWorkspaceState, final Workspace.State toWorkspaceState, int duration,
|
||||
View overlaySearchBar) {
|
||||
final SearchDropTargetBar.State toSearchBarState =
|
||||
toWorkspaceState.getSearchDropTargetBarState();
|
||||
|
||||
if (overlaySearchBar != null) {
|
||||
if ((toWorkspaceState == Workspace.State.NORMAL) &&
|
||||
(fromWorkspaceState == Workspace.State.NORMAL_HIDDEN)) {
|
||||
// If we are transitioning from the overlay to the workspace, then show the
|
||||
// workspace search bar immediately and let the overlay search bar fade out on top
|
||||
mLauncher.getSearchDropTargetBar().animateToState(toSearchBarState, 0);
|
||||
} else if (fromWorkspaceState == Workspace.State.NORMAL) {
|
||||
// If we are transitioning from the workspace to the overlay, then keep the
|
||||
// workspace search bar visible until the overlay search bar fades in on top
|
||||
animation.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
mLauncher.getSearchDropTargetBar().animateToState(toSearchBarState, 0);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Otherwise, then just animate the workspace search bar normally
|
||||
mLauncher.getSearchDropTargetBar().animateToState(toSearchBarState, duration);
|
||||
}
|
||||
} else {
|
||||
// If there is no overlay search bar, then just animate the workspace search bar
|
||||
mLauncher.getSearchDropTargetBar().animateToState(toSearchBarState, duration);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatches the prepare-transition event to suitable views.
|
||||
@@ -748,10 +784,14 @@ public class LauncherStateTransitionAnimation {
|
||||
* Cancels the current animation.
|
||||
*/
|
||||
private void cancelAnimation() {
|
||||
if (mStateAnimation != null) {
|
||||
mStateAnimation.setDuration(0);
|
||||
mStateAnimation.cancel();
|
||||
mStateAnimation = null;
|
||||
if (mCurrentAnimation != null) {
|
||||
mCurrentAnimation.setDuration(0);
|
||||
mCurrentAnimation.cancel();
|
||||
mCurrentAnimation = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void cleanupAnimation() {
|
||||
mCurrentAnimation = null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user