Made the bubble bar react to drag events from the Shell.
Added logic to show and hide the bubble bar drop target on Shell drag-and-drop events. Test: Manual. Drag a shortcut or an application icon from the taskbar to the bubble bar drop zone. Observe that if the bubble bar is showing bubbles, the background stroke color becomes non-transparent; if there are no bubbles, the drop zone appears. Drag the app icon to the opposite side and observe that the bubble bar location is animated or the drop zone appears on the dragged side. Drop the application icon or shortcut on any side and observe that a new bubble is added and immediately expanded. Additionally, the bubble bar remains at the drop location. expanded. Bug: 388894910 Flag: com.android.wm.shell.enable_create_any_bubble Change-Id: I581dddf2c76ac982a5c78bc32d94b79bf63fd2b9
This commit is contained in:
1 parent
de35987f27
commit
c7106806f1
5 files changed
+132
-10
No files matched your search
@@ -131,12 +131,13 @@ public class BubbleBarViewController {
|
||||
// Whether the bar is hidden when stashed
|
||||
private boolean mHiddenForStashed;
|
||||
private boolean mShouldShowEducation;
|
||||
|
||||
public boolean mOverflowAdded;
|
||||
private boolean mIsLocationUpdatedForDropTarget = false;
|
||||
|
||||
private BubbleBarViewAnimator mBubbleBarViewAnimator;
|
||||
private final FrameLayout mBubbleBarContainer;
|
||||
private BubbleBarFlyoutController mBubbleBarFlyoutController;
|
||||
private BubbleBarPinController mBubbleBarPinController;
|
||||
private TaskbarSharedState mTaskbarSharedState;
|
||||
private final TimeSource mTimeSource = System::currentTimeMillis;
|
||||
private final int mTaskbarTranslationDelta;
|
||||
@@ -166,6 +167,7 @@ public class BubbleBarViewController {
|
||||
mBubbleStashController = bubbleControllers.bubbleStashController;
|
||||
mBubbleBarController = bubbleControllers.bubbleBarController;
|
||||
mBubbleDragController = bubbleControllers.bubbleDragController;
|
||||
mBubbleBarPinController = bubbleControllers.bubbleBarPinController;
|
||||
mTaskbarStashController = controllers.taskbarStashController;
|
||||
mTaskbarInsetsController = controllers.taskbarInsetsController;
|
||||
mBubbleBarFlyoutController = new BubbleBarFlyoutController(
|
||||
@@ -524,6 +526,61 @@ public class BubbleBarViewController {
|
||||
mBarView.animateToBubbleBarLocation(bubbleBarLocation);
|
||||
}
|
||||
|
||||
/** Returns whether the Bubble Bar is currently displaying a drop target. */
|
||||
public boolean isShowingDropTarget() {
|
||||
return mBarView.isShowingDropTarget();
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies the controller that a drag event is over the Bubble Bar drop zone. The controller
|
||||
* will display the appropriate drop target and enter drop target mode. The controller will also
|
||||
* update the return value of {@link #isLocationUpdatedForDropTarget()} to true if location was
|
||||
* updated.
|
||||
*/
|
||||
public void onDragItemOverBubbleBarDragZone(@NonNull BubbleBarLocation bubbleBarLocation) {
|
||||
mBarView.showDropTarget(/* isDropTarget = */ true);
|
||||
mIsLocationUpdatedForDropTarget = getBubbleBarLocation() != bubbleBarLocation;
|
||||
if (mIsLocationUpdatedForDropTarget) {
|
||||
animateBubbleBarLocation(bubbleBarLocation);
|
||||
}
|
||||
if (!hasBubbles()) {
|
||||
mBubbleBarPinController.showDropTarget(bubbleBarLocation);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if location was updated after most recent
|
||||
* {@link #onDragItemOverBubbleBarDragZone}}.
|
||||
*/
|
||||
public boolean isLocationUpdatedForDropTarget() {
|
||||
return mIsLocationUpdatedForDropTarget;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies the controller that the drag event is outside the Bubble Bar drop zone.
|
||||
* This will hide the drop target zone if there are no bubbles or return the
|
||||
* Bubble Bar to its original location. The controller will also exit drop target
|
||||
* mode and reset the value returned from {@link #isLocationUpdatedForDropTarget()} to false.
|
||||
*/
|
||||
public void onItemDraggedOutsideBubbleBarDropZone() {
|
||||
mBarView.showDropTarget(/* isDropTarget = */ false);
|
||||
if (mIsLocationUpdatedForDropTarget) {
|
||||
animateBubbleBarLocation(getBubbleBarLocation());
|
||||
}
|
||||
mBubbleBarPinController.hideDropTarget();
|
||||
mIsLocationUpdatedForDropTarget = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies the controller that the drag has completed over the Bubble Bar drop zone.
|
||||
* The controller will hide the drop target if there are no bubbles and exit drop target mode.
|
||||
*/
|
||||
public void onItemDroppedInBubbleBarDragZone() {
|
||||
mBarView.showDropTarget(/* isDropTarget = */ false);
|
||||
mBubbleBarPinController.hideDropTarget();
|
||||
mIsLocationUpdatedForDropTarget = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* The bounds of the bubble bar.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user