From 05ea3f89da0b9a6aefdc23419456619068316077 Mon Sep 17 00:00:00 2001 From: Lyn Han Date: Wed, 5 Feb 2020 17:53:08 -0800 Subject: [PATCH 1/2] Empty overflow UI Bug: 148879187 Bug: 149146374 Test: manual -> bubbles < 5, click into overflow: text shows Test: manual -> bubbles > 5, click into overflow: overflow bubbles show Test: atest SystemUITests Change-Id: Ia5fa3517b0e793952684f573b9a0436bfd15246c --- .../res/layout/bubble_overflow_activity.xml | 45 +++++++++++++++++-- packages/SystemUI/res/values/strings.xml | 6 +++ .../bubbles/BubbleOverflowActivity.java | 17 +++++-- 3 files changed, 61 insertions(+), 7 deletions(-) diff --git a/packages/SystemUI/res/layout/bubble_overflow_activity.xml b/packages/SystemUI/res/layout/bubble_overflow_activity.xml index 95f205a1be348..481c4dbe3bf18 100644 --- a/packages/SystemUI/res/layout/bubble_overflow_activity.xml +++ b/packages/SystemUI/res/layout/bubble_overflow_activity.xml @@ -14,8 +14,45 @@ ~ limitations under the License --> - + android:layout_height="match_parent" + android:orientation="vertical" + android:layout_gravity="center_horizontal"> + + + + + + + + + + diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index b85b51e4f2cc0..efe683e01a5a1 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -1774,6 +1774,12 @@ Keeps your attention with a floating shortcut to this content. + + No recent bubbles + + + Recently dismissed bubbles will appear here for easy retrieval. + These notifications can\'t be modified. diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleOverflowActivity.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleOverflowActivity.java index bea55c820b40b..8fd3665ff9885 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleOverflowActivity.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleOverflowActivity.java @@ -26,7 +26,10 @@ import android.graphics.Color; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; +import android.view.View; import android.view.ViewGroup; +import android.widget.LinearLayout; +import android.widget.TextView; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -46,6 +49,7 @@ import javax.inject.Inject; public class BubbleOverflowActivity extends Activity { private static final String TAG = TAG_WITH_CLASS_NAME ? "BubbleOverflowActivity" : TAG_BUBBLES; + private LinearLayout mEmptyState; private BubbleController mBubbleController; private BubbleOverflowAdapter mAdapter; private RecyclerView mRecyclerView; @@ -64,6 +68,7 @@ public class BubbleOverflowActivity extends Activity { setBackgroundColor(); mMaxBubbles = getResources().getInteger(R.integer.bubbles_max_rendered); + mEmptyState = findViewById(R.id.bubble_overflow_empty_state); mRecyclerView = findViewById(R.id.bubble_overflow_recycler); mRecyclerView.setLayoutManager( new GridLayoutManager(getApplicationContext(), @@ -73,9 +78,9 @@ public class BubbleOverflowActivity extends Activity { mBubbleController::promoteBubbleFromOverflow); mRecyclerView.setAdapter(mAdapter); - updateData(mBubbleController.getOverflowBubbles()); + onDataChanged(mBubbleController.getOverflowBubbles()); mBubbleController.setOverflowCallback(() -> { - updateData(mBubbleController.getOverflowBubbles()); + onDataChanged(mBubbleController.getOverflowBubbles()); }); } @@ -87,7 +92,7 @@ public class BubbleOverflowActivity extends Activity { findViewById(android.R.id.content).setBackgroundColor(bgColor); } - void updateData(List bubbles) { + void onDataChanged(List bubbles) { mOverflowBubbles.clear(); if (bubbles.size() > mMaxBubbles) { mOverflowBubbles.addAll(bubbles.subList(mMaxBubbles, bubbles.size())); @@ -96,6 +101,12 @@ public class BubbleOverflowActivity extends Activity { } mAdapter.notifyDataSetChanged(); + if (mOverflowBubbles.isEmpty()) { + mEmptyState.setVisibility(View.VISIBLE); + } else { + mEmptyState.setVisibility(View.GONE); + } + if (DEBUG_OVERFLOW) { Log.d(TAG, "Updated overflow bubbles:\n" + BubbleDebugConfig.formatBubblesString( mOverflowBubbles, /*selected*/ null)); From edb55e25b77c066da78787c3b36d1f310b42d599 Mon Sep 17 00:00:00 2001 From: Lyn Han Date: Wed, 12 Feb 2020 18:55:39 -0800 Subject: [PATCH 2/2] Update overflow button on theme change Bug: 149146374 Fixes: 149176394 Test: change theme - overflow button changes with theme Test: atest SystemUITests Change-Id: I04d5e59f0451cac2010519477770add46aa727ee --- .../android/systemui/bubbles/BubbleExpandedView.java | 3 ++- .../com/android/systemui/bubbles/BubbleStackView.java | 11 +++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java index 0d5261dcb7f33..fe191f40d31fb 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java @@ -294,7 +294,8 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList ta.recycle(); mPointerDrawable.setTint(bgColor); - if (ScreenDecorationsUtils.supportsRoundedCornersOnWindows(mContext.getResources())) { + if (mActivityView != null && ScreenDecorationsUtils.supportsRoundedCornersOnWindows( + mContext.getResources())) { mActivityView.setCornerRadius(cornerRadius); } } diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java index bce172b891872..557d1bb0ae52d 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java @@ -528,6 +528,12 @@ public class BubbleStackView extends FrameLayout { mBubbleContainer.addView(mOverflowBtn, 0, new FrameLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT)); + setOverflowBtnTheme(); + mOverflowBtn.setVisibility(GONE); + } + + // TODO(b/149146374) Propagate theme change to bubbles in overflow. + private void setOverflowBtnTheme() { TypedArray ta = mContext.obtainStyledAttributes( new int[]{android.R.attr.colorBackgroundFloating}); int bgColor = ta.getColor(0, Color.WHITE /* default */); @@ -537,8 +543,6 @@ public class BubbleStackView extends FrameLayout { ColorDrawable bg = new ColorDrawable(bgColor); AdaptiveIconDrawable adaptiveIcon = new AdaptiveIconDrawable(bg, fg); mOverflowBtn.setImageDrawable(adaptiveIcon); - - mOverflowBtn.setVisibility(GONE); } void showExpandedViewContents(int displayId) { @@ -568,6 +572,9 @@ public class BubbleStackView extends FrameLayout { */ public void onThemeChanged() { setUpFlyout(); + if (BubbleExperimentConfig.allowBubbleOverflow(mContext)) { + setOverflowBtnTheme(); + } } /** Respond to the phone being rotated by repositioning the stack and hiding any flyouts. */