Call onLauncherTransitionPrepare() and End() from pinch.

This makes the pinch transition more consistent with other transitions.
One immediate benefit of this is that it updates adjacent overview
panels during pinch, regardless of whether they are completely visible.

Previously the adjacent panels' alphas weren't always reset to 0.
Specifically, if you made a small pinch from workspace, which
canceled and went back to workspace, adjacent pages retained a
slightly visible panel.

Bug: 27676309
Change-Id: I7e79fddec31cd649e0811e4524b9a9a501c627f9
This commit is contained in:
Tony Wickham
2016-04-05 18:36:36 -07:00
parent 8f7ead3e94
commit f898b970cc
6 changed files with 48 additions and 44 deletions
+16 -15
View File
@@ -179,18 +179,21 @@ public class Workspace extends PagedView
// in all apps or customize mode)
enum State {
NORMAL (SearchDropTargetBar.State.SEARCH_BAR, false),
NORMAL_HIDDEN (SearchDropTargetBar.State.INVISIBLE_TRANSLATED, false),
SPRING_LOADED (SearchDropTargetBar.State.DROP_TARGET, false),
OVERVIEW (SearchDropTargetBar.State.INVISIBLE, true),
OVERVIEW_HIDDEN (SearchDropTargetBar.State.INVISIBLE, true);
NORMAL (SearchDropTargetBar.State.SEARCH_BAR, false, false),
NORMAL_HIDDEN (SearchDropTargetBar.State.INVISIBLE_TRANSLATED, false, false),
SPRING_LOADED (SearchDropTargetBar.State.DROP_TARGET, false, true),
OVERVIEW (SearchDropTargetBar.State.INVISIBLE, true, true),
OVERVIEW_HIDDEN (SearchDropTargetBar.State.INVISIBLE, true, false);
public final SearchDropTargetBar.State searchDropTargetBarState;
public final boolean shouldUpdateWidget;
public final boolean hasMultipleVisiblePages;
State(SearchDropTargetBar.State searchBarState, boolean shouldUpdateWidget) {
State(SearchDropTargetBar.State searchBarState, boolean shouldUpdateWidget,
boolean hasMultipleVisiblePages) {
searchDropTargetBarState = searchBarState;
this.shouldUpdateWidget = shouldUpdateWidget;
this.hasMultipleVisiblePages = hasMultipleVisiblePages;
}
}
@@ -1838,7 +1841,7 @@ public class Workspace extends PagedView
int end = getChildCount() - 1;
range[0] = Math.max(0, Math.min(start, getChildCount() - 1));
range[1] = Math.max(0, end);
range[1] = Math.max(0, end);
}
public void onStartReordering() {
@@ -1921,11 +1924,6 @@ public class Workspace extends PagedView
// Update the current state
mState = toState;
updateAccessibilityFlags();
if (mState == State.OVERVIEW || mState == State.SPRING_LOADED) {
// Redraw pages, as we might want to draw pages which were not visible.
mForceDrawAdjacentPages = true;
invalidate(); // This will call dispatchDraw(), which calls getVisiblePages().
}
if (shouldNotifyWidgetChange) {
mLauncher.notifyWidgetProvidersChanged();
@@ -1978,12 +1976,15 @@ public class Workspace extends PagedView
}
@Override
public void onLauncherTransitionPrepare(Launcher l, boolean animated, boolean toWorkspace) {
public void onLauncherTransitionPrepare(Launcher l, boolean animated,
boolean multiplePagesVisible) {
mIsSwitchingState = true;
mTransitionProgress = 0;
// Invalidate here to ensure that the pages are rendered during the state change transition.
invalidate();
if (multiplePagesVisible) {
mForceDrawAdjacentPages = true;
}
invalidate(); // This will call dispatchDraw(), which calls getVisiblePages().
updateChildrenLayersEnabled(false);
hideCustomContentIfNecessary();