Fix some issues with TwoButtonNavbarTouchController

- Use same swipe height as the tests use to get to Overview
- Use mStartState instead of fromState when determining
  target state, to disallow swiping through states, i.e.
  from NORMAL to OVERVIEW back to NORMAL in one long swipe
  up gesture. Instead, now swipe up from NORMAL goes to
  OVERVIEW and swipe up from OVERVIEW goes to NORMAL.

Fixes: 177316094
Change-Id: Ic8e9c8650d4cf11eec344802e3569413bfd5d7bc
(cherry picked from commit a24b9ff69d)
This commit is contained in:
Tony Wickham
2021-01-26 15:50:23 -08:00
parent 13d5079e90
commit b96cf5cdf2
2 changed files with 10 additions and 8 deletions

View File

@@ -67,8 +67,9 @@ public abstract class AbstractStateChangeTouchController
/**
* Play an atomic recents animation when the progress from NORMAL to OVERVIEW reaches this.
* TODO: Remove the atomic animation altogether and just go to OVERVIEW directly (b/175137718).
*/
public static final float ATOMIC_OVERVIEW_ANIM_THRESHOLD = 0.5f;
public static final float ATOMIC_OVERVIEW_ANIM_THRESHOLD = 1f;
protected final long ATOMIC_DURATION = getAtomicDuration();
protected final Launcher mLauncher;
@@ -342,9 +343,7 @@ public abstract class AbstractStateChangeTouchController
if (!goingBetweenNormalAndOverview(fromState, toState)) {
return;
}
float threshold = toState == OVERVIEW ? ATOMIC_OVERVIEW_ANIM_THRESHOLD
: 1f - ATOMIC_OVERVIEW_ANIM_THRESHOLD;
boolean passedThreshold = progress >= threshold;
boolean passedThreshold = progress >= ATOMIC_OVERVIEW_ANIM_THRESHOLD;
if (passedThreshold != mPassedOverviewAtomicThreshold) {
LauncherState atomicFromState = passedThreshold ? fromState: toState;
LauncherState atomicToState = passedThreshold ? toState : fromState;