@Override
 public View createDetailView(Context context, View convertView, ViewGroup parent) {
   mItems = QSDetailItems.convertOrInflate(context, convertView, parent);
   mItems.setTagSuffix("Bluetooth");
   mItems.setEmptyState(
       R.drawable.ic_qs_bluetooth_detail_empty,
       R.string.quick_settings_bluetooth_detail_empty_text);
   mItems.setCallback(this);
   mItems.setMinHeightInItems(0);
   updateItems();
   setItemsVisible(mState.value);
   return mItems;
 }
 @Override
 public View createDetailView(Context context, View convertView, ViewGroup parent) {
   if (DEBUG) Log.d(TAG, "createDetailView convertView=" + (convertView != null));
   mAccessPoints = null;
   mWifiController.scanForAccessPoints();
   fireScanStateChanged(true);
   mItems = QSDetailItems.convertOrInflate(context, convertView, parent);
   mItems.setTagSuffix("Wifi");
   mItems.setCallback(this);
   mItems.setEmptyState(
       R.drawable.ic_qs_wifi_detail_empty, R.string.quick_settings_wifi_detail_empty_text);
   updateItems();
   setItemsVisible(mState.enabled);
   return mItems;
 }
 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);
 }
 private void updateItems() {
   if (mItems == null) return;
   Item[] items = null;
   if (mAccessPoints != null) {
     items = new Item[mAccessPoints.length];
     for (int i = 0; i < mAccessPoints.length; i++) {
       final AccessPoint ap = mAccessPoints[i];
       final Item item = new Item();
       item.tag = ap;
       item.icon = mWifiController.getIcon(ap);
       item.line1 = ap.getSsid();
       item.line2 = ap.isActive() ? ap.getSummary() : null;
       item.overlay =
           ap.getSecurity() != AccessPoint.SECURITY_NONE
               ? mContext.getDrawable(R.drawable.qs_ic_wifi_lock)
               : null;
       items[i] = item;
     }
   }
   mItems.setItems(items);
 }
 public void setItemsVisible(boolean visible) {
   if (mItems == null) return;
   mItems.setItemsVisible(visible);
 }