Only detect swipe directions that lead to new states
This cleans up the code and ensures that the current state animation is always initialized when we get drag events. Also log when we pass through states. Bug: 78017680 Change-Id: I54ab42923ed539940ea708973ad65f5793669c11
This commit is contained in:
@@ -11,6 +11,7 @@ import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.touch.AbstractStateChangeTouchController;
|
||||
import com.android.launcher3.touch.SwipeDetector;
|
||||
import com.android.launcher3.userevent.nano.LauncherLogProto;
|
||||
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
|
||||
import com.android.quickstep.RecentsModel;
|
||||
import com.android.quickstep.util.SysuiEventLogger;
|
||||
@@ -38,17 +39,17 @@ public class LandscapeEdgeSwipeController extends AbstractStateChangeTouchContro
|
||||
return mLauncher.isInState(NORMAL) && (ev.getEdgeFlags() & EDGE_NAV_BAR) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getSwipeDirection(MotionEvent ev) {
|
||||
return SwipeDetector.DIRECTION_BOTH;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LauncherState getTargetState(LauncherState fromState, boolean isDragTowardPositive) {
|
||||
boolean draggingFromNav = mLauncher.getDeviceProfile().isSeascape() != isDragTowardPositive;
|
||||
return draggingFromNav ? OVERVIEW : NORMAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLogContainerTypeForNormalState() {
|
||||
return LauncherLogProto.ContainerType.NAVBAR;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getShiftRange() {
|
||||
return mLauncher.getDragLayer().getWidth();
|
||||
|
||||
@@ -24,6 +24,7 @@ import android.view.MotionEvent;
|
||||
import com.android.launcher3.AbstractFloatingView;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.userevent.nano.LauncherLogProto;
|
||||
import com.android.quickstep.TouchInteractionService;
|
||||
import com.android.quickstep.views.RecentsView;
|
||||
|
||||
@@ -72,4 +73,8 @@ public class OverviewToAllAppsTouchController extends PortraitStatesTouchControl
|
||||
return fromState;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLogContainerTypeForNormalState() {
|
||||
return LauncherLogProto.ContainerType.WORKSPACE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,26 +124,6 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getSwipeDirection(MotionEvent ev) {
|
||||
final int directionsToDetectScroll;
|
||||
if (mLauncher.isInState(ALL_APPS)) {
|
||||
directionsToDetectScroll = SwipeDetector.DIRECTION_NEGATIVE;
|
||||
mStartContainerType = ContainerType.ALLAPPS;
|
||||
} else if (mLauncher.isInState(NORMAL)) {
|
||||
directionsToDetectScroll = SwipeDetector.DIRECTION_POSITIVE;
|
||||
mStartContainerType = ContainerType.HOTSEAT;
|
||||
} else if (mLauncher.isInState(OVERVIEW)) {
|
||||
boolean canSwipeDownFromOverview = getTargetState(OVERVIEW, false) != OVERVIEW;
|
||||
directionsToDetectScroll = canSwipeDownFromOverview ? SwipeDetector.DIRECTION_BOTH
|
||||
: SwipeDetector.DIRECTION_POSITIVE;
|
||||
mStartContainerType = ContainerType.TASKSWITCHER;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
return directionsToDetectScroll;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LauncherState getTargetState(LauncherState fromState, boolean isDragTowardPositive) {
|
||||
if (fromState == ALL_APPS && !isDragTowardPositive) {
|
||||
@@ -152,12 +132,17 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr
|
||||
mLauncher.getStateManager().getLastState() : NORMAL;
|
||||
} else if (fromState == OVERVIEW) {
|
||||
return isDragTowardPositive ? ALL_APPS : NORMAL;
|
||||
} else if (isDragTowardPositive) {
|
||||
} else if (fromState == NORMAL && isDragTowardPositive) {
|
||||
return TouchInteractionService.isConnected() ? OVERVIEW : ALL_APPS;
|
||||
}
|
||||
return fromState;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLogContainerTypeForNormalState() {
|
||||
return ContainerType.HOTSEAT;
|
||||
}
|
||||
|
||||
private AnimatorSetBuilder getNormalToOverviewAnimation() {
|
||||
mAllAppsInterpolatorWrapper.baseInterpolator = mAllAppsDampedInterpolator;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user