diff --git a/packages/SystemUI/res/layout/battery_percentage_view.xml b/packages/SystemUI/res/layout/battery_percentage_view.xml index b9b1bb1f4330b..82facd0d7217f 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 64c4effece1b4..fc0bf242dc1e5 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"> - + + + 12dp + + 10dp + + 0dp + - 1dp + 1dp 28dp 40dp diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index da6417d142d08..3bd7a0664d5ab 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -326,8 +326,16 @@ 90% + + + 11dp + + 0dp + 8dp + 8dp + - 0dp + 0dp 8dp @@ -1560,7 +1568,8 @@ 16dp - 12dp + + 4dp 12sp diff --git a/packages/SystemUI/src/com/android/systemui/battery/BatteryMeterView.java b/packages/SystemUI/src/com/android/systemui/battery/BatteryMeterView.java index 263df3357d675..c1238d911ecf4 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 313410ac45dfc..2fd244e1357f1 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 a8a834f1e8f49..b14fe90cd1b3b 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 26c17674ab101..c3322808b2b8d 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)); + } - if (mode == MeasureSpec.EXACTLY) { - if (!mNeedsUnderflow && totalWidth > width) { - mNeedsUnderflow = true; - } - setMeasuredDimension(width, MeasureSpec.getSize(heightMeasureSpec)); + private int getMeasuredHeight(int heightMeasureSpec, List measuredChildren) { + if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.EXACTLY) { + return MeasureSpec.getSize(heightMeasureSpec); } else { - if (mode == MeasureSpec.AT_MOST && totalWidth > width) { - mNeedsUnderflow = true; - totalWidth = width; + int highest = 0; + for (View child : measuredChildren) { + highest = Math.max(child.getMeasuredHeight(), highest); } - setMeasuredDimension(totalWidth, MeasureSpec.getSize(heightMeasureSpec)); + return highest + getPaddingTop() + getPaddingBottom(); + } + } + + private int getMeasuredWidth(int widthMode, int specWidth, int totalWidth) { + if (widthMode == MeasureSpec.EXACTLY) { + if (!mNeedsUnderflow && totalWidth > specWidth) { + mNeedsUnderflow = true; + } + return specWidth; + } else { + if (widthMode == MeasureSpec.AT_MOST && totalWidth > specWidth) { + mNeedsUnderflow = true; + totalWidth = specWidth; + } + return totalWidth; } } @@ -279,34 +296,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 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 */