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
diff --git a/src/com/android/settings/fuelgauge/PowerGaugePreference.java b/src/com/android/settings/fuelgauge/PowerGaugePreference.java
index a2ceb67..7c21774 100644
--- a/src/com/android/settings/fuelgauge/PowerGaugePreference.java
+++ b/src/com/android/settings/fuelgauge/PowerGaugePreference.java
@@ -58,7 +58,9 @@
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;