Allow mobile status bar icon to overflow
With display size set to larest, a wide notch emulated, and battery
percentage showing, it's possible to not be able to fit a single status
icon other than the battery. In this case, the mobile icon needs to
overflow into the etc area.
Some other changes:
- set View.INVISIBLE instead of View.GONE when hiding the mobile view so
that it correctly reports its width on measure
- Don't subtract padding from width when laying out StatusIconContainer
Test: visual
Change-Id: Ic8e73402a3371331dd4c803f3c4559da276ba0a2
Fixes: 78149953
Fixes: 77504032
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusIconContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusIconContainer.java
index 4538977..0811179 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusIconContainer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusIconContainer.java
@@ -49,7 +49,7 @@
private static final String TAG = "StatusIconContainer";
private static final boolean DEBUG = false;
private static final boolean DEBUG_OVERFLOW = false;
- // Max 5 status icons including battery
+ // Max 8 status icons including battery
private static final int MAX_ICONS = 7;
private static final int MAX_DOTS = 1;
@@ -152,7 +152,7 @@
int visibleCount = mMeasureViews.size();
int maxVisible = visibleCount <= MAX_ICONS ? MAX_ICONS : MAX_ICONS - 1;
- int totalWidth = getPaddingStart() + getPaddingEnd();
+ int totalWidth = mPaddingLeft + mPaddingRight;
boolean trackWidth = true;
// Measure all children so that they report the correct width
@@ -208,8 +208,8 @@
*/
private void calculateIconTranslations() {
mLayoutStates.clear();
- float width = getWidth() - getPaddingEnd();
- float translationX = width;
+ float width = getWidth();
+ float translationX = width - getPaddingEnd();
float contentStart = getPaddingStart();
int childCount = getChildCount();
// Underflow === don't show content until that index
@@ -344,10 +344,11 @@
animate = true;
}
- icon.setVisibleState(visibleState);
if (animate) {
animateTo(view, animationProperties);
+ icon.setVisibleState(visibleState);
} else {
+ icon.setVisibleState(visibleState);
super.applyToView(view);
}