OSDN Git Service

Fix Battery Usage graph layout for small screens
authorAntony Sargent <asargent@google.com>
Tue, 4 Sep 2018 21:41:21 +0000 (14:41 -0700)
committerAntony Sargent <asargent@google.com>
Wed, 5 Sep 2018 20:53:29 +0000 (13:53 -0700)
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

index a2ceb67..7c21774 100644 (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;