From 6df0148b07684e9d58a43ca2f10f33ee6f4bf5c6 Mon Sep 17 00:00:00 2001 From: Sreyas Date: Mon, 8 Jun 2020 18:55:52 -0700 Subject: [PATCH] Fix Task Icon menu behavior. Tapping task icon will now show the scrim for rest of thumbnail and not snap to page that is already snapped to. Pressing task icon from clear all will scroll to the page. Bug: 158004853 Change-Id: I79d0a4ac5be3641c6bdf71c34dcbf136ddbbebd1 --- .../android/quickstep/views/RecentsView.java | 6 +++++- .../com/android/quickstep/views/TaskView.java | 17 ++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java index f27bedb8d4..2ca83f33de 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java @@ -607,6 +607,10 @@ public abstract class RecentsView extends PagedView impl } } + public boolean isCenterPageTask() { + return getScrollX() == getScrollForPage(getPageNearestToCenterOfScreen()); + } + @Override protected void onPageBeginTransition() { super.onPageBeginTransition(); @@ -616,7 +620,7 @@ public abstract class RecentsView extends PagedView impl @Override protected void onPageEndTransition() { super.onPageEndTransition(); - if (getScrollX() == getScrollForPage(getPageNearestToCenterOfScreen())) { + if (isCenterPageTask()) { LayoutUtils.setViewEnabled(mActionsView, true); } if (getNextPage() > 0) { diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java index cadf6c4174..5176f2c76c 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java @@ -425,13 +425,16 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { } private boolean showTaskMenu(int action) { - getRecentsView().snapToPage(getRecentsView().indexOfChild(this)); - mMenuView = TaskMenuView.showForTask(this); - mActivity.getStatsLogManager().log(LAUNCHER_TASK_ICON_TAP_OR_LONGPRESS, buildProto()); - UserEventDispatcher.newInstance(getContext()).logActionOnItem(action, Direction.NONE, - LauncherLogProto.ItemType.TASK_ICON); - if (mMenuView != null) { - mMenuView.addOnAttachStateChangeListener(mTaskMenuStateListener); + if (!getRecentsView().isCenterPageTask()) { + getRecentsView().snapToPage(getRecentsView().indexOfChild(this)); + } else { + mMenuView = TaskMenuView.showForTask(this); + mActivity.getStatsLogManager().log(LAUNCHER_TASK_ICON_TAP_OR_LONGPRESS, buildProto()); + UserEventDispatcher.newInstance(getContext()).logActionOnItem(action, Direction.NONE, + LauncherLogProto.ItemType.TASK_ICON); + if (mMenuView != null) { + mMenuView.addOnAttachStateChangeListener(mTaskMenuStateListener); + } } return mMenuView != null; }