Battery icon is too large

-sync layout from SystemUI

Bug: 141139595
Test: make -j42 RunSettingsRoboTests
Change-Id: I5e165e953682fcfdebf0d06475bb1abd171684d9
This commit is contained in:
timhypeng
2019-11-14 10:53:32 +08:00
parent eb3eb1fdb3
commit c71f996da9
4 changed files with 20 additions and 4 deletions

View File

@@ -182,14 +182,18 @@ public class AdvancedBluetoothDetailsHeaderController extends BasePreferenceCont
Drawable createBtBatteryIcon(Context context, int level, boolean charging) {
final BatteryMeterView.BatteryMeterDrawable drawable =
new BatteryMeterView.BatteryMeterDrawable(context,
context.getColor(R.color.meter_background_color));
context.getColor(R.color.meter_background_color),
context.getResources().getDimensionPixelSize(
R.dimen.advanced_bluetooth_battery_meter_width),
context.getResources().getDimensionPixelSize(
R.dimen.advanced_bluetooth_battery_meter_height));
drawable.setBatteryLevel(level);
final int attr = level > LOW_BATTERY_LEVEL || charging
? android.R.attr.colorControlNormal
: android.R.attr.colorError;
drawable.setColorFilter(new PorterDuffColorFilter(
com.android.settings.Utils.getColorAttrDefaultColor(context, attr),
PorterDuff.Mode.SRC_IN));
PorterDuff.Mode.SRC));
drawable.setCharging(charging);
return drawable;