Taskbar drag starts internal pre-drag before system drag

- TaskbarDragController now extends DragController.
- Currently there is no pre-drag condition, so we immediately get onDragStart(), which starts the system global drag (which cancels the original internal drag).
- Make the original view invisible during the drag and drop operation, across both internal and system drag events.
- No longer handle onDragEvent() in TaskbarView, as TaskbarDragController handles all of it now.

Test: Drag and drop from taskbar still works (bonus: starts from the correct registration point that you touched down on). Locally added a PreDragCondition and verified a seamless handoff to system drag and drop when the pre drag end condition was met.
Bug: 182981908
Change-Id: I6bf48141a5eedfc6db6f461258e880ef8146e733
This commit is contained in:
Tony Wickham
2021-05-24 15:47:38 -07:00
parent c7cbf254f3
commit 8ac277ebd8
10 changed files with 381 additions and 118 deletions
@@ -62,10 +62,11 @@ public class TaskbarIconController {
ButtonProvider buttonProvider = new ButtonProvider(mActivity);
mImeBarView.init(buttonProvider);
mTaskbarView.construct(clickListener, longClickListener, buttonProvider);
mTaskbarView.init(new TaskbarViewCallbacks(), clickListener, longClickListener,
buttonProvider);
mTaskbarView.getLayoutParams().height = mActivity.getDeviceProfile().taskbarSize;
mDragLayer.init(new Callbacks(), mTaskbarView);
mDragLayer.init(new TaskbarDragLayerCallbacks(), mTaskbarView);
}
public void onDestroy() {
@@ -102,7 +103,7 @@ public class TaskbarIconController {
/**
* Callbacks for {@link TaskbarDragLayer} to interact with the icon controller
*/
public class Callbacks {
public class TaskbarDragLayerCallbacks {
/**
* Called to update the touchable insets
@@ -160,4 +161,16 @@ public class TaskbarIconController {
mImeBarView.setVisibility(alpha == 0 ? GONE : VISIBLE);
}
}
/**
* Callbacks for {@link TaskbarView} to interact with the icon controller
*/
public class TaskbarViewCallbacks {
/**
* Returns whether no other controller is currently handling the given View's visibility.
*/
public boolean canUpdateViewVisibility(View child) {
return !mActivity.getDragController().isDraggingView(child);
}
}
}