diff options
4 files changed, 16 insertions, 28 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java b/packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java index 8869e8dd3821..ddd991023273 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java @@ -185,10 +185,10 @@ public class QSDetailItems extends FrameLayout {              }              view.setVisibility(mItemsVisible ? VISIBLE : INVISIBLE);              final ImageView iv = (ImageView) view.findViewById(android.R.id.icon); -            if (item.iconDrawable != null) { -                iv.setImageDrawable(item.iconDrawable.getDrawable(iv.getContext())); +            if (item.icon != null) { +                iv.setImageDrawable(item.icon.getDrawable(iv.getContext()));              } else { -                iv.setImageResource(item.icon); +                iv.setImageResource(item.iconResId);              }              iv.getOverlay().clear();              if (item.overlay != null) { @@ -258,8 +258,8 @@ public class QSDetailItems extends FrameLayout {      }      public static class Item { -        public int icon; -        public QSTile.Icon iconDrawable; +        public int iconResId; +        public QSTile.Icon icon;          public Drawable overlay;          public CharSequence line1;          public CharSequence line2; diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java index bc3ccb41cce0..1aecdceb378c 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java @@ -134,7 +134,7 @@ public class BluetoothTile extends QSTileImpl<BooleanState> {                  if (lastDevice != null) {                      int batteryLevel = lastDevice.getBatteryLevel();                      if (batteryLevel != BluetoothDevice.BATTERY_LEVEL_UNKNOWN) { -                        state.icon = new BluetoothBatteryDrawable(batteryLevel, +                        state.icon = new BluetoothBatteryTileIcon(batteryLevel,                                  mContext.getResources().getFraction(                                          R.fraction.bt_battery_scale_fraction, 1, 1));                      } @@ -212,15 +212,11 @@ public class BluetoothTile extends QSTileImpl<BooleanState> {          return new BluetoothDetailAdapter();      } -    private class BluetoothBatteryDrawable extends Icon { +    private class BluetoothBatteryTileIcon extends Icon {          private int mLevel;          private float mIconScale; -        BluetoothBatteryDrawable(int level) { -            this(level, 1 /* iconScale */); -        } - -        BluetoothBatteryDrawable(int level, float iconScale) { +        BluetoothBatteryTileIcon(int level, float iconScale) {              mLevel = level;              mIconScale = iconScale;          } @@ -302,15 +298,16 @@ public class BluetoothTile extends QSTileImpl<BooleanState> {                  for (CachedBluetoothDevice device : devices) {                      if (mController.getBondState(device) == BluetoothDevice.BOND_NONE) continue;                      final Item item = new Item(); -                    item.icon = R.drawable.ic_qs_bluetooth_on; +                    item.iconResId = R.drawable.ic_qs_bluetooth_on;                      item.line1 = device.getName();                      item.tag = device;                      int state = device.getMaxConnectionState();                      if (state == BluetoothProfile.STATE_CONNECTED) { -                        item.icon = R.drawable.ic_qs_bluetooth_connected; +                        item.iconResId = R.drawable.ic_qs_bluetooth_connected;                          int batteryLevel = device.getBatteryLevel();                          if (batteryLevel != BluetoothDevice.BATTERY_LEVEL_UNKNOWN) { -                            item.iconDrawable = new BluetoothBatteryDrawable(batteryLevel); +                            item.icon = new BluetoothBatteryTileIcon(batteryLevel, +                                    1 /* iconScale */);                              item.line2 = mContext.getString(                                      R.string.quick_settings_connected_battery_level,                                      Utils.formatPercentage(batteryLevel)); @@ -321,7 +318,7 @@ public class BluetoothTile extends QSTileImpl<BooleanState> {                          items.add(connectedDevices, item);                          connectedDevices++;                      } else if (state == BluetoothProfile.STATE_CONNECTING) { -                        item.icon = R.drawable.ic_qs_bluetooth_connecting; +                        item.iconResId = R.drawable.ic_qs_bluetooth_connecting;                          item.line2 = mContext.getString(R.string.quick_settings_connecting);                          items.add(connectedDevices, item);                      } else { diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java index fb396b9ddb07..678aa7116f73 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java @@ -19,26 +19,17 @@ package com.android.systemui.qs.tiles;  import static android.media.MediaRouter.ROUTE_TYPE_REMOTE_DISPLAY;  import android.app.Dialog; -import android.content.BroadcastReceiver;  import android.content.Context;  import android.content.Intent; -import android.content.IntentFilter; -import android.media.MediaRouter; -import android.os.UserHandle;  import android.provider.Settings;  import android.service.quicksettings.Tile;  import android.util.Log; -import android.view.ContextThemeWrapper;  import android.view.View;  import android.view.View.OnAttachStateChangeListener; -import android.view.View.OnClickListener;  import android.view.ViewGroup; -import android.view.WindowManager;  import android.view.WindowManager.LayoutParams;  import android.widget.Button; -import com.android.internal.app.MediaRouteChooserDialog; -import com.android.internal.app.MediaRouteControllerDialog;  import com.android.internal.app.MediaRouteDialogPresenter;  import com.android.internal.logging.MetricsLogger;  import com.android.internal.logging.nano.MetricsProto.MetricsEvent; @@ -280,7 +271,7 @@ public class CastTile extends QSTileImpl<BooleanState> {                  for (CastDevice device : devices) {                      if (device.state == CastDevice.STATE_CONNECTED) {                          final Item item = new Item(); -                        item.icon = R.drawable.ic_qs_cast_on; +                        item.iconResId = R.drawable.ic_qs_cast_on;                          item.line1 = getDeviceName(device);                          item.line2 = mContext.getString(R.string.quick_settings_connected);                          item.tag = device; @@ -300,7 +291,7 @@ public class CastTile extends QSTileImpl<BooleanState> {                          final CastDevice device = mVisibleOrder.get(id);                          if (!devices.contains(device)) continue;                          final Item item = new Item(); -                        item.icon = R.drawable.ic_qs_cast_off; +                        item.iconResId = R.drawable.ic_qs_cast_off;                          item.line1 = getDeviceName(device);                          if (device.state == CastDevice.STATE_CONNECTING) {                              item.line2 = mContext.getString(R.string.quick_settings_connecting); diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java index 23702736b0db..977a725829bb 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java @@ -402,7 +402,7 @@ public class WifiTile extends QSTileImpl<SignalState> {                      final AccessPoint ap = mAccessPoints[i];                      final Item item = new Item();                      item.tag = ap; -                    item.icon = mWifiController.getIcon(ap); +                    item.iconResId = mWifiController.getIcon(ap);                      item.line1 = ap.getSsid();                      item.line2 = ap.isActive() ? ap.getSummary() : null;                      item.icon2 = ap.getSecurity() != AccessPoint.SECURITY_NONE  |