Exemplo n.º 1
0
 /** 设置城市并获取服务 */
 private void setCityAndFetchServices() {
   String cityName = mApplication.getCityName();
   if (StringUtils.isEmpty(cityName)) {
     isFristLoc = true;
     tvLocation.setText("请选择");
     setCarServicesIsError(true);
     llError.setAbnormalContent(AbnormalView.ERROR_POSITIONING);
   } else if (!TextUtils.isEmpty(cityName) && !tvLocation.getText().equals(cityName)) {
     isFristLoc = false;
     tvLocation.setText(cityName);
     request();
   }
 }
Exemplo n.º 2
0
 @Override
 public void onReceive(Context context, Intent intent) {
   if (isFristLoc) {
     isFristLoc = false;
   }
   if (!StringUtils.isEmpty(mApplication.getCityName())) {
     // 定位成功
     setCityAndFetchServices();
   } else {
     if (!hasLocalCacheData) {
       // 如果没有城市缓存数据,设置定位失败
       setCarServicesIsError(true);
       if (null != llError) {
         llError.setAbnormalContent(AbnormalView.ERROR_LOCATION_FAILED);
       }
     }
   }
 }
Exemplo n.º 3
0
  @Override
  protected void loadData() {
    vehicleNumber = getIntent().getStringExtra("vehicleNumber");
    imagePath = getIntent().getStringExtra("imagePath");
    uploadLabel = getIntent().getStringExtra("uploadLabel");
    if (!StringUtils.isEmpty(imagePath)) {
      bitmap = BMapUtil.getBitmapFromPath(imagePath, 500);
      bitmap = BMapUtil.rotateByExifInfo(bitmap, imagePath);
      if (bitmap != null) {
        try {
          ivImage.setImageBitmap(bitmap);
          resizeImageAndInfoView();
          new AsyncTask<Void, Void, String>() {
            @Override
            protected String doInBackground(Void... params) {
              try {
                return MobclickAgent.getConfigParams(UploadLicenceActivity.this, "useWenTong");
              } catch (Exception e) {
                e.printStackTrace();
                return null;
              }
            }

            protected void onPostExecute(String result) {
              if (!StringUtils.isEmpty(result) && result.equals("1")) {
                useWenTong = true;
              } else useWenTong = false;
            }
          }.execute();
        } catch (Exception e) {
          finish();
        }
      } else {
        ToastUtil.TextToast(this, "获取图片失败", Toast.LENGTH_SHORT, Gravity.CENTER);
        finish();
      }
    } else {
      ToastUtil.TextToast(this, "获取图片失败", Toast.LENGTH_SHORT, Gravity.CENTER);
      finish();
    }
  }
Exemplo n.º 4
0
 @Override
 public void onClick(View v) {
   Intent intent;
   switch (v.getId()) {
     case R.id.ivBack:
       intent = new Intent(UploadLicenceActivity.this, AlertDialogActivity.class);
       intent.putExtra("alertType", KplusConstants.ALERT_CHOOSE_WHETHER_EXECUTE);
       intent.putExtra("message", "退出此次认证?");
       startActivityForResult(intent, REQUEST_FOR_CANCEL);
       break;
     case R.id.btRetake:
       if (btRetake.getText().toString().equals("修改信息")) {
         intent = new Intent(UploadLicenceActivity.this, InformationConfirmedActivity.class);
         intent.putExtra("vehicleNumber", vehicleNumber);
         intent.putExtra("licneceInfo", licneceInfo);
         intent.putExtra("picUrl", picUrl);
         startActivity(intent);
       } else {
         intent = new Intent(UploadLicenceActivity.this, ShootActivity.class);
         intent.putExtra("vehicleNumber", vehicleNumber);
         startActivity(intent);
       }
       finish();
       break;
     case R.id.btSubmit:
       if (btSubmit.getText().toString().equals("提交审核")) {
         submitImage(bitmap);
       } else {
         if (licneceInfo != null) {
           String vn = licneceInfo.getVehicleNum();
           if (StringUtils.isEmpty(vn)) {
             ToastUtil.TextToast(this, "缺少车牌号码", Toast.LENGTH_SHORT, Gravity.CENTER);
             return;
           }
           if (!vehicleNumber.equals(vn)) {
             ToastUtil.TextToast(this, "车牌号码不符", Toast.LENGTH_SHORT, Gravity.CENTER);
             return;
           }
           if (StringUtils.isEmpty(licneceInfo.getVehicleType())) {
             ToastUtil.TextToast(this, "缺少车辆类型", Toast.LENGTH_SHORT, Gravity.CENTER);
             return;
           }
           if (StringUtils.isEmpty(licneceInfo.getUseProperty())) {
             ToastUtil.TextToast(this, "缺少使用性质", Toast.LENGTH_SHORT, Gravity.CENTER);
             return;
           }
           if (StringUtils.isEmpty(licneceInfo.getBrandModel())) {
             ToastUtil.TextToast(this, "缺少品牌型号", Toast.LENGTH_SHORT, Gravity.CENTER);
             return;
           }
           if (StringUtils.isEmpty(licneceInfo.getFrameNum())) {
             ToastUtil.TextToast(this, "缺少车辆识别代号", Toast.LENGTH_SHORT, Gravity.CENTER);
             return;
           }
           if (StringUtils.isEmpty(licneceInfo.getMotorNum())) {
             ToastUtil.TextToast(this, "缺少发动机号码", Toast.LENGTH_SHORT, Gravity.CENTER);
             return;
           }
           if (StringUtils.isEmpty(licneceInfo.getRegisterDate())) {
             ToastUtil.TextToast(this, "缺少注册日期", Toast.LENGTH_SHORT, Gravity.CENTER);
             return;
           }
           if (StringUtils.isEmpty(licneceInfo.getIssueDate())) {
             ToastUtil.TextToast(this, "缺少发证日期", Toast.LENGTH_SHORT, Gravity.CENTER);
             return;
           }
           if (StringUtils.isEmpty(licneceInfo.getOwner())) {
             ToastUtil.TextToast(this, "缺少车主姓名", Toast.LENGTH_SHORT, Gravity.CENTER);
             return;
           }
         }
         submitInfo();
       }
       break;
     case R.id.btReUpload:
       submitImage(bitmap);
       break;
     case R.id.btCancelUpload:
       intent = new Intent(UploadLicenceActivity.this, AlertDialogActivity.class);
       intent.putExtra("alertType", KplusConstants.ALERT_CHOOSE_WHETHER_EXECUTE);
       intent.putExtra("message", "退出此次认证?");
       startActivityForResult(intent, REQUEST_FOR_CANCEL);
       break;
     default:
       break;
   }
 }