Prevent dropping a drag from TaskbarAllApps in Overview

* Don't close TaskbarAllApps once drag starts
(see comment in code regarding needing multiple shared drag
layers)
* Hide app menu split options for taskbar in overview
* One TODO is that the animation needs to be tweaked
because the scale of the icon when it's returned is too large.
* I think maybe we have to change the
TaskbarDragController#mDragIconSize since that gets directly
set from a resource. Unclear.

Test: Dragged in TaskbarAllApps in overivew and in split
select, app returned to original position and not taskbar
Bug: 251747761

Change-Id: I785f34b0bdb0b0abfc440450494074f8dfe7c31a
This commit is contained in:
Vinit Nayak
2022-10-30 16:50:32 -07:00
parent b63cc3f113
commit eae4c99434
4 changed files with 47 additions and 7 deletions

View File

@@ -48,6 +48,8 @@ public final class TaskbarAllAppsController {
private AppInfo[] mApps;
private int mAppsModelFlags;
private List<ItemInfo> mPredictedApps;
private boolean mDisallowGlobalDrag;
private boolean mDisallowLongClick;
/** Initialize the controller. */
public void init(TaskbarControllers controllers, boolean allAppsVisible) {
@@ -78,6 +80,14 @@ public final class TaskbarAllAppsController {
}
}
public void setDisallowGlobalDrag(boolean disableDragForOverviewState) {
mDisallowGlobalDrag = disableDragForOverviewState;
}
public void setDisallowLongClick(boolean disallowLongClick) {
mDisallowLongClick = disallowLongClick;
}
/** Updates the current predictions. */
public void setPredictedApps(List<ItemInfo> predictedApps) {
if (!FeatureFlags.ENABLE_ALL_APPS_IN_TASKBAR.get()) {
@@ -123,6 +133,12 @@ public final class TaskbarAllAppsController {
mAppsView.getFloatingHeaderView()
.findFixedRowByType(PredictionRowView.class)
.setPredictedApps(mPredictedApps);
// 1 alternative that would be more work:
// Create a shared drag layer between taskbar and taskbarAllApps so that when dragging
// starts and taskbarAllApps can close, but the drag layer that the view is being dragged in
// doesn't also close
overlayContext.getDragController().setDisallowGlobalDrag(mDisallowGlobalDrag);
overlayContext.getDragController().setDisallowLongClick(mDisallowLongClick);
}