Status bar size tweaks

++1dp for Data saver and Hotspot
--1dp for Total silence
>>1dp for Battery lightning bolt

Also implemented keyword "powersave" for `dispatchDemoCommand()` in
BatteryControllerImpl

Test: visual
Bug: 37013523
Change-Id: I027fd18aadeef5c49826c37db9f681c14175a3aa
This commit is contained in:
Evan Laird
2017-05-30 15:03:29 -04:00
parent 98485fc810
commit 706d9684af
6 changed files with 26 additions and 19 deletions

View File

@@ -40,7 +40,7 @@ public class BatteryMeterDrawableBase extends Drawable {
private static final float ASPECT_RATIO = .58f;
public static final String TAG = BatteryMeterDrawableBase.class.getSimpleName();
private static final float RADIUS_RATIO = 1.75f / 17f;
private static final float RADIUS_RATIO = 1.0f / 17f;
protected final Context mContext;
protected final Paint mFramePaint;
@@ -273,9 +273,9 @@ public class BatteryMeterDrawableBase extends Drawable {
// button-frame: area above the battery body
mButtonFrame.set(
mFrame.left + Math.round(width * 0.3f),
mFrame.left + Math.round(width * 0.28f),
mFrame.top,
mFrame.right - Math.round(width * 0.3f),
mFrame.right - Math.round(width * 0.28f),
mFrame.top + buttonHeight);
// frame: battery body area
@@ -302,9 +302,10 @@ public class BatteryMeterDrawableBase extends Drawable {
if (mCharging) {
// define the bolt shape
final float bl = mFrame.left + mFrame.width() / 4f;
// Shift right by 1px for maximal bolt-goodness
final float bl = mFrame.left + mFrame.width() / 4f + 1;
final float bt = mFrame.top + mFrame.height() / 6f;
final float br = mFrame.right - mFrame.width() / 4f;
final float br = mFrame.right - mFrame.width() / 4f + 1;
final float bb = mFrame.bottom - mFrame.height() / 10f;
if (mBoltFrame.left != bl || mBoltFrame.top != bt
|| mBoltFrame.right != br || mBoltFrame.bottom != bb) {

View File

@@ -29,6 +29,7 @@ Command | Subcommand | Argument | Description
```battery``` | | | Control the battery display
| ```level``` | | Sets the battery level (0 - 100)
| ```plugged``` | | Sets charging state (```true```, ```false```)
| ```powersave``` | | Sets power save mode (```true```, ```anything else```)
```network``` | | | Control the RSSI display
| ```airplane``` | | ```show``` to show icon, any other value to hide
| ```fully``` | | Sets MCS state to fully connected (```true```, ```false```)

View File

@@ -20,8 +20,8 @@
android:insetLeft="2.5dp"
android:insetRight="2.5dp" >
<vector
android:width="17dp"
android:height="17dp"
android:width="18dp"
android:height="18dp"
android:viewportWidth="19.0"
android:viewportHeight="19.0">
<group

View File

@@ -20,8 +20,8 @@
android:insetLeft="2.5dp"
android:insetRight="2.5dp" >
<vector
android:width="17dp"
android:height="17dp"
android:width="16dp"
android:height="16dp"
android:viewportWidth="16.6"
android:viewportHeight="16.6">
<group

View File

@@ -17,8 +17,8 @@ Copyright (C) 2017 The Android Open Source Project
android:insetLeft="2.5dp"
android:insetRight="2.5dp">
<vector
android:width="17.0dp"
android:height="17.0dp"
android:width="18.0dp"
android:height="18.0dp"
android:viewportWidth="18.0"
android:viewportHeight="18.0">
<group

View File

@@ -207,14 +207,19 @@ public class BatteryControllerImpl extends BroadcastReceiver implements BatteryC
registerReceiver();
updatePowerSave();
} else if (mDemoMode && command.equals(COMMAND_BATTERY)) {
String level = args.getString("level");
String plugged = args.getString("plugged");
if (level != null) {
mLevel = Math.min(Math.max(Integer.parseInt(level), 0), 100);
}
if (plugged != null) {
mPluggedIn = Boolean.parseBoolean(plugged);
}
String level = args.getString("level");
String plugged = args.getString("plugged");
String powerSave = args.getString("powersave");
if (level != null) {
mLevel = Math.min(Math.max(Integer.parseInt(level), 0), 100);
}
if (plugged != null) {
mPluggedIn = Boolean.parseBoolean(plugged);
}
if (powerSave != null) {
mPowerSave = powerSave.equals("true");
firePowerSaveChanged();
}
fireBatteryLevelChanged();
}
}