mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 18:58:19 +00:00
Merge "Show split options when overview actions hidden for grid" into sc-v2-dev
This commit is contained in:
@@ -179,7 +179,7 @@ public abstract class TaskViewTouchController<T extends BaseDraggingActivity>
|
||||
mAllowGoingDown = i == mRecentsView.getCurrentPage()
|
||||
&& SysUINavigationMode.getMode(mActivity).hasGestures
|
||||
&& (!mRecentsView.showAsGrid() || mTaskBeingDragged.isFocusedTask())
|
||||
&& mRecentsView.isTaskSnapped(i);
|
||||
&& mRecentsView.isTaskInExpectedScrollPosition(i);
|
||||
|
||||
directionsToDetectScroll = mAllowGoingDown ? DIRECTION_BOTH : upDirection;
|
||||
break;
|
||||
|
||||
@@ -111,19 +111,30 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Does NOT add split options in the following scenarios:
|
||||
* * The taskView to add split options is already showing split screen tasks
|
||||
* * There aren't at least 2 tasks in overview to show split options for
|
||||
* * The taskView to show split options for is the focused task AND we haven't started
|
||||
* scrolling in overview (if we haven't scrolled, there's a split overview action so
|
||||
* we don't need this menu option)
|
||||
*/
|
||||
private static void addSplitOptions(List<SystemShortcut> outShortcuts,
|
||||
BaseDraggingActivity activity, TaskView taskView, DeviceProfile deviceProfile) {
|
||||
RecentsView recentsView = taskView.getRecentsView();
|
||||
PagedOrientationHandler orientationHandler = recentsView.getPagedOrientationHandler();
|
||||
int[] taskViewTaskIds = taskView.getTaskIds();
|
||||
boolean taskViewHasMultipleTasks = taskViewTaskIds[0] != -1 &&
|
||||
taskViewTaskIds[1] != -1;
|
||||
boolean notEnoughTasksToSplit = taskView.getRecentsView().getTaskViewCount() < 2;
|
||||
boolean notEnoughTasksToSplit = recentsView.getTaskViewCount() < 2;
|
||||
boolean isFocusedTask = deviceProfile.overviewShowAsGrid && taskView.isFocusedTask();
|
||||
boolean isTaskInExpectedScrollPosition =
|
||||
recentsView.isTaskInExpectedScrollPosition(recentsView.indexOfChild(taskView));
|
||||
if (taskViewHasMultipleTasks || notEnoughTasksToSplit ||
|
||||
(deviceProfile.overviewShowAsGrid && taskView.isFocusedTask())) {
|
||||
(isFocusedTask && isTaskInExpectedScrollPosition)) {
|
||||
return;
|
||||
}
|
||||
|
||||
PagedOrientationHandler orientationHandler =
|
||||
taskView.getRecentsView().getPagedOrientationHandler();
|
||||
List<SplitPositionOption> positions =
|
||||
orientationHandler.getSplitPositionOptions(deviceProfile);
|
||||
for (SplitPositionOption option : positions) {
|
||||
|
||||
@@ -1056,11 +1056,11 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the task is snapped.
|
||||
* Returns true if the task is in expected scroll position.
|
||||
*
|
||||
* @param taskIndex the index of the task
|
||||
*/
|
||||
public boolean isTaskSnapped(int taskIndex) {
|
||||
public boolean isTaskInExpectedScrollPosition(int taskIndex) {
|
||||
return getScrollForPage(taskIndex) == getPagedOrientationHandler().getPrimaryScroll(this);
|
||||
}
|
||||
|
||||
@@ -1727,8 +1727,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
if (showAsGrid()) {
|
||||
TaskView focusedTaskView = getFocusedTaskView();
|
||||
hiddenFocusedScroll = focusedTaskView == null
|
||||
|| getScrollForPage(indexOfChild(focusedTaskView))
|
||||
!= mOrientationHandler.getPrimaryScroll(this);
|
||||
|| !isTaskInExpectedScrollPosition(indexOfChild(focusedTaskView));
|
||||
} else {
|
||||
hiddenFocusedScroll = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user