private void loadImage(IdentifyLicense entity) {
    if (!UIUtils.isEmpty(entity.getIdentifyImage())) {
      Glide.with(context)
          .load(Uri.parse(entity.getIdentifyImage()))
          .placeholder(R.mipmap.icon_pic_loading)
          .error(R.mipmap.icon_pic_load_fail)
          .listener(new ImageLoaderListener(context, Uri.parse(entity.getIdentifyImage())))
          .into((ImageView) identity_card_verify_view.findViewById(R.id.iv_identity_card_face));
      ((TextView) identity_card_verify_view.findViewById(R.id.tv_face_2)).setText("上传成功,点击图片可重新上传");
    } else {
      Glide.with(context)
          .load(R.mipmap.identity_card_face)
          .listener(new ImageLoaderListener(context, null))
          .into((ImageView) identity_card_verify_view.findViewById(R.id.iv_identity_card_face));
      ((TextView) identity_card_verify_view.findViewById(R.id.tv_face_2)).setText("点击上传");
    }

    if (!UIUtils.isEmpty(entity.getIdentifyBackImage())) {
      Glide.with(context)
          .load(Uri.parse(entity.getIdentifyBackImage()))
          .placeholder(R.mipmap.icon_pic_loading)
          .error(R.mipmap.icon_pic_load_fail)
          .listener(new ImageLoaderListener(context, Uri.parse(entity.getIdentifyBackImage())))
          .into((ImageView) identity_card_verify_view.findViewById(R.id.iv_identity_card_back));
      ((TextView) identity_card_verify_view.findViewById(R.id.tv_back_2)).setText("上传成功,点击图片可重新上传");
    } else {
      Glide.with(context)
          .load(R.mipmap.identity_card_back)
          .listener(new ImageLoaderListener(context, null))
          .into((ImageView) identity_card_verify_view.findViewById(R.id.iv_identity_card_back));
      ((TextView) identity_card_verify_view.findViewById(R.id.tv_back_2)).setText("点击上传");
    }
  }
  private void getCarPrice(TaskDetail entity) {
    if (!UIUtils.isEmpty(entity.getCarDetail().getCarTypeId())) {
      HashMap<String, String> hashMap = new HashMap<String, String>();
      hashMap.put("carTypeId", entity.getCarDetail().getCarTypeId());
      new CCHttpEngine(
              context,
              NetConstants.NET_ID_GETCAR_PRICE,
              hashMap,
              null,
              new HttpCallBack() {
                public void onSuccess(ResponseBean responseBean) {
                  if (responseBean.getCode() == 0) {
                    CarPrice price = (CarPrice) responseBean.getData();
                    ((TextView) driving_license_card_verify_view.findViewById(R.id.tv_car_price))
                        .setText(price.getPrice());
                  }
                }

                @Override
                public void onNetUnavailable(String net_unAvailabel) {}

                @Override
                public void onFailure(IOException e) {}
              })
          .executeTask();
    }
  }
  private void initUiData() {
    CarDetail cardetail_entity = context.task_detail_entity.getCarDetail();
    DriverLicense driverLicense_entity = context.task_detail_entity.getLicense().getDriverLicense();
    ((TextView) driving_license_card_verify_view.findViewById(R.id.tv_car_brand))
        .setText(cardetail_entity.getCarName());
    if (!UIUtils.isEmpty(cardetail_entity.getCarPlateNo())) {
      String num = cardetail_entity.getCarPlateNo();
      ((TextView) driving_license_card_verify_view.findViewById(R.id.tv_car_plate1))
          .setText(num.charAt(0) + "");
      ((TextView) driving_license_card_verify_view.findViewById(R.id.tv_car_plate2))
          .setText(num.charAt(1) + "");
      ((TextView) driving_license_card_verify_view.findViewById(R.id.tv_car_plate3))
          .setText(num.substring(2, num.length()));
    }
    ((EditText) driving_license_card_verify_view.findViewById(R.id.et_name))
        .setText(driverLicense_entity.getOwnerName());
    ((TextView) driving_license_card_verify_view.findViewById(R.id.tv_hold_property))
        .setText(driverLicense_entity.getOwnerTypeName());
    ((TextView) driving_license_card_verify_view.findViewById(R.id.tv_use_property))
        .setText(driverLicense_entity.getUseTypeName());
    ((TextView) driving_license_card_verify_view.findViewById(R.id.tv_capacity))
        .setText(driverLicense_entity.getCapacity());
    ((EditText) driving_license_card_verify_view.findViewById(R.id.et_che_liang_shibie_daihao))
        .setText(driverLicense_entity.getCode());
    ((EditText) driving_license_card_verify_view.findViewById(R.id.et_engine_num))
        .setText(driverLicense_entity.getEngerNumber());
    ((TextView) driving_license_card_verify_view.findViewById(R.id.tv_registration_date))
        .setText(driverLicense_entity.getRegisteDate());
    ((TextView) driving_license_card_verify_view.findViewById(R.id.tv_nianjian_youxiaoqi))
        .setText(driverLicense_entity.getLicenseEndTime());

    getCarPrice(context.task_detail_entity);
  }
    @Override
    public void onClick(View v) {
      IdentifyLicense entity = context.task_detail_entity.getLicense().getIdentifyLicense();
      if (UIUtils.isEmpty(entity.getIdentifyImage())) {
        ToastUtils.showToast("未上传身份证正面照片");
        return;
      }
      if (UIUtils.isEmpty(entity.getIdentifyBackImage())) {
        ToastUtils.showToast("未上传身份证背面照片");
        return;
      }
      if (!"3".equals(entity.getIdentityNumberStatus())) {
        ToastUtils.showToast("未完成身份信息验证");
        return;
      }

      if (UIUtils.isEmpty(
          ((TextView) identity_card_verify_view.findViewById(R.id.tv_date_out_line))
              .getText()
              .toString()
              .trim())) {
        ToastUtils.showToast("请选择有效期");
        return;
      }

      String date_str =
          ((TextView) identity_card_verify_view.findViewById(R.id.tv_date_out_line))
              .getText()
              .toString()
              .trim();
      if (!UIUtils.checkDateValidity(date_str)) {
        ToastUtils.showToast("身份证已过有效期");
        return;
      }

      if (UIUtils.isEmpty(
          ((TextView) identity_card_verify_view.findViewById(R.id.tv_address))
              .getText()
              .toString()
              .trim())) {
        ToastUtils.showToast("请选择地址");
        return;
      }

      requestPass();
    }
  private void loadImage() {
    final DriverLicense entity = context.task_detail_entity.getLicense().getDriverLicense();
    if (!UIUtils.isEmpty(entity.getLicenseImage())) {
      Glide.with(context)
          .load(Uri.parse(entity.getLicenseImage()))
          .placeholder(R.mipmap.icon_pic_loading)
          .error(R.mipmap.icon_pic_load_fail)
          .listener(new ImageLoaderListener(context, Uri.parse(entity.getLicenseImage())))
          .into(
              (ImageView)
                  driving_license_card_verify_view.findViewById(R.id.iv_driving_license_page));
      ((TextView) driving_license_card_verify_view.findViewById(R.id.tv_face_2))
          .setText("上传成功,点击图片可重新上传");
    } else {
      Glide.with(context)
          .load(R.mipmap.driving_license_page)
          .listener(new ImageLoaderListener(context, null))
          .into(
              (ImageView)
                  driving_license_card_verify_view.findViewById(R.id.iv_driving_license_page));
      ((TextView) driving_license_card_verify_view.findViewById(R.id.tv_face_2)).setText("点击上传");
    }

    if (!UIUtils.isEmpty(entity.getLicenseBackImage())) {
      Glide.with(context)
          .load(Uri.parse(entity.getLicenseBackImage()))
          .placeholder(R.mipmap.icon_pic_loading)
          .error(R.mipmap.icon_pic_load_fail)
          .listener(new ImageLoaderListener(context, Uri.parse(entity.getLicenseBackImage())))
          .into(
              (ImageView)
                  driving_license_card_verify_view.findViewById(R.id.iv_driving_license_vice_page));
      ((TextView) driving_license_card_verify_view.findViewById(R.id.tv_back_2))
          .setText("上传成功,点击图片可重新上传");
    } else {
      Glide.with(context)
          .load(R.mipmap.driving_license_vice_page)
          .listener(new ImageLoaderListener(context, null))
          .into(
              (ImageView)
                  driving_license_card_verify_view.findViewById(R.id.iv_driving_license_vice_page));
      ((TextView) driving_license_card_verify_view.findViewById(R.id.tv_back_2)).setText("点击上传");
    }
  }
  private void initView() {
    if (driving_license_card_verify_view == null) {
      driving_license_card_verify_view =
          LayoutInflater.from(context).inflate(R.layout.layout_driving_license_check, null);

      driving_license_card_verify_view
          .findViewById(R.id.vg_car_brand)
          .setOnClickListener(new CarBrandClickListener());
      driving_license_card_verify_view
          .findViewById(R.id.layout_car_plate)
          .setOnClickListener(new CarPlateNumClickListener());
      driving_license_card_verify_view
          .findViewById(R.id.vg_hold_property)
          .setOnClickListener(new HoldPropertyClickListener());
      driving_license_card_verify_view
          .findViewById(R.id.vg_use_property)
          .setOnClickListener(new UsePropertyClickListener());
      driving_license_card_verify_view
          .findViewById(R.id.vg_capacity)
          .setOnClickListener(new CapacityClickListener());
      driving_license_card_verify_view
          .findViewById(R.id.vg_nianjian_youxiaoqi)
          .setOnClickListener(new DatePickerClickListener());
      driving_license_card_verify_view
          .findViewById(R.id.vg_registration_date)
          .setOnClickListener(new DatePickerClickListener());

      driving_license_card_verify_view
          .findViewById(R.id.vg_success)
          .setOnClickListener(new PassClickListener());
      driving_license_card_verify_view
          .findViewById(R.id.btn_save)
          .setOnClickListener(new SaveClickListener());
      driving_license_card_verify_view
          .findViewById(R.id.vg_fail)
          .setOnClickListener(new RejectClickListener());

      if (!UIUtils.isEmpty(
          context.task_detail_entity.getLicense().getDriverLicense().getFailedNote())) {
        TextView tv_reject_reason =
            (TextView) driving_license_card_verify_view.findViewById(R.id.tv_reject_reason);
        tv_reject_reason.setVisibility(View.VISIBLE);
        tv_reject_reason.setText(
            context.task_detail_entity.getLicense().getDriverLicense().getFailedNote());
      }
    }
    vg_content.addView(driving_license_card_verify_view);
  }
  private void initView() {
    if (identity_card_verify_view == null) {
      identity_card_verify_view =
          LayoutInflater.from(context).inflate(R.layout.layout_identity_card_check, null);

      identity_card_verify_view
          .findViewById(R.id.btn_verify_identity_card)
          .setOnClickListener(new VerifyIdInfoClickListener());
      identity_card_verify_view
          .findViewById(R.id.vg_date_out_line)
          .setOnClickListener(new DateOutLineClickListener());
      identity_card_verify_view
          .findViewById(R.id.vg_address)
          .setOnClickListener(new AddressClickListener());
      identity_card_verify_view
          .findViewById(R.id.vg_success)
          .setOnClickListener(new PassClickListener());
      identity_card_verify_view
          .findViewById(R.id.btn_save)
          .setOnClickListener(new SaveClickListener());
      identity_card_verify_view
          .findViewById(R.id.vg_fail)
          .setOnClickListener(new RejectClickListener());

      if (!UIUtils.isEmpty(
          context.task_detail_entity.getLicense().getIdentifyLicense().getFailedNote())) {
        TextView tv_reject_reason =
            (TextView) identity_card_verify_view.findViewById(R.id.tv_reject_reason);
        tv_reject_reason.setVisibility(View.VISIBLE);
        tv_reject_reason.setText(
            context.task_detail_entity.getLicense().getIdentifyLicense().getFailedNote());
      }

      try {
        Type type = new TypeToken<ResponseBean<ArrayList<IdCity>>>() {}.getType();
        Gson gson = new Gson();
        ResponseBean responseBean = gson.fromJson(UIUtils.getFromAssets("id_address_list"), type);
        id_address_entity = (ArrayList<IdCity>) responseBean.getData();
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
    vg_content.addView(identity_card_verify_view);
  }
  public void requestSave() {
    HashMap<String, String> hashMap = new HashMap<String, String>();
    if (!UIUtils.isEmpty(
        ((EditText) identity_card_verify_view.findViewById(R.id.et_name))
            .getText()
            .toString()
            .trim())) {
      hashMap.put(
          "fill_name",
          ((EditText) identity_card_verify_view.findViewById(R.id.et_name))
              .getText()
              .toString()
              .trim());
    }
    if (!UIUtils.isEmpty(
        ((EditText) identity_card_verify_view.findViewById(R.id.et_identity_card_num))
            .getText()
            .toString()
            .trim())) {
      hashMap.put(
          "card_id",
          ((EditText) identity_card_verify_view.findViewById(R.id.et_identity_card_num))
              .getText()
              .toString()
              .trim());
    }
    if (!UIUtils.isEmpty(
        context.task_detail_entity.getLicense().getIdentifyLicense().getDeadLine())) {
      hashMap.put(
          "certificate_end_time",
          context.task_detail_entity.getLicense().getIdentifyLicense().getDeadLine());
    }
    if (!UIUtils.isEmpty(
        context.task_detail_entity.getLicense().getIdentifyLicense().getProvince())) {
      hashMap.put(
          "city", context.task_detail_entity.getLicense().getIdentifyLicense().getProvince());
    }
    if (!UIUtils.isEmpty(context.task_detail_entity.getLicense().getIdentifyLicense().getCity())) {
      hashMap.put("area", context.task_detail_entity.getLicense().getIdentifyLicense().getCity());
    }
    if (hashMap.size() == 0) {
      ToastUtils.showToast("暂无信息需要保存");
      return;
    }
    context.TAG_NO_FIRST_REQUEST = "tag_request_save";
    hashMap.put("car_id", context.task_detail_entity.getCarId());
    new CCHttpEngine(
            context,
            NetConstants.NET_ID_IDENTITY_CARD_INFO_PASS_SAVE,
            hashMap,
            context.TAG_NO_FIRST_REQUEST,
            new HttpCallBack() {
              public void onSuccess(ResponseBean responseBean) {
                if (responseBean.getCode() == 0) {
                  ToastUtils.showToast("保存成功");
                  identity_card_verify_view
                      .findViewById(R.id.tv_reject_reason)
                      .setVisibility(View.GONE);
                  context
                      .task_detail_entity
                      .getLicense()
                      .getIdentifyLicense()
                      .setUsername(
                          ((EditText) identity_card_verify_view.findViewById(R.id.et_name))
                              .getText()
                              .toString()
                              .trim());
                  context
                      .task_detail_entity
                      .getLicense()
                      .getIdentifyLicense()
                      .setCardNumber(
                          ((EditText)
                                  identity_card_verify_view.findViewById(R.id.et_identity_card_num))
                              .getText()
                              .toString()
                              .trim());
                  if ("2"
                          .equals(
                              context
                                  .task_detail_entity
                                  .getLicense()
                                  .getIdentifyLicense()
                                  .getStatus())
                      || "1"
                          .equals(
                              context
                                  .task_detail_entity
                                  .getLicense()
                                  .getIdentifyLicense()
                                  .getStatus())) {
                    context.task_detail_entity.getLicense().getIdentifyLicense().setStatus("0");
                  }
                  context.initCardsCheckStatus();
                  context.initRedCircle();
                } else {
                  ToastUtils.showToast(responseBean.getMessage());
                }
              }

              @Override
              public void onNetUnavailable(String net_unAvailabel) {
                ToastUtils.showToast(R.string.net_unavailable);
              }

              @Override
              public void onFailure(IOException e) {
                ToastUtils.showToast(R.string.net_fail);
              }
            })
        .executeTask();
  }
  public void requestSave() {
    final CarDetail cardetail_entity = context.task_detail_entity.getCarDetail();
    final DriverLicense driverLicense_entity =
        context.task_detail_entity.getLicense().getDriverLicense();
    final HashMap<String, String> hashMap = new HashMap<String, String>();
    if (!UIUtils.isEmpty(cardetail_entity.getCarTypeId())) {
      hashMap.put("car_type_id", cardetail_entity.getCarTypeId());
    }

    if (!UIUtils.isEmpty(
            ((TextView) driving_license_card_verify_view.findViewById(R.id.tv_car_plate1))
                .getText()
                .toString()
                .trim())
        && !UIUtils.isEmpty(
            ((TextView) driving_license_card_verify_view.findViewById(R.id.tv_car_plate2))
                .getText()
                .toString()
                .trim())
        && !UIUtils.isEmpty(
            ((TextView) driving_license_card_verify_view.findViewById(R.id.tv_car_plate3))
                .getText()
                .toString()
                .trim())) {
      hashMap.put(
          "car_number",
          ((TextView) driving_license_card_verify_view.findViewById(R.id.tv_car_plate1))
                  .getText()
                  .toString()
                  .trim()
              + ((TextView) driving_license_card_verify_view.findViewById(R.id.tv_car_plate2))
                  .getText()
                  .toString()
                  .trim()
              + ((TextView) driving_license_card_verify_view.findViewById(R.id.tv_car_plate3))
                  .getText()
                  .toString()
                  .trim());
    }

    if (!UIUtils.isEmpty(
        ((EditText) driving_license_card_verify_view.findViewById(R.id.et_name))
            .getText()
            .toString()
            .trim())) {
      hashMap.put(
          "c_license_username",
          ((EditText) driving_license_card_verify_view.findViewById(R.id.et_name))
              .getText()
              .toString()
              .trim());
    }
    if (!UIUtils.isEmpty(driverLicense_entity.getOwnerType())) { // 所有人性质;
      hashMap.put("car_owner_type", driverLicense_entity.getOwnerType());
    }

    if (!UIUtils.isEmpty(driverLicense_entity.getUseType())) {
      hashMap.put("car_type", driverLicense_entity.getUseType());
    }

    if (!UIUtils.isEmpty(driverLicense_entity.getCapacity())) {
      hashMap.put("capacity", driverLicense_entity.getCapacity());
    }

    if (!UIUtils.isEmpty(
        ((EditText)
                (driving_license_card_verify_view.findViewById(R.id.et_che_liang_shibie_daihao)))
            .getText()
            .toString()
            .trim())) {
      hashMap.put(
          "code",
          ((EditText)
                  (driving_license_card_verify_view.findViewById(R.id.et_che_liang_shibie_daihao)))
              .getText()
              .toString()
              .trim());
    }

    if (!UIUtils.isEmpty(
        ((EditText) (driving_license_card_verify_view.findViewById(R.id.et_engine_num)))
            .getText()
            .toString()
            .trim())) {
      hashMap.put(
          "engine_number",
          ((EditText) (driving_license_card_verify_view.findViewById(R.id.et_engine_num)))
              .getText()
              .toString()
              .trim());
    }

    if (!UIUtils.isEmpty(driverLicense_entity.getRegisteDate())) {
      hashMap.put("license_register_date", driverLicense_entity.getRegisteDate());
    }

    if (!UIUtils.isEmpty(driverLicense_entity.getLicenseEndTime())) {
      hashMap.put("license_end_time", driverLicense_entity.getLicenseEndTime());
    }

    if (hashMap.size() == 0) {
      ToastUtils.showToast("暂无信息需要保存");
      return;
    }
    context.TAG_NO_FIRST_REQUEST = "tag_request_save";
    hashMap.put("car_id", context.task_detail_entity.getCarId());

    new CCHttpEngine(
            context,
            NetConstants.NET_ID_DRIVING_LICENSE_INFO_PASS_SAVE,
            hashMap,
            context.TAG_NO_FIRST_REQUEST,
            new HttpCallBack() {

              @Override
              public void onSuccess(ResponseBean responseBean) {
                if (responseBean.getCode() == 0) {
                  ToastUtils.showToast("保存成功");
                  driving_license_card_verify_view
                      .findViewById(R.id.tv_reject_reason)
                      .setVisibility(View.GONE);
                  cardetail_entity.setCarPlateNo(hashMap.get("car_number"));
                  driverLicense_entity.setCode(hashMap.get("code"));
                  driverLicense_entity.setEngerNumber(hashMap.get("engine_number"));
                  driverLicense_entity.setOwnerName(hashMap.get("c_license_username"));
                  if ("3"
                          .equals(
                              context
                                  .task_detail_entity
                                  .getLicense()
                                  .getDriverLicense()
                                  .getStatus())
                      || "2"
                          .equals(
                              context
                                  .task_detail_entity
                                  .getLicense()
                                  .getDriverLicense()
                                  .getStatus())) {
                    context.task_detail_entity.getLicense().getDriverLicense().setStatus("0");
                  }

                  if (!UIUtils.isEmpty(car_brand_name) && !UIUtils.isEmpty(car_type_name)) {
                    context
                        .task_detail_entity
                        .getCarDetail()
                        .setCarName(car_brand_name + car_type_name);
                  }

                  context.initCardsCheckStatus();
                  context.initRedCircle();
                } else {
                  ToastUtils.showToast(responseBean.getMessage());
                }
              }

              @Override
              public void onNetUnavailable(String net_unAvailabel) {
                ToastUtils.showToast(R.string.net_unavailable);
              }

              @Override
              public void onFailure(IOException e) {
                ToastUtils.showToast(R.string.net_fail);
              }
            })
        .executeTask();
  }
    @Override
    public void onClick(View v) {
      CarDetail cardetail_entity = context.task_detail_entity.getCarDetail();
      DriverLicense driverLicense_entity =
          context.task_detail_entity.getLicense().getDriverLicense();
      if (UIUtils.isEmpty(driverLicense_entity.getLicenseImage())) {
        ToastUtils.showToast("未上传行驶证正面照片");
        return;
      }
      if (UIUtils.isEmpty(driverLicense_entity.getLicenseBackImage())) {
        ToastUtils.showToast("未上传行驶证副页照片");
        return;
      }

      if (UIUtils.isEmpty(cardetail_entity.getCarTypeId())) {
        ToastUtils.showToast("未选择品牌型号");
        return;
      }

      if (UIUtils.isEmpty(
              ((TextView) driving_license_card_verify_view.findViewById(R.id.tv_car_plate1))
                  .getText()
                  .toString()
                  .trim())
          || UIUtils.isEmpty(
              ((TextView) driving_license_card_verify_view.findViewById(R.id.tv_car_plate2))
                  .getText()
                  .toString()
                  .trim())
          || UIUtils.isEmpty(
              ((TextView) driving_license_card_verify_view.findViewById(R.id.tv_car_plate3))
                  .getText()
                  .toString()
                  .trim())) {
        ToastUtils.showToast("请检查车牌号码");
        return;
      }

      if (UIUtils.isEmpty(
          ((EditText) driving_license_card_verify_view.findViewById(R.id.et_name))
              .getText()
              .toString()
              .trim())) {
        ToastUtils.showToast("请输入所有人姓名");
        return;
      }
      if (UIUtils.isEmpty(driverLicense_entity.getOwnerType())) { // 所有人性质;
        ToastUtils.showToast("请选择所有性质");
        return;
      }

      if (UIUtils.isEmpty(driverLicense_entity.getUseType())) {
        ToastUtils.showToast("请选择使用性质");
        return;
      }

      if (UIUtils.isEmpty(driverLicense_entity.getCapacity())) {
        ToastUtils.showToast("请选择可载人数");
        return;
      }

      if (UIUtils.isEmpty(
          ((EditText)
                  (driving_license_card_verify_view.findViewById(R.id.et_che_liang_shibie_daihao)))
              .getText()
              .toString()
              .trim())) {
        ToastUtils.showToast("请输入车辆识别号");
        return;
      }

      if (UIUtils.isEmpty(
          ((EditText) (driving_license_card_verify_view.findViewById(R.id.et_engine_num)))
              .getText()
              .toString()
              .trim())) {
        ToastUtils.showToast("请输入发动机号");
        return;
      }

      if (UIUtils.isEmpty(driverLicense_entity.getRegisteDate())) {
        ToastUtils.showToast("请选择注册日期");
        return;
      }

      if (UIUtils.isEmpty(driverLicense_entity.getLicenseEndTime())) {
        ToastUtils.showToast("请选择年检有效期");
        return;
      }

      String registeDate = driverLicense_entity.getRegisteDate();
      if (UIUtils.checkDateValidity(registeDate)) {
        ToastUtils.showToast("注册日期无效");
        return;
      }

      String outlineDate = driverLicense_entity.getLicenseEndTime();
      if (!UIUtils.checkDateValidity(outlineDate)) {
        ToastUtils.showToast("车检已过有效期");
        return;
      }

      requestPass();
    }