private void updateItems() {
   if (mItems == null) return;
   Item[] items = null;
   final Collection<CachedBluetoothDevice> devices = mController.getDevices();
   if (devices != null) {
     items = new Item[getBondedCount(devices)];
     int i = 0;
     for (CachedBluetoothDevice device : devices) {
       if (device.getBondState() == BluetoothDevice.BOND_NONE) continue;
       final Item item = new Item();
       item.icon = R.drawable.ic_qs_bluetooth_on;
       item.line1 = device.getName();
       int state = device.getMaxConnectionState();
       if (state == BluetoothProfile.STATE_CONNECTED) {
         item.icon = R.drawable.ic_qs_bluetooth_connected;
         item.line2 = mContext.getString(R.string.quick_settings_connected);
         item.canDisconnect = true;
       } else if (state == BluetoothProfile.STATE_CONNECTING) {
         item.icon = R.drawable.ic_qs_bluetooth_connecting;
         item.line2 = mContext.getString(R.string.quick_settings_connecting);
       }
       item.tag = device;
       items[i++] = item;
     }
   }
   mItems.setItems(items);
 }
 @Override
 public void onDetailItemClick(Item item) {
   if (item == null || item.tag == null) return;
   final CachedBluetoothDevice device = (CachedBluetoothDevice) item.tag;
   if (device != null && device.getMaxConnectionState() == BluetoothProfile.STATE_DISCONNECTED) {
     mController.connect(device);
   }
 }