【mt67xx_11.0】Recent列表里的“全部清除”由左侧移动到下方

修改记录

diff --git a/alps/packages/apps/Launcher3/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java b/alps/packages/apps/Launcher3/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java
index e9614d13516..114c8e87f5e 100644
--- a/alps/packages/apps/Launcher3/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java
+++ b/alps/packages/apps/Launcher3/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java
@@ -165,6 +165,12 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
                 public void onScreenshot() {
                     saveScreenshot(task);
                 }
+
+                @Override
+                public void clearRecentTask() {
+                    mThumbnailView.getTaskView().getRecentsView().dismissAllTasks(mThumbnailView.getTaskView().getRecentsView());
+                }
             });
         }
 
@@ -264,5 +270,7 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
 
         /** User has indicated they want to screenshot the current task. */
         void onScreenshot();
+
+        void clearRecentTask();
     }
 }
diff --git a/alps/packages/apps/Launcher3/quickstep/recents_ui_overrides/src/com/android/quickstep/views/OverviewActionsView.java b/alps/packages/apps/Launcher3/quickstep/recents_ui_overrides/src/com/android/quickstep/views/OverviewActionsView.java
index a2da39855cb..d78ad3c68a0 100644
--- a/alps/packages/apps/Launcher3/quickstep/recents_ui_overrides/src/com/android/quickstep/views/OverviewActionsView.java
+++ b/alps/packages/apps/Launcher3/quickstep/recents_ui_overrides/src/com/android/quickstep/views/OverviewActionsView.java
@@ -111,6 +111,7 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
         View share = findViewById(R.id.action_share);
         share.setOnClickListener(this);
         findViewById(R.id.action_screenshot).setOnClickListener(this);
+        findViewById(R.id.recents_clear_all).setOnClickListener(this);
         if (ENABLE_OVERVIEW_SHARE.get()) {
             share.setVisibility(VISIBLE);
             findViewById(R.id.share_space).setVisibility(VISIBLE);
@@ -136,6 +137,8 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
             mCallbacks.onShare();
         } else if (id == R.id.action_screenshot) {
             mCallbacks.onScreenshot();
+        } else if (id == R.id.recents_clear_all) {
+            mCallbacks.clearRecentTask();
         }
     }
 
@@ -185,7 +188,7 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
         }
         //
         boolean isEnabled = (mDisabledFlags & ~DISABLED_ROTATED) == 0;
-        LayoutUtils.setViewEnabled(this, isEnabled);
+        LayoutUtils.setViewEnabled(this, true);   //让按钮可点击
     }
 
     public AlphaProperty getContentAlpha() {
diff --git a/alps/packages/apps/Launcher3/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/alps/packages/apps/Launcher3/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
index 7b24b03f2b0..925b34e02c5 100644
--- a/alps/packages/apps/Launcher3/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
+++ b/alps/packages/apps/Launcher3/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
@@ -404,6 +404,7 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView
         mClearAllButton = (ClearAllButton) LayoutInflater.from(context)
                 .inflate(R.layout.overview_clear_all_button, this, false);
         mClearAllButton.setOnClickListener(this::dismissAllTasks);
+        mClearAllButton.setVisibility(View.GONE);   //隐藏左侧的“全部清除”按钮
         mTaskViewPool = new ViewPool<>(context, this, R.layout.task, 20 /* max size */,
                 10 /* initial size */);
 
@@ -626,6 +627,9 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView
      * button fully visible, center page is Clear All button.
      */
     public boolean isClearAllHidden() {
+        if (true) {   //加上判断,不然点击图标的时候无法调出“应用信息”和“分屏”功能
+            return true;
+        }
         return mClearAllButton.getAlpha() != 1f;
     }
 
@@ -1549,7 +1560,7 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView
     }
 
     @SuppressWarnings("unused")
-    private void dismissAllTasks(View view) {
+    public void dismissAllTasks(View view) {
         runDismissAnimation(createAllTasksDismissAnimation(DISMISS_TASK_DURATION));
         mActivity.getUserEventDispatcher().logActionOnControl(TAP, CLEAR_ALL_BUTTON);
     }
diff --git a/alps/packages/apps/Launcher3/quickstep/res/layout/overview_actions_container.xml b/alps/packages/apps/Launcher3/quickstep/res/layout/overview_actions_container.xml
index e05688eca33..3bd21c89bf1 100644
--- a/alps/packages/apps/Launcher3/quickstep/res/layout/overview_actions_container.xml
+++ b/alps/packages/apps/Launcher3/quickstep/res/layout/overview_actions_container.xml
@@ -42,6 +42,14 @@
             android:text="@string/action_screenshot"
             android:theme="@style/ThemeControlHighlightWorkspaceColor" />
 
+        <Button
+            android:id="@+id/recents_clear_all"
+            style="@style/OverviewActionButton"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/recents_clear_all"
+            android:theme="@style/ThemeControlHighlightWorkspaceColor" />
+
         <Space
             android:layout_width="0dp"
             android:layout_height="1dp"
diff --git a/alps/vendor/mediatek/proprietary/packages/apps/Launcher3/quickstep/res/layout/overview_actions_container.xml b/alps/vendor/mediatek/proprietary/packages/apps/Launcher3/quickstep/res/layout/overview_actions_container.xml
index e05688eca33..3bd21c89bf1 100644
--- a/alps/vendor/mediatek/proprietary/packages/apps/Launcher3/quickstep/res/layout/overview_actions_container.xml
+++ b/alps/vendor/mediatek/proprietary/packages/apps/Launcher3/quickstep/res/layout/overview_actions_container.xml
@@ -42,6 +42,14 @@
             android:text="@string/action_screenshot"
             android:theme="@style/ThemeControlHighlightWorkspaceColor" />
 
+        <Button
+            android:id="@+id/recents_clear_all"
+            style="@style/OverviewActionButton"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/recents_clear_all"
+            android:theme="@style/ThemeControlHighlightWorkspaceColor" />
+
         <Space
             android:layout_width="0dp"
             android:layout_height="1dp"


重点记录
1.点击已打开的app图标

//packages/apps/Launcher3/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
@Override
protected void onFinishInflate() {
     super.onFinishInflate();
     mSnapshotView = findViewById(R.id.snapshot);
     mIconView = findViewById(R.id.icon);
 }

private void setIcon(Drawable icon) {
   if (icon != null) {
        mIconView.setDrawable(icon);
        mIconView.setOnClickListener(v -> showTaskMenu(Touch.TAP));
        mIconView.setOnLongClickListener(v -> {  //重点部分
            requestDisallowInterceptTouchEvent(true);
            return showTaskMenu(Touch.LONGPRESS);
        });
    } else {
        mIconView.setDrawable(null);
        mIconView.setOnClickListener(null);
        mIconView.setOnLongClickListener(null);
    }
}
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值