Esempio n. 1
0
  /** 保存责任分组信息 */
  private void saveDutyBedData(final String officeId, String groupId, List<Bed> bedList) {
    StringBuilder sb = new StringBuilder();
    for (Bed b : bedList) {
      if (b.isSelected()) {
        sb.append(b.getHisBedNo() + ",");
      }
    }
    String nos;
    if (sb.toString().endsWith(",")) {
      nos = sb.substring(0, sb.length() - 1);
    } else {
      nos = sb.toString();
    }
    L.i("所有床:" + nos);

    try {
      String url =
          ServiceConstant.SERVICE_IP
              + ServiceConstant.SCHEDULE_SERVICE
              + ServiceConstant.SAVE_WEB_RESPONSIBILITY_GROUP
              + "?officeid="
              + officeId
              + "&responsibilityID="
              + groupId
              + "&bedinfos="
              + URLEncoder.encode(nos, "UTF-8");
      HttpGetUtil getUtil =
          new HttpGetUtil() {
            @Override
            public void success(String json) {
              L.i("保存返回值" + json);
              Intent intent = new Intent();
              intent.setAction(DutyGroupActivity.GROUP_UPDATE);
              sendBroadcast(intent);
              finish();
            }
          };
      getUtil.doGet(this, url, "读取床位");
    } catch (UnsupportedEncodingException e) {
      e.printStackTrace();
    }
  }
Esempio n. 2
0
  private void setBedData() {
    if (noList != null) {
      for (Bed b : mBedList) {
        for (String no : noList) {
          if (no.equals(b.getNo())) {
            b.setSelected(true);
            break;
          }
        }
      }
    }

    mGridView.setAdapter(
        new CommonAdapter<Bed>(this, mBedList, R.layout.item_duty_group_bed) {
          @Override
          public void convert(ViewHolder helper, Bed item) {
            helper.setText(R.id.tv_no, item.getNo());
            if (item.isSelected()) {
              helper.getView(R.id.iv_select).setVisibility(View.VISIBLE);
            } else {
              helper.getView(R.id.iv_select).setVisibility(View.INVISIBLE);
            }
          }
        });
    mGridView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            ImageView selectView = (ImageView) view.findViewById(R.id.iv_select);
            if (mBedList.get(position).isSelected()) {
              selectView.setVisibility(View.INVISIBLE);
              mBedList.get(position).setSelected(false);
            } else {
              selectView.setVisibility(View.VISIBLE);
              mBedList.get(position).setSelected(true);
            }
          }
        });
  }