summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java42
-rw-r--r--packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java59
2 files changed, 101 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
index b1e22127cd4f..5acf3c24fd6a 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
@@ -216,6 +216,7 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe
}
mBubbleData = data;
+ mBubbleData.setListener(mBubbleDataListener);
mSurfaceSynchronizer = synchronizer;
}
@@ -438,6 +439,47 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe
}
};
+ private final BubbleData.Listener mBubbleDataListener = new BubbleData.Listener() {
+ @Override
+ public void onBubbleAdded(Bubble bubble) {
+
+ }
+
+ @Override
+ public void onBubbleRemoved(Bubble bubble, int reason) {
+
+ }
+
+ public void onBubbleUpdated(Bubble bubble) {
+
+ }
+
+ @Override
+ public void onOrderChanged(List<Bubble> bubbles) {
+
+ }
+
+ @Override
+ public void onSelectionChanged(Bubble selectedBubble) {
+
+ }
+
+ @Override
+ public void onExpandedChanged(boolean expanded) {
+
+ }
+
+ @Override
+ public void showFlyoutText(Bubble bubble, String text) {
+
+ }
+
+ @Override
+ public void apply() {
+
+ }
+ };
+
/**
* Lets any listeners know if bubble state has changed.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java
index 36098352a7ee..cf702870c4ff 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java
@@ -22,6 +22,7 @@ import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import java.util.Collection;
import java.util.HashMap;
+import java.util.List;
import javax.inject.Inject;
import javax.inject.Singleton;
@@ -32,7 +33,61 @@ import javax.inject.Singleton;
@Singleton
public class BubbleData {
+ /**
+ * This interface reports changes to the state and appearance of bubbles which should be applied
+ * as necessary to the UI.
+ * <p>
+ * Each operation is a report of a pending operation. Each should be considered in
+ * combination, when {@link #apply()} is called. For example, both: onExpansionChanged,
+ * and onOrderChanged
+ */
+ interface Listener {
+
+ /**
+ * A new Bubble has been added. A call to {@link #onOrderChanged(List)} will
+ * follow, including the new Bubble in position
+ */
+ void onBubbleAdded(Bubble bubble);
+
+ /**
+ * A Bubble has been removed. A call to {@link #onOrderChanged(List)} will
+ * follow.
+ */
+ void onBubbleRemoved(Bubble bubble, @BubbleController.DismissReason int reason);
+
+ /**
+ * An existing bubble has been updated.
+ *
+ * @param bubble the bubble which was updated
+ */
+ void onBubbleUpdated(Bubble bubble);
+
+ /**
+ * Indicates that one or more bubbles should change position. This may be result of insert,
+ * or removal of a Bubble, in addition to re-sorting existing Bubbles.
+ *
+ * @param bubbles an immutable list of the bubbles in the new order
+ */
+ void onOrderChanged(List<Bubble> bubbles);
+
+ /** Indicates the selected bubble changed. */
+ void onSelectionChanged(Bubble selectedBubble);
+
+ /**
+ * The UI should transition to the given state, incorporating any pending changes during
+ * the animation.
+ */
+ void onExpandedChanged(boolean expanded);
+
+ /** Flyout text should animate in, showing the given text. */
+ void showFlyoutText(Bubble bubble, String text);
+
+ /** Commit any pending operations (since last call of apply()) */
+ void apply();
+ }
+
private HashMap<String, Bubble> mBubbles = new HashMap<>();
+ private Listener mListener;
@VisibleForTesting
@Inject
@@ -69,4 +124,8 @@ public class BubbleData {
public void clear() {
mBubbles.clear();
}
+
+ public void setListener(Listener listener) {
+ mListener = listener;
+ }
}