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
This commit is contained in:
Sreyas
2020-06-08 18:55:52 -07:00
parent 1fdc6ce4f5
commit 6df0148b07
2 changed files with 15 additions and 8 deletions
@@ -607,6 +607,10 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
}
}
public boolean isCenterPageTask() {
return getScrollX() == getScrollForPage(getPageNearestToCenterOfScreen());
}
@Override
protected void onPageBeginTransition() {
super.onPageBeginTransition();
@@ -616,7 +620,7 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
@Override
protected void onPageEndTransition() {
super.onPageEndTransition();
if (getScrollX() == getScrollForPage(getPageNearestToCenterOfScreen())) {
if (isCenterPageTask()) {
LayoutUtils.setViewEnabled(mActionsView, true);
}
if (getNextPage() > 0) {
@@ -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;
}