Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +7 −9 Original line number Diff line number Diff line Loading @@ -170,7 +170,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi private INotificationManager mINotificationManager; // Callback that updates BubbleOverflowActivity on data change. @Nullable private Runnable mOverflowCallback = null; @Nullable private BubbleData.Listener mOverflowListener = null; private final NotificationInterruptStateProvider mNotificationInterruptStateProvider; private IStatusBarService mBarService; Loading Loading @@ -577,8 +577,8 @@ public class BubbleController implements ConfigurationController.ConfigurationLi mInflateSynchronously = inflateSynchronously; } void setOverflowCallback(Runnable updateOverflow) { mOverflowCallback = updateOverflow; void setOverflowListener(BubbleData.Listener listener) { mOverflowListener = listener; } /** Loading Loading @@ -948,8 +948,8 @@ public class BubbleController implements ConfigurationController.ConfigurationLi @Override public void applyUpdate(BubbleData.Update update) { // Update bubbles in overflow. if (mOverflowCallback != null) { mOverflowCallback.run(); if (mOverflowListener != null) { mOverflowListener.applyUpdate(update); } // Collapsing? Do this first before remaining steps. Loading @@ -973,7 +973,8 @@ public class BubbleController implements ConfigurationController.ConfigurationLi if (!mBubbleData.hasOverflowBubbleWithKey(bubble.getKey()) && (!bubble.showInShade() || reason == DISMISS_NOTIF_CANCEL || reason == DISMISS_GROUP_CANCELLED)) { || reason == DISMISS_GROUP_CANCELLED || reason == DISMISS_OVERFLOW_MAX_REACHED)) { // The bubble is now gone & the notification is hidden from the shade, so // time to actually remove it for (NotifCallback cb : mCallbacks) { Loading Loading @@ -1040,9 +1041,6 @@ public class BubbleController implements ConfigurationController.ConfigurationLi Log.d(TAG, BubbleDebugConfig.formatBubblesString(mStackView.getBubblesOnScreen(), mStackView.getExpandedBubble())); } Log.d(TAG, "\n[BubbleData] overflow:"); Log.d(TAG, BubbleDebugConfig.formatBubblesString(mBubbleData.getOverflowBubbles(), null) + "\n"); } } }; Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java +11 −3 Original line number Diff line number Diff line Loading @@ -74,6 +74,8 @@ public class BubbleData { @Nullable Bubble selectedBubble; @Nullable Bubble addedBubble; @Nullable Bubble updatedBubble; @Nullable Bubble addedOverflowBubble; @Nullable Bubble removedOverflowBubble; // Pair with Bubble and @DismissReason Integer final List<Pair<Bubble, Integer>> removedBubbles = new ArrayList<>(); Loading @@ -92,6 +94,8 @@ public class BubbleData { || addedBubble != null || updatedBubble != null || !removedBubbles.isEmpty() || addedOverflowBubble != null || removedOverflowBubble != null || orderChanged; } Loading Loading @@ -233,6 +237,7 @@ public class BubbleData { private void moveOverflowBubbleToPending(Bubble b) { mOverflowBubbles.remove(b); mStateChange.removedOverflowBubble = b; mPendingBubbles.add(b); } Loading Loading @@ -440,8 +445,9 @@ public class BubbleData { if (DEBUG_BUBBLE_DATA) { Log.d(TAG, "Cancel overflow bubble: " + b); } mStateChange.bubbleRemoved(b, reason); mOverflowBubbles.remove(b); mStateChange.bubbleRemoved(b, reason); mStateChange.removedOverflowBubble = b; } return; } Loading Loading @@ -482,6 +488,7 @@ public class BubbleData { Log.d(TAG, "Overflowing: " + bubble); } mOverflowBubbles.add(0, bubble); mStateChange.addedOverflowBubble = bubble; bubble.stopInflation(); if (mOverflowBubbles.size() == mMaxOverflowBubbles + 1) { // Remove oldest bubble. Loading @@ -489,8 +496,9 @@ public class BubbleData { if (DEBUG_BUBBLE_DATA) { Log.d(TAG, "Overflow full. Remove: " + oldest); } mStateChange.bubbleRemoved(oldest, BubbleController.DISMISS_OVERFLOW_MAX_REACHED); mOverflowBubbles.remove(oldest); mStateChange.removedOverflowBubble = oldest; mStateChange.bubbleRemoved(oldest, BubbleController.DISMISS_OVERFLOW_MAX_REACHED); } } Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleOverflowActivity.java +45 −18 Original line number Diff line number Diff line Loading @@ -106,11 +106,12 @@ public class BubbleOverflowActivity extends Activity { mAdapter = new BubbleOverflowAdapter(mOverflowBubbles, mBubbleController::promoteBubbleFromOverflow, viewWidth, viewHeight); mRecyclerView.setAdapter(mAdapter); onDataChanged(mBubbleController.getOverflowBubbles()); mBubbleController.setOverflowCallback(() -> { onDataChanged(mBubbleController.getOverflowBubbles()); }); onThemeChanged(); mOverflowBubbles.addAll(mBubbleController.getOverflowBubbles()); mAdapter.notifyDataSetChanged(); setEmptyStateVisibility(); mBubbleController.setOverflowListener(mDataListener); } /** Loading @@ -137,6 +138,14 @@ public class BubbleOverflowActivity extends Activity { } } void setEmptyStateVisibility() { if (mOverflowBubbles.isEmpty()) { mEmptyState.setVisibility(View.VISIBLE); } else { mEmptyState.setVisibility(View.GONE); } } void setBackgroundColor() { final TypedArray ta = getApplicationContext().obtainStyledAttributes( new int[]{android.R.attr.colorBackgroundFloating}); Loading @@ -145,22 +154,40 @@ public class BubbleOverflowActivity extends Activity { findViewById(android.R.id.content).setBackgroundColor(bgColor); } void onDataChanged(List<Bubble> bubbles) { mOverflowBubbles.clear(); mOverflowBubbles.addAll(bubbles); mAdapter.notifyDataSetChanged(); private final BubbleData.Listener mDataListener = new BubbleData.Listener() { if (mOverflowBubbles.isEmpty()) { mEmptyState.setVisibility(View.VISIBLE); } else { mEmptyState.setVisibility(View.GONE); @Override public void applyUpdate(BubbleData.Update update) { Bubble toRemove = update.removedOverflowBubble; if (toRemove != null) { if (DEBUG_OVERFLOW) { Log.d(TAG, "remove: " + toRemove); } toRemove.cleanupViews(); int i = mOverflowBubbles.indexOf(toRemove); mOverflowBubbles.remove(toRemove); mAdapter.notifyItemRemoved(i); } Bubble toAdd = update.addedOverflowBubble; if (toAdd != null) { if (DEBUG_OVERFLOW) { Log.d(TAG, "add: " + toAdd); } mOverflowBubbles.add(0, toAdd); mAdapter.notifyItemInserted(0); } setEmptyStateVisibility(); if (DEBUG_OVERFLOW) { Log.d(TAG, "Updated overflow bubbles:\n" + BubbleDebugConfig.formatBubblesString( mOverflowBubbles, /*selected*/ null)); Log.d(TAG, BubbleDebugConfig.formatBubblesString( mBubbleController.getOverflowBubbles(), null)); } } }; @Override public void onStart() { Loading Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +7 −9 Original line number Diff line number Diff line Loading @@ -170,7 +170,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi private INotificationManager mINotificationManager; // Callback that updates BubbleOverflowActivity on data change. @Nullable private Runnable mOverflowCallback = null; @Nullable private BubbleData.Listener mOverflowListener = null; private final NotificationInterruptStateProvider mNotificationInterruptStateProvider; private IStatusBarService mBarService; Loading Loading @@ -577,8 +577,8 @@ public class BubbleController implements ConfigurationController.ConfigurationLi mInflateSynchronously = inflateSynchronously; } void setOverflowCallback(Runnable updateOverflow) { mOverflowCallback = updateOverflow; void setOverflowListener(BubbleData.Listener listener) { mOverflowListener = listener; } /** Loading Loading @@ -948,8 +948,8 @@ public class BubbleController implements ConfigurationController.ConfigurationLi @Override public void applyUpdate(BubbleData.Update update) { // Update bubbles in overflow. if (mOverflowCallback != null) { mOverflowCallback.run(); if (mOverflowListener != null) { mOverflowListener.applyUpdate(update); } // Collapsing? Do this first before remaining steps. Loading @@ -973,7 +973,8 @@ public class BubbleController implements ConfigurationController.ConfigurationLi if (!mBubbleData.hasOverflowBubbleWithKey(bubble.getKey()) && (!bubble.showInShade() || reason == DISMISS_NOTIF_CANCEL || reason == DISMISS_GROUP_CANCELLED)) { || reason == DISMISS_GROUP_CANCELLED || reason == DISMISS_OVERFLOW_MAX_REACHED)) { // The bubble is now gone & the notification is hidden from the shade, so // time to actually remove it for (NotifCallback cb : mCallbacks) { Loading Loading @@ -1040,9 +1041,6 @@ public class BubbleController implements ConfigurationController.ConfigurationLi Log.d(TAG, BubbleDebugConfig.formatBubblesString(mStackView.getBubblesOnScreen(), mStackView.getExpandedBubble())); } Log.d(TAG, "\n[BubbleData] overflow:"); Log.d(TAG, BubbleDebugConfig.formatBubblesString(mBubbleData.getOverflowBubbles(), null) + "\n"); } } }; Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java +11 −3 Original line number Diff line number Diff line Loading @@ -74,6 +74,8 @@ public class BubbleData { @Nullable Bubble selectedBubble; @Nullable Bubble addedBubble; @Nullable Bubble updatedBubble; @Nullable Bubble addedOverflowBubble; @Nullable Bubble removedOverflowBubble; // Pair with Bubble and @DismissReason Integer final List<Pair<Bubble, Integer>> removedBubbles = new ArrayList<>(); Loading @@ -92,6 +94,8 @@ public class BubbleData { || addedBubble != null || updatedBubble != null || !removedBubbles.isEmpty() || addedOverflowBubble != null || removedOverflowBubble != null || orderChanged; } Loading Loading @@ -233,6 +237,7 @@ public class BubbleData { private void moveOverflowBubbleToPending(Bubble b) { mOverflowBubbles.remove(b); mStateChange.removedOverflowBubble = b; mPendingBubbles.add(b); } Loading Loading @@ -440,8 +445,9 @@ public class BubbleData { if (DEBUG_BUBBLE_DATA) { Log.d(TAG, "Cancel overflow bubble: " + b); } mStateChange.bubbleRemoved(b, reason); mOverflowBubbles.remove(b); mStateChange.bubbleRemoved(b, reason); mStateChange.removedOverflowBubble = b; } return; } Loading Loading @@ -482,6 +488,7 @@ public class BubbleData { Log.d(TAG, "Overflowing: " + bubble); } mOverflowBubbles.add(0, bubble); mStateChange.addedOverflowBubble = bubble; bubble.stopInflation(); if (mOverflowBubbles.size() == mMaxOverflowBubbles + 1) { // Remove oldest bubble. Loading @@ -489,8 +496,9 @@ public class BubbleData { if (DEBUG_BUBBLE_DATA) { Log.d(TAG, "Overflow full. Remove: " + oldest); } mStateChange.bubbleRemoved(oldest, BubbleController.DISMISS_OVERFLOW_MAX_REACHED); mOverflowBubbles.remove(oldest); mStateChange.removedOverflowBubble = oldest; mStateChange.bubbleRemoved(oldest, BubbleController.DISMISS_OVERFLOW_MAX_REACHED); } } Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleOverflowActivity.java +45 −18 Original line number Diff line number Diff line Loading @@ -106,11 +106,12 @@ public class BubbleOverflowActivity extends Activity { mAdapter = new BubbleOverflowAdapter(mOverflowBubbles, mBubbleController::promoteBubbleFromOverflow, viewWidth, viewHeight); mRecyclerView.setAdapter(mAdapter); onDataChanged(mBubbleController.getOverflowBubbles()); mBubbleController.setOverflowCallback(() -> { onDataChanged(mBubbleController.getOverflowBubbles()); }); onThemeChanged(); mOverflowBubbles.addAll(mBubbleController.getOverflowBubbles()); mAdapter.notifyDataSetChanged(); setEmptyStateVisibility(); mBubbleController.setOverflowListener(mDataListener); } /** Loading @@ -137,6 +138,14 @@ public class BubbleOverflowActivity extends Activity { } } void setEmptyStateVisibility() { if (mOverflowBubbles.isEmpty()) { mEmptyState.setVisibility(View.VISIBLE); } else { mEmptyState.setVisibility(View.GONE); } } void setBackgroundColor() { final TypedArray ta = getApplicationContext().obtainStyledAttributes( new int[]{android.R.attr.colorBackgroundFloating}); Loading @@ -145,22 +154,40 @@ public class BubbleOverflowActivity extends Activity { findViewById(android.R.id.content).setBackgroundColor(bgColor); } void onDataChanged(List<Bubble> bubbles) { mOverflowBubbles.clear(); mOverflowBubbles.addAll(bubbles); mAdapter.notifyDataSetChanged(); private final BubbleData.Listener mDataListener = new BubbleData.Listener() { if (mOverflowBubbles.isEmpty()) { mEmptyState.setVisibility(View.VISIBLE); } else { mEmptyState.setVisibility(View.GONE); @Override public void applyUpdate(BubbleData.Update update) { Bubble toRemove = update.removedOverflowBubble; if (toRemove != null) { if (DEBUG_OVERFLOW) { Log.d(TAG, "remove: " + toRemove); } toRemove.cleanupViews(); int i = mOverflowBubbles.indexOf(toRemove); mOverflowBubbles.remove(toRemove); mAdapter.notifyItemRemoved(i); } Bubble toAdd = update.addedOverflowBubble; if (toAdd != null) { if (DEBUG_OVERFLOW) { Log.d(TAG, "add: " + toAdd); } mOverflowBubbles.add(0, toAdd); mAdapter.notifyItemInserted(0); } setEmptyStateVisibility(); if (DEBUG_OVERFLOW) { Log.d(TAG, "Updated overflow bubbles:\n" + BubbleDebugConfig.formatBubblesString( mOverflowBubbles, /*selected*/ null)); Log.d(TAG, BubbleDebugConfig.formatBubblesString( mBubbleController.getOverflowBubbles(), null)); } } }; @Override public void onStart() { Loading