예제 #1
0
 @Override
 public void onTaskFinished(SHTask task) throws Exception {
   // TODO Auto-generated method stub
   SHDialog.dismissProgressDiaolg();
   if (task == deleteTask) {
     SHToast.showToast(getActivity(), "刪除成功!", 1000);
     getActivity().finish();
   } else {
     SHToast.showToast(getActivity(), "保存成功!", 1000);
     System.out.println(task.getResult().toString());
     getActivity().finish();
   }
 }
예제 #2
0
    @Override
    public void onClick(View v) {
      // TODO Auto-generated method stub
      switch (v.getId()) {
        case R.id.tv_brand:
          Intent intent = new Intent(getActivity(), SHContainerActivity.class);
          intent.putExtra("class", SelectBrandFragment.class.getName());
          startActivityForResult(intent, 0);
          break;
        case R.id.tv_xilie:
          if (brandID == null) {
            SHToast.showToast(getActivity(), "请先选择品牌", 1000);
            return;
          }
          Intent intent2 = new Intent(getActivity(), SHContainerActivity.class);
          intent2.putExtra("class", SelectXilieFragment.class.getName());
          intent2.putExtra("carcategoryid", brandID);
          startActivityForResult(intent2, 1);
          break;
        case R.id.tv_pro:
          Intent intent3 = new Intent(getActivity(), SHContainerActivity.class);
          intent3.putExtra("class", SelectProFragment.class.getName());
          startActivityForResult(intent3, 2);
          break;
        case R.id.tv_area:
          Intent intent4 = new Intent(getActivity(), SHContainerActivity.class);
          intent4.putExtra("class", SelectAreaFragment.class.getName());
          startActivityForResult(intent4, 3);
          break;
        case R.id.et_no:
          //				ll_5.setVisibility(View.VISIBLE);
          break;
        case R.id.btn_save:
          //				if("add".equals(getActivity().getIntent().getStringExtra("option"))){
          if (brandID == null) {
            SHToast.showToast(getActivity(), "请选择品牌", 1000);
            return;
          }
          if (xilieID == null) {
            SHToast.showToast(getActivity(), "请选择车系", 1000);
            return;
          }
          if (proID == null || et_no.getText().toString().trim().length() <= 0) {
            SHToast.showToast(getActivity(), "车牌号不正确", 1000);
            return;
          }
          requestSave();
          //				}
          break;
        case R.id.btn_delete:
          SHDialog.showDoubleKeyDialog(
              getActivity(),
              "确定删除该车辆?",
              new DialogClickListener() {

                @Override
                public void confirm() {
                  // TODO Auto-generated method stub
                  SHDialog.ShowProgressDiaolg(getActivity(), null);
                  deleteTask = new SHPostTaskM();
                  deleteTask.setListener(AddCarFragment.this);
                  deleteTask.setUrl(ConfigDefinition.URL + "mycarmaintanance.action");
                  try {
                    deleteTask.getTaskArgs().put("carid", jsonCar.getString("carid"));
                  } catch (JSONException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                  }
                  deleteTask.getTaskArgs().put("optype", 2);
                  deleteTask.start();
                }

                @Override
                public void cancel() {
                  // TODO Auto-generated method stub

                }
              });
          break;
      }
    }