From 7095854a07499bb4dadfbb42d966d3191ba70283 Mon Sep 17 00:00:00 2001 From: Mady Mellor Date: Tue, 24 Sep 2019 17:12:46 -0700 Subject: [PATCH] Use res value for max bubbles & elevation Test: it compiles Change-Id: I9f4a4f2967f076da4446c82ee1d0fa151784f954 --- .../src/com/android/systemui/bubbles/BubbleController.java | 2 -- .../src/com/android/systemui/bubbles/BubbleStackView.java | 7 +++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java index 72ada6e90cd06..8240345070195 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java @@ -126,8 +126,6 @@ public class BubbleController implements ConfigurationController.ConfigurationLi static final int DISMISS_GROUP_CANCELLED = 9; static final int DISMISS_INVALID_INTENT = 10; - public static final int MAX_BUBBLES = 5; // TODO: actually enforce this - private final Context mContext; private final NotificationEntryManager mNotificationEntryManager; private final BubbleTaskStackListener mTaskStackListener; diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java index 31cf853dce049..340dced1043ff 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java @@ -181,7 +181,9 @@ public class BubbleStackView extends FrameLayout { */ private float mVerticalPosPercentBeforeRotation = -1; + private int mMaxBubbles; private int mBubbleSize; + private int mBubbleElevation; private int mBubblePaddingTop; private int mBubbleTouchPadding; private int mExpandedViewPadding; @@ -326,7 +328,9 @@ public class BubbleStackView extends FrameLayout { mInflater = LayoutInflater.from(context); Resources res = getResources(); + mMaxBubbles = res.getInteger(R.integer.bubbles_max_rendered); mBubbleSize = res.getDimensionPixelSize(R.dimen.individual_bubble_size); + mBubbleElevation = res.getDimensionPixelSize(R.dimen.bubble_elevation); mBubblePaddingTop = res.getDimensionPixelSize(R.dimen.bubble_padding_top); mBubbleTouchPadding = res.getDimensionPixelSize(R.dimen.bubble_touch_padding); mExpandedAnimateXDistance = @@ -1597,8 +1601,7 @@ public class BubbleStackView extends FrameLayout { for (int i = 0; i < bubbleCount; i++) { BubbleView bv = (BubbleView) mBubbleContainer.getChildAt(i); bv.updateDotVisibility(true /* animate */); - bv.setZ((BubbleController.MAX_BUBBLES - * getResources().getDimensionPixelSize(R.dimen.bubble_elevation)) - i); + bv.setZ((mMaxBubbles * mBubbleElevation) - i); // If the dot is on the left, and so is the stack, we need to change the dot position. if (bv.getDotPositionOnLeft() == mStackOnLeftOrWillBe) { bv.setDotPosition(!mStackOnLeftOrWillBe, animate);