Don't scroll to home card if overview isn't visible

Consider these steps:
- Swipe up for recents
- Scroll over several cards
- Swipe up for all apps
- Press home

Before this change, there was a delay as recents scrolled back to
the workspace card before going home, even though it wasn't visible.

Change-Id: I1c0edc8e02d1d1d236f47882695903e33e6b09ae
This commit is contained in:
Tony
2018-03-03 05:36:23 -08:00
parent 85f1eed52d
commit 88d70f2abc
2 changed files with 2 additions and 17 deletions

View File

@@ -83,7 +83,8 @@ public class RecentsViewStateController implements StateHandler {
// Scroll to the workspace card before changing to the NORMAL state.
int currPage = mRecentsView.getCurrentPage();
if (toState == NORMAL && currPage != 0 && !config.userControlled) {
LauncherState fromState = mLauncher.getStateManager().getState();
if (fromState.overviewUi && toState == NORMAL && currPage != 0 && !config.userControlled) {
int maxSnapDuration = PagedView.SLOW_PAGE_SNAP_ANIMATION_DURATION;
int durationPerPage = maxSnapDuration / 10;
int snapDuration = Math.min(maxSnapDuration, durationPerPage * currPage);