From ef814b81fc8eefdeb8f3fb37ad1f220b9a4330d3 Mon Sep 17 00:00:00 2001 From: Antony Sargent Date: Tue, 4 Sep 2018 14:41:21 -0700 Subject: [PATCH] Fix Battery Usage graph layout for small screens In PowerGaugePreference, if there isn't an icon to show, we were just adding an empty one, which causes space to be reserved and isn't what we want on small screens. Bug: 111318404 Test: visual (set display size to Larger or Largest, and visit Battery page in settings; the "Last full charge" and Screen usage since full charge" items at the bottom should not be indented) Change-Id: I60d39836ab7d50234022a377ff6d97dde8d4c7db --- src/com/android/settings/fuelgauge/PowerGaugePreference.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/fuelgauge/PowerGaugePreference.java b/src/com/android/settings/fuelgauge/PowerGaugePreference.java index a2ceb67cab7..7c217744945 100644 --- a/src/com/android/settings/fuelgauge/PowerGaugePreference.java +++ b/src/com/android/settings/fuelgauge/PowerGaugePreference.java @@ -58,7 +58,9 @@ public class PowerGaugePreference extends AppPreference { private PowerGaugePreference(Context context, AttributeSet attrs, Drawable icon, CharSequence contentDescription, BatteryEntry info) { super(context, attrs); - setIcon(icon != null ? icon : new ColorDrawable(0)); + if (icon != null) { + setIcon(icon); + } setWidgetLayoutResource(R.layout.preference_widget_summary); mInfo = info; mContentDescription = contentDescription;