mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 17:36:49 +00:00
Remove empty desktop tile
Do not show the desktop tile in overview when there are no apps on the desktop. Bug: 270399069 Test: have desktop mode proto 2 enabled, launch an app in fullscreen, open overview, observe no desktop tile Test: move an app to desktop, be on desktop, open overview, observe overview is opened with desktop tile focused Test: have an app on desktop, go home and launch an app in fullscreen, open overview, observe fullscreen app is focused, desktop is peeking in from right Test: have an app on desktop and a fullscreen app in overview, open desktop from overview, close the desktop app, open overview, observe desktop tile is not shown Change-Id: Ia8657d5b260043a630f32b35f2560ea93273d421
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.quickstep.util;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.android.quickstep.views.TaskView;
|
||||
import com.android.systemui.shared.recents.model.Task;
|
||||
|
||||
@@ -27,9 +29,10 @@ import java.util.ArrayList;
|
||||
*/
|
||||
public class DesktopTask extends GroupTask {
|
||||
|
||||
public ArrayList<Task> tasks;
|
||||
@NonNull
|
||||
public final ArrayList<Task> tasks;
|
||||
|
||||
public DesktopTask(ArrayList<Task> tasks) {
|
||||
public DesktopTask(@NonNull ArrayList<Task> tasks) {
|
||||
super(tasks.get(0), null, null, TaskView.Type.DESKTOP);
|
||||
this.tasks = tasks;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,6 @@ public class DesktopTaskView extends TaskView {
|
||||
private final ArrayList<CancellableTask<?>> mPendingThumbnailRequests = new ArrayList<>();
|
||||
|
||||
private View mBackgroundView;
|
||||
private View mEmptyView;
|
||||
|
||||
public DesktopTaskView(Context context) {
|
||||
this(context, null);
|
||||
@@ -111,7 +110,6 @@ public class DesktopTaskView extends TaskView {
|
||||
super.onFinishInflate();
|
||||
|
||||
mBackgroundView = findViewById(R.id.background);
|
||||
mEmptyView = findViewById(R.id.empty_view);
|
||||
|
||||
int topMarginPx =
|
||||
mActivity.getDeviceProfile().overviewTaskThumbnailTopMarginPx;
|
||||
@@ -187,8 +185,6 @@ public class DesktopTaskView extends TaskView {
|
||||
mSnapshotViewMap.put(task.key.id, snapshotView);
|
||||
}
|
||||
|
||||
mEmptyView.setVisibility(mTasks.isEmpty() ? View.VISIBLE : View.GONE);
|
||||
|
||||
updateTaskIdContainer();
|
||||
updateTaskIdAttributeContainer();
|
||||
|
||||
|
||||
@@ -1518,9 +1518,10 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
mMovingTaskView = null;
|
||||
runningTaskView.resetPersistentViewTransforms();
|
||||
int frontTaskIndex = 0;
|
||||
if (DesktopTaskView.DESKTOP_IS_PROTO2_ENABLED && !runningTaskView.isDesktopTask()) {
|
||||
// If desktop mode is enabled, desktop task view is pinned at first position.
|
||||
// Move running task to position 1
|
||||
if (DesktopTaskView.DESKTOP_IS_PROTO2_ENABLED && mDesktopTaskView != null
|
||||
&& !runningTaskView.isDesktopTask()) {
|
||||
// If desktop mode is enabled, desktop task view is pinned at first position if present.
|
||||
// Move running task to position 1.
|
||||
frontTaskIndex = 1;
|
||||
}
|
||||
addView(runningTaskView, frontTaskIndex);
|
||||
@@ -1653,14 +1654,18 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
|
||||
if (!taskGroups.isEmpty()) {
|
||||
addView(mClearAllButton);
|
||||
|
||||
if (DesktopTaskView.DESKTOP_IS_PROTO2_ENABLED
|
||||
&& !getSplitSelectController().isSplitSelectActive()) {
|
||||
mDesktopTaskView = (DesktopTaskView) getTaskViewFromPool(TaskView.Type.DESKTOP);
|
||||
// Always add a desktop task to the first position. Even if it is empty
|
||||
addView(mDesktopTaskView, 0);
|
||||
ArrayList<Task> tasks = desktopTask != null ? desktopTask.tasks : new ArrayList<>();
|
||||
mDesktopTaskView.bind(tasks, mOrientationState);
|
||||
if (DesktopTaskView.DESKTOP_IS_PROTO2_ENABLED) {
|
||||
// Check if we have apps on the desktop
|
||||
if (desktopTask != null && !desktopTask.tasks.isEmpty()) {
|
||||
// If we are actively choosing apps for split, skip the desktop tile
|
||||
if (!getSplitSelectController().isSplitSelectActive()) {
|
||||
mDesktopTaskView = (DesktopTaskView) getTaskViewFromPool(
|
||||
TaskView.Type.DESKTOP);
|
||||
// Always add a desktop task to the first position
|
||||
addView(mDesktopTaskView, 0);
|
||||
mDesktopTaskView.bind(desktopTask.tasks, mOrientationState);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5201,7 +5206,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
}
|
||||
|
||||
private int getFirstViewIndex() {
|
||||
if (DesktopTaskView.DESKTOP_IS_PROTO2_ENABLED) {
|
||||
if (DesktopTaskView.DESKTOP_IS_PROTO2_ENABLED && mDesktopTaskView != null) {
|
||||
// Desktop task is at position 0, that is the first view
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user