Merge "Init QSDetailItems Item with constructor"
This commit is contained in:
committed by
Android (Google) Code Review
commit
4b1cf17b01
@@ -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;
|
||||
|
||||
@@ -394,10 +394,11 @@ public class BluetoothTile extends QSTileImpl<BooleanState> {
|
||||
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;
|
||||
|
||||
@@ -402,11 +402,12 @@ public class CastTile extends QSTileImpl<BooleanState> {
|
||||
// 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<BooleanState> {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -454,10 +454,7 @@ public class WifiTile extends QSTileImpl<SignalState> {
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user