diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java b/packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java index dab0efe10b5d8..e93c349ee41f5 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java @@ -259,6 +259,12 @@ public class QSDetailItems extends FrameLayout { } public static class Item { + public Item(int iconResId, CharSequence line1, Object tag) { + this.iconResId = iconResId; + this.line1 = line1; + this.tag = tag; + } + public int iconResId; public QSTile.Icon icon; public Drawable overlay; 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 65b6617c5a252..6fcfc3af9c873 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java @@ -394,10 +394,11 @@ public class BluetoothTile extends QSTileImpl { int count = 0; for (CachedBluetoothDevice device : devices) { if (mController.getBondState(device) == BluetoothDevice.BOND_NONE) continue; - final Item item = new Item(); - item.iconResId = com.android.internal.R.drawable.ic_qs_bluetooth; - item.line1 = device.getName(); - item.tag = device; + final Item item = + new Item( + com.android.internal.R.drawable.ic_qs_bluetooth, + device.getName(), + device); int state = device.getMaxConnectionState(); if (state == BluetoothProfile.STATE_CONNECTED) { item.iconResId = R.drawable.ic_bluetooth_connected; 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 b83dc52240b33..1fb608a3c7db3 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java @@ -402,11 +402,12 @@ public class CastTile extends QSTileImpl { // if we are connected, simply show that device for (CastDevice device : devices) { if (device.state == CastDevice.STATE_CONNECTED) { - final Item item = new Item(); - item.iconResId = R.drawable.ic_cast_connected; - item.line1 = getDeviceName(device); + final Item item = + new Item( + R.drawable.ic_cast_connected, + getDeviceName(device), + device); item.line2 = mContext.getString(R.string.quick_settings_connected); - item.tag = device; item.canDisconnect = true; items = new Item[] { item }; break; @@ -422,13 +423,11 @@ public class CastTile extends QSTileImpl { for (String id : mVisibleOrder.keySet()) { final CastDevice device = mVisibleOrder.get(id); if (!devices.contains(device)) continue; - final Item item = new Item(); - item.iconResId = R.drawable.ic_cast; - item.line1 = getDeviceName(device); + final Item item = + new Item(R.drawable.ic_cast, getDeviceName(device), device); if (device.state == CastDevice.STATE_CONNECTING) { item.line2 = mContext.getString(R.string.quick_settings_connecting); } - item.tag = device; items[i++] = item; } } 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 e79ca0c932127..f725b9fe63cd3 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java @@ -454,10 +454,7 @@ public class WifiTile extends QSTileImpl { items = new Item[mAccessPoints.length]; for (int i = 0; i < mAccessPoints.length; i++) { final WifiEntry ap = mAccessPoints[i]; - final Item item = new Item(); - item.tag = ap; - item.iconResId = mWifiController.getIcon(ap); - item.line1 = ap.getSsid(); + final Item item = new Item(mWifiController.getIcon(ap), ap.getSsid(), ap); item.line2 = ap.getSummary(); item.icon2 = ap.getSecurity() != AccessPoint.SECURITY_NONE ? R.drawable.qs_ic_wifi_lock