コード例 #1
0
  @Override
  public List<IEspDevice> doAcitonEspButtonGetDevices(IEspDevice inetDevice, String buttonMac) {
    IEspCommandEspButtonGetDevices command = new EspCommandEspButtonGetDevices();
    List<String> bssids = command.doCommandEspButtonGetDevices(inetDevice, buttonMac);

    if (bssids != null) {
      IEspUser user = BEspUser.getBuilder().getInstance();
      List<IEspDevice> allDevices = user.getAllDeviceList();
      List<IEspDevice> result = new ArrayList<IEspDevice>();

      for (String bssid : bssids) {
        for (IEspDevice device : allDevices) {
          if (bssid.equals(device.getBssid())) {
            result.add(device);
          }
        }
      }

      return result;
    }

    return null;
  }
コード例 #2
0
  @Override
  public void show() {
    LayoutInflater inflater =
        (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.device_dialog_abs, null);

    mProgressContainer = view.findViewById(R.id.progress_container);
    mProgressContainer.setVisibility(View.GONE);

    ViewGroup contentView = (ViewGroup) view.findViewById(R.id.device_dialog_content);
    contentView.addView(getContentView(inflater));

    mDialog =
        new AlertDialog.Builder(mContext)
            .setTitle(mDevice.getName())
            .setView(view)
            .setNegativeButton(R.string.esp_sss_device_dialog_exit, null)
            .show();
    mDialog.setOnDismissListener(this);
    mDialog.setCanceledOnTouchOutside(false);
    mDialog.setOnCancelListener(this);

    new StatusTask().execute();
  }