Add a new bubble at limit while expanded
Handles adding a new bubble and removing an old bubble when the bar is expanded and at the limit. Demo when bar is on right: http://recall/-/bJtug1HhvXkkeA4MQvIaiP/dxhFKrctdR5I2F6Pvho6u8 Demo when bar is on left: http://recall/-/bJtug1HhvXkkeA4MQvIaiP/er4ZGQfg8OKHZ2aTi9OJ9N Flag: com.android.wm.shell.enable_bubble_bar Test: demos Test: atest BubbleViewAnimatorTest Fixes: 345795791 Change-Id: I4e75d61c8afdb81340823a1d77e55b15e3fd6bc0
This commit is contained in:
@@ -25,10 +25,8 @@ import android.graphics.Rect;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -386,7 +384,7 @@ public class BubbleBarViewController {
|
||||
/**
|
||||
* Removes the provided bubble from the bubble bar.
|
||||
*/
|
||||
public void removeBubble(BubbleBarItem b) {
|
||||
public void removeBubble(BubbleBarBubble b) {
|
||||
if (b != null) {
|
||||
mBarView.removeBubble(b.getView());
|
||||
} else {
|
||||
@@ -394,13 +392,23 @@ public class BubbleBarViewController {
|
||||
}
|
||||
}
|
||||
|
||||
/** Adds a new bubble and removes an old bubble at the same time. */
|
||||
public void addBubbleAndRemoveBubble(BubbleBarBubble addedBubble,
|
||||
BubbleBarBubble removedBubble, boolean isExpanding, boolean suppressAnimation) {
|
||||
mBarView.addBubbleAndRemoveBubble(addedBubble.getView(), removedBubble.getView());
|
||||
addedBubble.getView().setOnClickListener(mBubbleClickListener);
|
||||
mBubbleDragController.setupBubbleView(addedBubble.getView());
|
||||
if (!suppressAnimation) {
|
||||
animateBubbleNotification(addedBubble, isExpanding);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the provided bubble to the bubble bar.
|
||||
*/
|
||||
public void addBubble(BubbleBarItem b, boolean isExpanding, boolean suppressAnimation) {
|
||||
if (b != null) {
|
||||
mBarView.addBubble(
|
||||
b.getView(), new FrameLayout.LayoutParams(mIconSize, mIconSize, Gravity.LEFT));
|
||||
mBarView.addBubble(b.getView());
|
||||
b.getView().setOnClickListener(mBubbleClickListener);
|
||||
mBubbleDragController.setupBubbleView(b.getView());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user