diff options
9 files changed, 61 insertions, 5 deletions
diff --git a/quickstep/res/drawable/ic_clear_all.xml b/quickstep/res/drawable/ic_clear_all.xml new file mode 100644 index 0000000000..09a8e06a7b --- /dev/null +++ b/quickstep/res/drawable/ic_clear_all.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2020 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:height="24dp" + android:width="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path android:fillColor="#FF000000" android:pathData="M5,13H19V11H5M3,17H17V15H3M7,7V9H21V7" /> +</vector> diff --git a/quickstep/res/layout/overview_actions_container.xml b/quickstep/res/layout/overview_actions_container.xml index 0fda0bf8d4..35f59dfce3 100644 --- a/quickstep/res/layout/overview_actions_container.xml +++ b/quickstep/res/layout/overview_actions_container.xml @@ -41,6 +41,20 @@ android:theme="@style/ThemeControlHighlightWorkspaceColor" /> <Space + android:layout_width="0dp" + android:layout_height="1dp" + android:layout_weight="1" /> + + <Button + android:id="@+id/action_clear_all" + style="@style/OverviewActionButton" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:drawableStart="@drawable/ic_clear_all" + android:text="@string/recents_clear_all" + android:theme="@style/ThemeControlHighlightWorkspaceColor" /> + + <Space android:id="@+id/action_split_space" android:layout_width="@dimen/overview_actions_button_spacing" android:layout_height="1dp" diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java b/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java index b7330072d4..3e737bb6f3 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java @@ -73,7 +73,6 @@ public class BackgroundAppState extends OverviewState { public int getVisibleElements(Launcher launcher) { return super.getVisibleElements(launcher) & ~OVERVIEW_ACTIONS - & ~CLEAR_ALL_BUTTON & ~VERTICAL_SWIPE_INDICATOR; } diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java index 6f084a1f97..8ffdf176c1 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java @@ -46,7 +46,7 @@ public class OverviewModalTaskState extends OverviewState { @Override public int getVisibleElements(Launcher launcher) { - return OVERVIEW_ACTIONS | CLEAR_ALL_BUTTON; + return OVERVIEW_ACTIONS; } @Override diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java index 08d0a80f03..56cbefc427 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java @@ -88,7 +88,7 @@ public class OverviewState extends LauncherState { @Override public int getVisibleElements(Launcher launcher) { - return CLEAR_ALL_BUTTON | OVERVIEW_ACTIONS; + return OVERVIEW_ACTIONS; } @Override diff --git a/quickstep/src/com/android/quickstep/TaskOverlayFactory.java b/quickstep/src/com/android/quickstep/TaskOverlayFactory.java index 276e1c2a6f..208ba7efc9 100644 --- a/quickstep/src/com/android/quickstep/TaskOverlayFactory.java +++ b/quickstep/src/com/android/quickstep/TaskOverlayFactory.java @@ -249,6 +249,11 @@ public class TaskOverlayFactory implements ResourceBasedOverride { overviewPanel.initiateSplitSelect(mThumbnailView.getTaskView()); } + private void clearAllTasks() { + final RecentsView recentsView = mThumbnailView.getTaskView().getRecentsView(); + recentsView.dismissAllTasks(); + } + /** * Called when the overlay is no longer used. */ @@ -343,13 +348,20 @@ public class TaskOverlayFactory implements ResourceBasedOverride { } @SuppressLint("NewApi") + @Override public void onScreenshot() { endLiveTileMode(() -> saveScreenshot(mTask)); } + @Override public void onSplit() { endLiveTileMode(TaskOverlay.this::enterSplitSelect); } + + @Override + public void onClearAllTasksRequested() { + endLiveTileMode(TaskOverlay.this::clearAllTasks); + } } } @@ -363,5 +375,7 @@ public class TaskOverlayFactory implements ResourceBasedOverride { /** User wants to start split screen with current app. */ void onSplit(); + + void onClearAllTasksRequested(); } } diff --git a/quickstep/src/com/android/quickstep/fallback/RecentsState.java b/quickstep/src/com/android/quickstep/fallback/RecentsState.java index 15feb18367..dcd172170b 100644 --- a/quickstep/src/com/android/quickstep/fallback/RecentsState.java +++ b/quickstep/src/com/android/quickstep/fallback/RecentsState.java @@ -102,7 +102,7 @@ public class RecentsState implements BaseState<RecentsState> { * For this state, whether clear all button should be shown. */ public boolean hasClearAllButton() { - return hasFlag(FLAG_CLEAR_ALL_BUTTON); + return false; } /** diff --git a/quickstep/src/com/android/quickstep/views/OverviewActionsView.java b/quickstep/src/com/android/quickstep/views/OverviewActionsView.java index 029482892d..783f677f5d 100644 --- a/quickstep/src/com/android/quickstep/views/OverviewActionsView.java +++ b/quickstep/src/com/android/quickstep/views/OverviewActionsView.java @@ -115,6 +115,7 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo protected void onFinishInflate() { super.onFinishInflate(); findViewById(R.id.action_screenshot).setOnClickListener(this); + findViewById(R.id.action_clear_all).setOnClickListener(this); mSplitButton = findViewById(R.id.action_split); mSplitButton.setOnClickListener(this); @@ -134,11 +135,13 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo if (mCallbacks == null) { return; } - int id = view.getId(); + final int id = view.getId(); if (id == R.id.action_screenshot) { mCallbacks.onScreenshot(); } else if (id == R.id.action_split) { mCallbacks.onSplit(); + } else if (id == R.id.action_clear_all) { + mCallbacks.onClearAllTasksRequested(); } } diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 02261af499..b646a0ce1c 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -3426,6 +3426,10 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T mActivity.getStatsLogManager().logger().log(LAUNCHER_TASK_CLEAR_ALL); } + public void dismissAllTasks() { + dismissAllTasks(null); + } + private void dismissCurrentTask() { TaskView taskView = getNextPageTaskView(); if (taskView != null) { |