summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/res/layout/battery_percentage_view.xml2
-rw-r--r--packages/SystemUI/res/layout/keyguard_status_bar.xml5
-rw-r--r--packages/SystemUI/res/layout/system_icons.xml11
-rw-r--r--packages/SystemUI/res/values-sw720dp/dimens.xml9
-rw-r--r--packages/SystemUI/res/values/dimens.xml13
-rw-r--r--packages/SystemUI/src/com/android/systemui/battery/BatteryMeterView.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusIconContainer.java63
9 files changed, 63 insertions, 52 deletions
diff --git a/packages/SystemUI/res/layout/battery_percentage_view.xml b/packages/SystemUI/res/layout/battery_percentage_view.xml
index b9b1bb1f4330..82facd0d7217 100644
--- a/packages/SystemUI/res/layout/battery_percentage_view.xml
+++ b/packages/SystemUI/res/layout/battery_percentage_view.xml
@@ -20,7 +20,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/battery_percentage_view"
android:layout_width="wrap_content"
- android:layout_height="match_parent"
+ android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.StatusBar.Clock"
android:textColor="?android:attr/textColorPrimary"
diff --git a/packages/SystemUI/res/layout/keyguard_status_bar.xml b/packages/SystemUI/res/layout/keyguard_status_bar.xml
index 64c4effece1b..fc0bf242dc1e 100644
--- a/packages/SystemUI/res/layout/keyguard_status_bar.xml
+++ b/packages/SystemUI/res/layout/keyguard_status_bar.xml
@@ -47,7 +47,10 @@
android:layout_height="match_parent"
android:layout_marginEnd="@dimen/status_bar_padding_end"
android:gravity="center_vertical|end">
- <include layout="@layout/system_icons" />
+ <include layout="@layout/system_icons"
+ android:layout_gravity="center_vertical"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
</FrameLayout>
<ImageView android:id="@+id/multi_user_avatar"
diff --git a/packages/SystemUI/res/layout/system_icons.xml b/packages/SystemUI/res/layout/system_icons.xml
index 816dfd35f96d..6a14c213dc82 100644
--- a/packages/SystemUI/res/layout/system_icons.xml
+++ b/packages/SystemUI/res/layout/system_icons.xml
@@ -18,20 +18,23 @@
xmlns:systemui="http://schemas.android.com/apk/res-auto"
android:id="@+id/system_icons"
android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_gravity="center_vertical|end"
+ android:layout_height="wrap_content"
+ android:paddingBottom="@dimen/status_bar_icons_padding_bottom"
+ android:paddingTop="@dimen/status_bar_icons_padding_top"
+ android:paddingStart="@dimen/status_bar_icons_padding_start"
+ android:paddingEnd="@dimen/status_bar_icons_padding_end"
android:gravity="center_vertical">
<com.android.systemui.statusbar.phone.StatusIconContainer android:id="@+id/statusIcons"
android:layout_width="0dp"
android:layout_weight="1"
- android:layout_height="match_parent"
+ android:layout_height="wrap_content"
android:paddingEnd="@dimen/signal_cluster_battery_padding"
android:gravity="center_vertical"
android:orientation="horizontal"/>
<com.android.systemui.battery.BatteryMeterView android:id="@+id/battery"
- android:layout_height="match_parent"
+ android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:clipToPadding="false"
android:clipChildren="false"
diff --git a/packages/SystemUI/res/values-sw720dp/dimens.xml b/packages/SystemUI/res/values-sw720dp/dimens.xml
index 20864591ae5a..d277daefd928 100644
--- a/packages/SystemUI/res/values-sw720dp/dimens.xml
+++ b/packages/SystemUI/res/values-sw720dp/dimens.xml
@@ -16,8 +16,15 @@
*/
-->
<resources>
+ <!-- padding for container with status icons and battery -->
+ <dimen name="status_bar_icons_padding_end">12dp</dimen>
+ <!-- it's a bit smaller on large screen to account for status_bar_icon_horizontal_margin -->
+ <dimen name="status_bar_icons_padding_start">10dp</dimen>
+
+ <dimen name="status_bar_padding_end">0dp</dimen>
+
<!-- gap on either side of status bar notification icons -->
- <dimen name="status_bar_icon_padding">1dp</dimen>
+ <dimen name="status_bar_icon_horizontal_margin">1dp</dimen>
<dimen name="controls_header_horizontal_padding">28dp</dimen>
<dimen name="controls_content_margin_horizontal">40dp</dimen>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index da6417d142d0..3bd7a0664d5a 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -326,8 +326,16 @@
<!-- opacity at which Notification icons will be drawn in the status bar -->
<item type="dimen" name="status_bar_icon_drawing_alpha">90%</item>
+ <!-- paddings for container with status icons and battery -->
+ <!-- padding start is a bit smaller than end to account for status icon margin-->
+ <dimen name="status_bar_icons_padding_start">11dp</dimen>
+
+ <dimen name="status_bar_icons_padding_end">0dp</dimen>
+ <dimen name="status_bar_icons_padding_bottom">8dp</dimen>
+ <dimen name="status_bar_icons_padding_top">8dp</dimen>
+
<!-- gap on either side of status bar notification icons -->
- <dimen name="status_bar_icon_padding">0dp</dimen>
+ <dimen name="status_bar_icon_horizontal_margin">0dp</dimen>
<!-- the padding on the start of the statusbar -->
<dimen name="status_bar_padding_start">8dp</dimen>
@@ -1560,7 +1568,8 @@
<!-- Status bar user chip -->
<dimen name="status_bar_user_chip_avatar_size">16dp</dimen>
- <dimen name="status_bar_user_chip_end_margin">12dp</dimen>
+ <!-- below also works as break between user chip and hover state of status icons -->
+ <dimen name="status_bar_user_chip_end_margin">4dp</dimen>
<dimen name="status_bar_user_chip_text_size">12sp</dimen>
<!-- System UI Dialog -->
diff --git a/packages/SystemUI/src/com/android/systemui/battery/BatteryMeterView.java b/packages/SystemUI/src/com/android/systemui/battery/BatteryMeterView.java
index 263df3357d67..c1238d911ecf 100644
--- a/packages/SystemUI/src/com/android/systemui/battery/BatteryMeterView.java
+++ b/packages/SystemUI/src/com/android/systemui/battery/BatteryMeterView.java
@@ -348,7 +348,7 @@ public class BatteryMeterView extends LinearLayout implements DarkReceiver {
updatePercentText();
addView(mBatteryPercentView, new LayoutParams(
LayoutParams.WRAP_CONTENT,
- LayoutParams.MATCH_PARENT));
+ LayoutParams.WRAP_CONTENT));
}
} else {
if (showing) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
index 313410ac45df..2fd244e1357f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
@@ -240,7 +240,7 @@ public class NotificationIconAreaController implements
private void reloadDimens(Context context) {
Resources res = context.getResources();
mIconSize = res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_icon_size);
- mIconHPadding = res.getDimensionPixelSize(R.dimen.status_bar_icon_padding);
+ mIconHPadding = res.getDimensionPixelSize(R.dimen.status_bar_icon_horizontal_margin);
mAodIconAppearTranslation = res.getDimensionPixelSize(
R.dimen.shelf_appear_translation);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java
index a8a834f1e8f4..b14fe90cd1b3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java
@@ -173,7 +173,7 @@ public interface StatusBarIconController {
*/
class DarkIconManager extends IconManager {
private final DarkIconDispatcher mDarkIconDispatcher;
- private int mIconHPadding;
+ private final int mIconHorizontalMargin;
public DarkIconManager(
LinearLayout linearLayout,
@@ -189,8 +189,8 @@ public interface StatusBarIconController {
wifiUiAdapter,
mobileUiAdapter,
mobileContextProvider);
- mIconHPadding = mContext.getResources().getDimensionPixelSize(
- R.dimen.status_bar_icon_padding);
+ mIconHorizontalMargin = mContext.getResources().getDimensionPixelSize(
+ R.dimen.status_bar_icon_horizontal_margin);
mDarkIconDispatcher = darkIconDispatcher;
}
@@ -205,7 +205,7 @@ public interface StatusBarIconController {
protected LayoutParams onCreateLayoutParams() {
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, mIconSize);
- lp.setMargins(mIconHPadding, 0, mIconHPadding, 0);
+ lp.setMargins(mIconHorizontalMargin, 0, mIconHorizontalMargin, 0);
return lp;
}
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 26c17674ab10..c3322808b2b8 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusIconContainer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusIconContainer.java
@@ -145,8 +145,8 @@ public class StatusIconContainer extends AlphaOptimizedLinearLayout {
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
mMeasureViews.clear();
- int mode = MeasureSpec.getMode(widthMeasureSpec);
- final int width = MeasureSpec.getSize(widthMeasureSpec);
+ int widthMode = MeasureSpec.getMode(widthMeasureSpec);
+ final int specWidth = MeasureSpec.getSize(widthMeasureSpec);
final int count = getChildCount();
// Collect all of the views which want to be laid out
for (int i = 0; i < count; i++) {
@@ -163,7 +163,7 @@ public class StatusIconContainer extends AlphaOptimizedLinearLayout {
boolean trackWidth = true;
// Measure all children so that they report the correct width
- int childWidthSpec = MeasureSpec.makeMeasureSpec(width, MeasureSpec.UNSPECIFIED);
+ int childWidthSpec = MeasureSpec.makeMeasureSpec(specWidth, MeasureSpec.UNSPECIFIED);
mNeedsUnderflow = mShouldRestrictIcons && visibleCount > MAX_ICONS;
for (int i = 0; i < visibleCount; i++) {
// Walking backwards
@@ -182,18 +182,35 @@ public class StatusIconContainer extends AlphaOptimizedLinearLayout {
totalWidth += getViewTotalMeasuredWidth(child) + spacing;
}
}
+ setMeasuredDimension(
+ getMeasuredWidth(widthMode, specWidth, totalWidth),
+ getMeasuredHeight(heightMeasureSpec, mMeasureViews));
+ }
+
+ private int getMeasuredHeight(int heightMeasureSpec, List<View> measuredChildren) {
+ if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.EXACTLY) {
+ return MeasureSpec.getSize(heightMeasureSpec);
+ } else {
+ int highest = 0;
+ for (View child : measuredChildren) {
+ highest = Math.max(child.getMeasuredHeight(), highest);
+ }
+ return highest + getPaddingTop() + getPaddingBottom();
+ }
+ }
- if (mode == MeasureSpec.EXACTLY) {
- if (!mNeedsUnderflow && totalWidth > width) {
+ private int getMeasuredWidth(int widthMode, int specWidth, int totalWidth) {
+ if (widthMode == MeasureSpec.EXACTLY) {
+ if (!mNeedsUnderflow && totalWidth > specWidth) {
mNeedsUnderflow = true;
}
- setMeasuredDimension(width, MeasureSpec.getSize(heightMeasureSpec));
+ return specWidth;
} else {
- if (mode == MeasureSpec.AT_MOST && totalWidth > width) {
+ if (widthMode == MeasureSpec.AT_MOST && totalWidth > specWidth) {
mNeedsUnderflow = true;
- totalWidth = width;
+ totalWidth = specWidth;
}
- setMeasuredDimension(totalWidth, MeasureSpec.getSize(heightMeasureSpec));
+ return totalWidth;
}
}
@@ -280,34 +297,6 @@ public class StatusIconContainer extends AlphaOptimizedLinearLayout {
}
/**
- * Sets the list of ignored icon slots clearing the current list.
- * @param slots names of the icons to ignore
- */
- public void setIgnoredSlots(List<String> slots) {
- mIgnoredSlots.clear();
- addIgnoredSlots(slots);
- }
-
- /**
- * Returns the view corresponding to a particular slot.
- *
- * Use it solely to manipulate how it is presented.
- * @param slot name of the slot to find. Names are defined in
- * {@link com.android.internal.R.config_statusBarIcons}
- * @return a view for the slot if this container has it, else {@code null}
- */
- public View getViewForSlot(String slot) {
- for (int i = 0; i < getChildCount(); i++) {
- View child = getChildAt(i);
- if (child instanceof StatusIconDisplayable
- && ((StatusIconDisplayable) child).getSlot().equals(slot)) {
- return child;
- }
- }
- return null;
- }
-
- /**
* Layout is happening from end -> start
*/
private void calculateIconTranslations() {