Example #1
0
  private void submit() {

    String hospital = mEtHospital.getText().toString();
    if (TextUtils.isEmpty(hospital)) {
      mActivity.showToast("请填写医疗机构");
      return;
    }
    String checkDate = DateFormatUtils.timeToLongString(mTvDate.getText().toString());
    PostAddReportItem postAddReportItem = new PostAddReportItem();
    if (mImageFilePaths.size() > 0) {
      List<File> files = new LinkedList<>();
      for (int i = 0; i < mImageFilePaths.size() - 1; i++) // -1的目的去除默认的+
      {
        File file = new File(mImageFilePaths.get(i));
        if (file != null && file.exists()) {
          files.add(file);
        }
      }
      postAddReportItem.files = files;
    }
    postAddReportItem.checkTime = checkDate;
    postAddReportItem.name = mTvDate.getText().toString() + "的检查报告";
    postAddReportItem.institution = hospital;
    postAddReportItem.userId = RSAUtil.clientEncrypt(mActivity.getLoginSuccessItem().id);
    SubmitAddReportPresenter submitAddReportPresenter =
        new SubmitAddReportPresenterImpl(mActivity, this, REQUEST_SUBMIT_TAG);
    submitAddReportPresenter.doAddReport(postAddReportItem);
  }
Example #2
0
 private void initView(View view) {
   mBtnSubmit = (Button) view.findViewById(R.id.btn_submit);
   mTvDate = (TextView) view.findViewById(R.id.tv_date);
   mEtHospital = (EditText) view.findViewById(R.id.et_hospital);
   mCustomGridView =
       (CustomGridView)
           view.findViewById(R.id.linear_grid_disease_container)
               .findViewById(R.id.custom_gridview);
   mCustomGridView.setNumColumns(3);
   mTvDate.setText(DateFormatUtils.format(System.currentTimeMillis() + "", true, false));
 }