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
This commit is contained in:
Antony Sargent
2018-09-04 14:41:21 -07:00
parent d6d4c1681a
commit ef814b81fc

View File

@@ -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;