When dragging past first or last state, don't reinit target

Example bug:
1. Swipe up to overview and let go
2. Swipe all the way to the top of the screen, past where all apps stops
3. Swipe down

Before this change, you get reset in NORMAL state instead of OVERVIEW.

By ensuring that getTargetState() checks the drag direction before
returning a new state, we guarantee we only re-init in the case that the
state is actually changing. Otherwise it's possible to change the state
to one that is impossible, such as NORMAL when swiping up from ALL APPS.

Change-Id: I19913dded9c94228d06289780b6400e99403f378
This commit is contained in:
Tony Wickham
2018-04-06 14:22:46 -07:00
parent b3ad0edc14
commit 6270a0ea18
4 changed files with 14 additions and 4 deletions

View File

@@ -124,6 +124,10 @@ public abstract class AbstractStateChangeTouchController extends AnimatorListene
return mLauncher.getAllAppsController().getShiftRange();
}
/**
* Returns the state to go to from fromState given the drag direction. If there is no state in
* that direction, returns fromState.
*/
protected abstract LauncherState getTargetState(LauncherState fromState,
boolean isDragTowardPositive);