Skip to content

Commit e3ddac3

Browse files
0xD34DGerrit Code Review
authored andcommitted
SysUI: Adjust battery dimensions for better look
Make some minor tweaks to the new vector based batter meter to get it even closer to stock look. Change-Id: I80fcdefb2578352bef5ca35ad902556b204de322
1 parent b7583ae commit e3ddac3

6 files changed

Lines changed: 14 additions & 12 deletions

File tree

packages/SystemUI/res/drawable/ic_battery_portrait_frame.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@
2727
<path
2828
android:name="frame"
2929
android:fillColor="@color/batterymeter_frame_color"
30-
android:pathData="M19,2v20L5,22V2H19z" />
30+
android:pathData="M19,2v19H5V2H19z" />
3131

3232
</vector>

packages/SystemUI/res/layout/status_bar.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
android:layout_width="wrap_content"
119119
android:layout_height="match_parent"
120120
android:singleLine="true"
121-
android:paddingStart="7dp"
121+
android:paddingStart="3dp"
122122
android:gravity="center_vertical|start"
123123
/>
124124
</com.android.keyguard.AlphaOptimizedLinearLayout>

packages/SystemUI/res/layout/system_icons.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@
3434

3535
<!-- battery must be padded below to match assets -->
3636
<com.android.systemui.BatteryMeterView android:id="@+id/battery"
37-
android:layout_height="19dp"
38-
android:layout_width="19dp"
37+
android:layout_height="18dp"
38+
android:layout_width="18dp"
3939
android:layout_marginBottom="@dimen/battery_margin_bottom"
4040
android:layout_marginStart="@dimen/signal_cluster_battery_padding"/>
4141

4242
<com.android.systemui.DockBatteryMeterView android:id="@+id/dock_battery"
43-
android:layout_height="19dp"
44-
android:layout_width="19dp"
43+
android:layout_height="18dp"
44+
android:layout_width="18dp"
4545
android:layout_marginBottom="@dimen/battery_margin_bottom"
4646
android:layout_marginStart="@dimen/signal_cluster_battery_padding"
4747
android:visibility="gone"/>

packages/SystemUI/res/values/cm_strings.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,9 @@
260260
<string name="play_queue_extention">Show play queue</string>
261261

262262
<!-- Path data for portrait battery -->
263-
<string name="battery_portrait_path_full" translatable="false">M19,22v-20L5,2V22H19z</string>
264-
<string name="battery_portrait_path_empty" translatable="false">M19,22v0.0L5,22V22H19z</string>
265-
<string name="battery_portrait_clip_path" translatable="false">M5,22V4h4V2h6v2h4v18L5,22z</string>
263+
<string name="battery_portrait_path_full" translatable="false">M 5 2 H 19 V 21 H 5 V 2 Z</string>
264+
<string name="battery_portrait_path_empty" translatable="false">M 5 21 H 19 V 21 H 5 V 21 Z</string>
265+
<string name="battery_portrait_clip_path" translatable="false">M6,21V4h3V2h6v2h3v17H6z</string>
266266

267267
<!-- Path data for landscape battery -->
268268
<string name="battery_landscape_path_full" translatable="false">M 1 4 H 25 V 20 H 1 V 4 Z</string>

packages/SystemUI/res/values/dimens.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@
531531
<dimen name="fake_shadow_size">8dp</dimen>
532532

533533
<!-- Padding between signal cluster and battery icon -->
534-
<dimen name="signal_cluster_battery_padding">7dp</dimen>
534+
<dimen name="signal_cluster_battery_padding">3dp</dimen>
535535

536536
<!-- Padding for signal cluster and battery icon when there are not icons in signal cluster -->
537537
<dimen name="no_signal_cluster_battery_padding">3dp</dimen>

packages/SystemUI/src/com/android/systemui/BatteryMeterView.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -676,8 +676,10 @@ private void init() {
676676
if (mWidth <= 0 || mHeight <=0) return;
677677

678678
final float widthDiv2 = mWidth / 2f;
679-
mTextAndBoltPaint.setTextSize(widthDiv2);
680-
mWarningTextPaint.setTextSize(widthDiv2);
679+
// text size is width / 2 - 2dp for wiggle room
680+
final float textSize = widthDiv2 - getResources().getDisplayMetrics().density * 2;
681+
mTextAndBoltPaint.setTextSize(textSize);
682+
mWarningTextPaint.setTextSize(textSize);
681683

682684
int pLeft = getPaddingLeft();
683685
Rect iconBounds = new Rect(pLeft, 0, pLeft + mWidth, mHeight);

0 commit comments

Comments
 (0)