Updated animation to account bubble bar stash state.
Added logic to check the bubble bar stash state and perform appropriate animations based on that state. Bug: 399678274 Test: Manual: Have bubbles in the bubble bar. Go to an application. Swipe up the taskbar handle so the taskbar is shown. Click the search icon in the taskbar. Start a drag on any icon in the grid. The bubble bar stashes immediately on drag start. When the icon is dragged over the bubble bar drop zone, the bubble bar unstashes and is shown at the dragged location. Flag: com.android.wm.shell.enable_create_any_bubble Change-Id: I9663a03a7daacdfaba071d5e35d5b7404cefed4e
This commit is contained in:
@@ -193,6 +193,7 @@ public class BubbleBarViewController {
|
||||
private boolean mShouldShowEducation;
|
||||
public boolean mOverflowAdded;
|
||||
private boolean mIsLocationUpdatedForDropTarget = false;
|
||||
private boolean mWasStashedBeforeEnteringBubbleDragZone = false;
|
||||
|
||||
private BubbleBarViewAnimator mBubbleBarViewAnimator;
|
||||
private final FrameLayout mBubbleBarContainer;
|
||||
@@ -617,14 +618,30 @@ public class BubbleBarViewController {
|
||||
* updated.
|
||||
*/
|
||||
public void onDragItemOverBubbleBarDragZone(@NonNull BubbleBarLocation bubbleBarLocation) {
|
||||
Log.w("BBAnimation", "onDragItemOverBubbleBarDragZone()");
|
||||
mBarView.showDropTarget(/* isDropTarget = */ true);
|
||||
boolean isRtl = mBarView.isLayoutRtl();
|
||||
mIsLocationUpdatedForDropTarget = getBubbleBarLocation().isOnLeft(isRtl)
|
||||
!= bubbleBarLocation.isOnLeft(isRtl);
|
||||
if (mIsLocationUpdatedForDropTarget) {
|
||||
animateBubbleBarLocation(bubbleBarLocation);
|
||||
}
|
||||
if (!hasBubbles()) {
|
||||
mWasStashedBeforeEnteringBubbleDragZone = hasBubbles()
|
||||
&& mBubbleStashController.isStashed();
|
||||
if (mWasStashedBeforeEnteringBubbleDragZone) {
|
||||
if (mIsLocationUpdatedForDropTarget) {
|
||||
// bubble bar is stashed an location updated
|
||||
//TODO(b/399678274) add animation
|
||||
mBubbleStashController.showBubbleBarImmediate();
|
||||
animateBubbleBarLocation(bubbleBarLocation);
|
||||
} else {
|
||||
// bubble bar is stashed and location the same - just un-stash
|
||||
mBubbleStashController.showBubbleBar(/* expandBubbles = */ false);
|
||||
}
|
||||
} else if (hasBubbles()) {
|
||||
if (mIsLocationUpdatedForDropTarget) {
|
||||
// bubble bar has bubbles and location is changed - animate bar to the opposite side
|
||||
animateBubbleBarLocation(bubbleBarLocation);
|
||||
}
|
||||
} else {
|
||||
// bubble bar has no bubbles flow just show the empty drop target
|
||||
mBubbleBarPinController.showDropTarget(bubbleBarLocation);
|
||||
}
|
||||
}
|
||||
@@ -644,12 +661,27 @@ public class BubbleBarViewController {
|
||||
* mode and reset the value returned from {@link #isLocationUpdatedForDropTarget()} to false.
|
||||
*/
|
||||
public void onItemDraggedOutsideBubbleBarDropZone() {
|
||||
Log.w("BBAnimation", "onItemDraggedOutsideBubbleBarDropZone()");
|
||||
mBarView.showDropTarget(/* isDropTarget = */ false);
|
||||
if (mIsLocationUpdatedForDropTarget) {
|
||||
animateBubbleBarLocation(getBubbleBarLocation());
|
||||
if (mWasStashedBeforeEnteringBubbleDragZone) {
|
||||
if (mIsLocationUpdatedForDropTarget) {
|
||||
// bubble bar was stashed and location updated
|
||||
//TODO(b/399678274) add animation
|
||||
animateBubbleBarLocation(getBubbleBarLocation());
|
||||
mBubbleStashController.stashBubbleBarImmediate();
|
||||
} else {
|
||||
// bubble bar was stashed and location the same - just stash it back
|
||||
mBubbleStashController.stashBubbleBar();
|
||||
}
|
||||
} else if (hasBubbles()) {
|
||||
if (mIsLocationUpdatedForDropTarget) {
|
||||
// bubble bar has bubbles and location was changed - return to the original location
|
||||
animateBubbleBarLocation(getBubbleBarLocation());
|
||||
}
|
||||
}
|
||||
mBubbleBarPinController.hideDropTarget();
|
||||
mIsLocationUpdatedForDropTarget = false;
|
||||
mWasStashedBeforeEnteringBubbleDragZone = false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -657,9 +689,11 @@ public class BubbleBarViewController {
|
||||
* The controller will hide the drop target if there are no bubbles and exit drop target mode.
|
||||
*/
|
||||
public void onItemDroppedInBubbleBarDragZone() {
|
||||
Log.w("BBAnimation", "onItemDroppedInBubbleBarDragZone()");
|
||||
mBarView.showDropTarget(/* isDropTarget = */ false);
|
||||
mBubbleBarPinController.hideDropTarget();
|
||||
mIsLocationUpdatedForDropTarget = false;
|
||||
mWasStashedBeforeEnteringBubbleDragZone = false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user