Reuse the BluetoothBatteryDrawable in QS detail
BluetoothBatteryDrawable creates the drawable lazily using
the latest(and most correct) context. So it could get the
correct color from the theme.
Also add iconScale field in BluetoothBatteryDrawable so the size
of the battery icon could be scaled.
Bug: 67377756
Test: Manual - connected to bluetooth headphone and open the qs
page and detail page. Retest it after changing it to dark theme.
Change-Id: Ic6c871985a89a503221755eed4bc2605ab53f630
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java b/packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java
index b4cc4b1..8869e8d 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java
@@ -34,6 +34,7 @@
import android.widget.TextView;
import com.android.systemui.FontSizeUtils;
import com.android.systemui.R;
+import com.android.systemui.plugins.qs.QSTile;
/**
* Quick settings common detail view with line items.
@@ -185,7 +186,7 @@
view.setVisibility(mItemsVisible ? VISIBLE : INVISIBLE);
final ImageView iv = (ImageView) view.findViewById(android.R.id.icon);
if (item.iconDrawable != null) {
- iv.setImageDrawable(item.iconDrawable);
+ iv.setImageDrawable(item.iconDrawable.getDrawable(iv.getContext()));
} else {
iv.setImageResource(item.icon);
}
@@ -258,7 +259,7 @@
public static class Item {
public int icon;
- public Drawable iconDrawable;
+ public QSTile.Icon iconDrawable;
public Drawable overlay;
public CharSequence line1;
public CharSequence line2;