Fixed split in Desktop windowing
When desktop windowing is enable and split is selected, during second app selection apps' scroll was far off on left. There were several things needed to fix this : 1. Hide DesktopTaskView during split select mode by changing splitAlpha 2. Fix min/max scroll calculation by excluding DesktopTaskView in split select mode 3. Exclude DesktopTaskView in updateGridProperties row length calcualtion Testing: Manually needed to test multiple scenarios 1. Split focused task. 2. Split Even/Odd tasks in top and bottom rows. 3. Split tasks from home screen 4. Split and rotate screen. 5. Split from app icon chip Test: SplitSelectStateControllerTest, Manual BUG: 330342294 FIX: 330342294 Flag: com.android.launcher3.enable_large_desktop_windowing_tile Change-Id: I789873100f42896c9ed3084accb0f6970abcba0c
This commit is contained in:
@@ -3140,7 +3140,7 @@ public abstract class RecentsView<
|
||||
// Horizontal grid translation for each task
|
||||
float[] gridTranslations = new float[taskCount];
|
||||
|
||||
int focusedTaskIndex = Integer.MAX_VALUE;
|
||||
int lastLargeTaskIndex = Integer.MAX_VALUE;
|
||||
Set<Integer> largeTasksIndices = new HashSet<>();
|
||||
int focusedTaskShift = 0;
|
||||
int largeTaskWidthAndSpacing = 0;
|
||||
@@ -3163,8 +3163,12 @@ public abstract class RecentsView<
|
||||
boolean isLargeTile = taskView.isLargeTile();
|
||||
|
||||
if (isLargeTile) {
|
||||
topRowWidth += taskWidthAndSpacing;
|
||||
bottomRowWidth += taskWidthAndSpacing;
|
||||
// DesktopTaskView`s are hidden during split select state, so we shouldn't count
|
||||
// them when calculating row width.
|
||||
if (!(taskView instanceof DesktopTaskView && isSplitSelectionActive())) {
|
||||
topRowWidth += taskWidthAndSpacing;
|
||||
bottomRowWidth += taskWidthAndSpacing;
|
||||
}
|
||||
gridTranslations[i] += focusedTaskShift;
|
||||
gridTranslations[i] += mIsRtl ? taskWidthAndSpacing : -taskWidthAndSpacing;
|
||||
|
||||
@@ -3172,9 +3176,7 @@ public abstract class RecentsView<
|
||||
taskView.setGridTranslationY((mLastComputedTaskSize.height() + taskTopMargin
|
||||
- taskView.getLayoutParams().height) / 2f);
|
||||
|
||||
if (taskView.getTaskViewId() == mFocusedTaskViewId) {
|
||||
focusedTaskIndex = i;
|
||||
}
|
||||
lastLargeTaskIndex = i;
|
||||
largeTasksIndices.add(i);
|
||||
largeTaskWidthAndSpacing = taskWidthAndSpacing;
|
||||
|
||||
@@ -3183,8 +3185,8 @@ public abstract class RecentsView<
|
||||
snappedTaskRowWidth = taskWidthAndSpacing;
|
||||
}
|
||||
} else {
|
||||
if (i > focusedTaskIndex) {
|
||||
// For tasks after the focused task, shift by focused task's width and spacing.
|
||||
if (i > lastLargeTaskIndex) {
|
||||
// For tasks after the last large task, shift by large task's width and spacing.
|
||||
gridTranslations[i] +=
|
||||
mIsRtl ? largeTaskWidthAndSpacing : -largeTaskWidthAndSpacing;
|
||||
} else {
|
||||
@@ -5023,6 +5025,35 @@ public abstract class RecentsView<
|
||||
splitSelectSource.splitEvent, splitSelectSource.alreadyRunningTaskId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Animate DesktopTaskView(s) to hide in split select
|
||||
*/
|
||||
public void handleDesktopTaskInSplitSelectState(PendingAnimation builder,
|
||||
Interpolator deskTopFadeInterPolator) {
|
||||
if (enableLargeDesktopWindowingTile()) {
|
||||
for (TaskView taskView : getTaskViews()) {
|
||||
if (taskView instanceof DesktopTaskView) {
|
||||
builder.addFloat(taskView.getSplitAlphaProperty(),
|
||||
MULTI_PROPERTY_VALUE, 1f, 0f,
|
||||
deskTopFadeInterPolator);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* While exiting from split mode, show all existing DesktopTaskViews.
|
||||
*/
|
||||
public void resetDesktopTaskFromSplitSelectState() {
|
||||
if (enableLargeDesktopWindowingTile()) {
|
||||
for (TaskView taskView : getTaskViews()) {
|
||||
if (taskView instanceof DesktopTaskView) {
|
||||
taskView.setSplitAlpha(1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Modifies a PendingAnimation with the animations for entering split staging
|
||||
*/
|
||||
@@ -5857,11 +5888,12 @@ public abstract class RecentsView<
|
||||
if (mShowAsGridLastOnLayout) {
|
||||
// For grid Overview, it always start if a large tile (focused task or desktop task) if
|
||||
// they exist, otherwise it start with the first task.
|
||||
TaskView firstLargeTaskView = mUtils.getFirstLargeTaskView(getTaskViews());
|
||||
TaskView firstLargeTaskView = mUtils.getFirstLargeTaskView(getTaskViews(),
|
||||
isSplitSelectionActive());
|
||||
if (firstLargeTaskView != null) {
|
||||
firstView = firstLargeTaskView;
|
||||
} else {
|
||||
firstView = getTaskViewAt(0);
|
||||
firstView = mUtils.getFirstSmallTaskView(getTaskViews());
|
||||
}
|
||||
} else {
|
||||
firstView = mUtils.getFirstTaskViewInCarousel(
|
||||
|
||||
Reference in New Issue
Block a user