Merge "Hide desktop tile when choosing apps for split" into tm-qpr-dev am: 37d6a2be10

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/21656508

Change-Id: I40adcf60f0628e8cf4e0c0d1198da7ad7ce975fd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Ats Jenk
2023-03-03 19:41:48 +00:00
committed by Automerger Merge Worker
2 changed files with 33 additions and 4 deletions
@@ -381,6 +381,7 @@ public class DesktopTaskView extends TaskView {
} }
setOverlayEnabled(false); setOverlayEnabled(false);
onTaskListVisibilityChanged(false); onTaskListVisibilityChanged(false);
setVisibility(VISIBLE);
} }
@Override @Override
@@ -706,6 +706,12 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
private ObjectAnimator mActionsViewAlphaAnimator; private ObjectAnimator mActionsViewAlphaAnimator;
private float mActionsViewAlphaAnimatorFinalValue; private float mActionsViewAlphaAnimatorFinalValue;
/**
* Keeps track of the desktop task. Optional and only present when the feature flag is enabled.
*/
@Nullable
private DesktopTaskView mDesktopTaskView;
private MultiWindowModeChangedListener mMultiWindowModeChangedListener = private MultiWindowModeChangedListener mMultiWindowModeChangedListener =
new MultiWindowModeChangedListener() { new MultiWindowModeChangedListener() {
@Override @Override
@@ -1586,6 +1592,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
// update the map of instance counts // update the map of instance counts
mFilterState.updateInstanceCountMap(taskGroups); mFilterState.updateInstanceCountMap(taskGroups);
// Clear out desktop view if it is set
mDesktopTaskView = null;
DesktopTask desktopTask = null; DesktopTask desktopTask = null;
// Add views as children based on whether it's grouped or single task. Looping through // Add views as children based on whether it's grouped or single task. Looping through
@@ -1644,12 +1652,13 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
if (!taskGroups.isEmpty()) { if (!taskGroups.isEmpty()) {
addView(mClearAllButton); addView(mClearAllButton);
if (DesktopTaskView.DESKTOP_IS_PROTO2_ENABLED) { if (DesktopTaskView.DESKTOP_IS_PROTO2_ENABLED
TaskView taskView = getTaskViewFromPool(TaskView.Type.DESKTOP); && !getSplitSelectController().isSplitSelectActive()) {
mDesktopTaskView = (DesktopTaskView) getTaskViewFromPool(TaskView.Type.DESKTOP);
// Always add a desktop task to the first position. Even if it is empty // Always add a desktop task to the first position. Even if it is empty
addView(taskView, 0); addView(mDesktopTaskView, 0);
ArrayList<Task> tasks = desktopTask != null ? desktopTask.tasks : new ArrayList<>(); ArrayList<Task> tasks = desktopTask != null ? desktopTask.tasks : new ArrayList<>();
((DesktopTaskView) taskView).bind(tasks, mOrientationState); mDesktopTaskView.bind(tasks, mOrientationState);
} }
} }
@@ -2774,6 +2783,10 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
} else if (taskView.isDesktopTask()) { } else if (taskView.isDesktopTask()) {
// Desktop task was not focused. Pin it to the right of focused // Desktop task was not focused. Pin it to the right of focused
desktopTaskIndex = i; desktopTaskIndex = i;
if (taskView.getVisibility() == View.GONE) {
// Desktop task view is hidden, skip it from grid calculations
continue;
}
if (!ENABLE_GRID_ONLY_OVERVIEW.get()) { if (!ENABLE_GRID_ONLY_OVERVIEW.get()) {
// Only apply x-translation when using legacy overview grid // Only apply x-translation when using legacy overview grid
gridTranslations[i] += mIsRtl ? taskWidthAndSpacing : -taskWidthAndSpacing; gridTranslations[i] += mIsRtl ? taskWidthAndSpacing : -taskWidthAndSpacing;
@@ -4467,6 +4480,9 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
mSplitSelectStateController.setAnimateCurrentTaskDismissal( mSplitSelectStateController.setAnimateCurrentTaskDismissal(
true /*animateCurrentTaskDismissal*/); true /*animateCurrentTaskDismissal*/);
mSplitHiddenTaskViewIndex = indexOfChild(taskView); mSplitHiddenTaskViewIndex = indexOfChild(taskView);
if (DesktopTaskView.DESKTOP_IS_PROTO2_ENABLED) {
updateDesktopTaskVisibility(false /* visible */);
}
} }
/** /**
@@ -4483,6 +4499,15 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
mSplitSelectStateController.setInitialTaskSelect(splitSelectSource.intent, mSplitSelectStateController.setInitialTaskSelect(splitSelectSource.intent,
splitSelectSource.position.stagePosition, splitSelectSource.itemInfo, splitSelectSource.position.stagePosition, splitSelectSource.itemInfo,
splitSelectSource.splitEvent, splitSelectSource.alreadyRunningTaskId); splitSelectSource.splitEvent, splitSelectSource.alreadyRunningTaskId);
if (DesktopTaskView.DESKTOP_IS_PROTO2_ENABLED) {
updateDesktopTaskVisibility(false /* visible */);
}
}
private void updateDesktopTaskVisibility(boolean visible) {
if (mDesktopTaskView != null) {
mDesktopTaskView.setVisibility(visible ? VISIBLE : GONE);
}
} }
/** /**
@@ -4633,6 +4658,9 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
mSplitHiddenTaskView.setThumbnailVisibility(VISIBLE); mSplitHiddenTaskView.setThumbnailVisibility(VISIBLE);
mSplitHiddenTaskView = null; mSplitHiddenTaskView = null;
} }
if (DesktopTaskView.DESKTOP_IS_PROTO2_ENABLED) {
updateDesktopTaskVisibility(true /* visible */);
}
} }
private void safeRemoveDragLayerView(@Nullable View viewToRemove) { private void safeRemoveDragLayerView(@Nullable View viewToRemove) {