Esempio n. 1
0
 public String getDefaultVehicleId() {
   VehicleInfo defVehicle = getDefaultVehicle();
   if (defVehicle == null) {
     return null;
   }
   return defVehicle.getVehicleId();
 }
Esempio n. 2
0
  private void setVehicleInfoValue() {
    progress.setVisibility(View.GONE);
    vehicleBrandIdStr = mVehicleInfo.getVehicleBrandId();
    vehicleModelIdStr = mVehicleInfo.getVehicleModelId();
    if (mVehicleInfo.getObdSN() != null && !"null".equals(mVehicleInfo.getObdSN())) {
      mTxtOBDBinded.setVisibility(View.VISIBLE);
      bindcarvehiclevin.setText(mVehicleInfo.getVehicleVin() + ""); // 车架号
      vehicleVinStr = mVehicleInfo.getVehicleVin();
      vehicleIdStr = mVehicleInfo.getVehicleId();
      // ifAddInterface = true;
    }
    obdSNStr = mVehicleInfo.getObdSN();
    bindcarnum.setText(mVehicleInfo.getVehicleNo() + "");

    if (mVehicleInfo.getVehicleBrand() != null
        && !"".equals(mVehicleInfo.getVehicleBrand())
        && !"null".equals(mVehicleInfo.getVehicleBrand())) {
      bindcarnum2.setText(mVehicleInfo.getVehicleBrand() + "");
    }
    if (mVehicleInfo.getVehicleModel() != null
        && !"".equals(mVehicleInfo.getVehicleModel())
        && !"null".equals(mVehicleInfo.getVehicleModel())) {
      bindcarnum1.setText(mVehicleInfo.getVehicleModel() + "");
    }
    if (mVehicleInfo.getCurrentMileage() != null
        && !"".equals(mVehicleInfo.getCurrentMileage())
        && !"null".equals(mVehicleInfo.getCurrentMileage())) {

      if (mVehicleInfo.getCurrentMileage().indexOf(".") != -1) {
        String cm =
            mVehicleInfo
                .getCurrentMileage()
                .substring(0, mVehicleInfo.getCurrentMileage().indexOf("."));
        bindcarmilenow.setText(cm);
      } else {
        bindcarmilenow.setText(mVehicleInfo.getCurrentMileage() + "");
      }
    }
    if (mVehicleInfo.getNextMaintainMileage() != null
        && !"".equals(mVehicleInfo.getNextMaintainMileage())
        && !"null".equals(mVehicleInfo.getNextMaintainMileage())) {
      if (mVehicleInfo.getNextMaintainMileage().indexOf(".") != -1) {
        String nm =
            mVehicleInfo
                .getNextMaintainMileage()
                .substring(0, mVehicleInfo.getNextMaintainMileage().indexOf("."));
        bindcarnextmile.setText(nm);
      } else {
        bindcarnextmile.setText(mVehicleInfo.getNextMaintainMileage() + "");
      }
    }
    if (mVehicleInfo.getNextExamineTime() != null
        && !"".equals(mVehicleInfo.getNextExamineTime())
        && !"null".equals(mVehicleInfo.getNextExamineTime())
        && !"0".equals(mVehicleInfo.getNextExamineTime())) {
      bindcarnexttime2.setText(SomeUtil.longToStringDate(mVehicleInfo.getNextExamineTime() + ""));
    }
    if (mVehicleInfo.getNextInsuranceTime() != null
        && !"".equals(mVehicleInfo.getNextInsuranceTime())
        && !"null".equals(mVehicleInfo.getNextInsuranceTime())
        && !"0".equals(mVehicleInfo.getNextInsuranceTime())) {
      bindcarnexttime.setText(SomeUtil.longToStringDate(mVehicleInfo.getNextInsuranceTime() + ""));
    }
    if (mVehicleInfo.getRecommendShopName() != null) {
      mTxtShopBinded.setVisibility(View.VISIBLE);
      mTxtShopBinded.setText(
          String.format(
              getResources().getString(R.string.change_bindcars_shop_binded),
              mVehicleInfo.getRecommendShopName()));
    }

    if (mVehicleInfo.getVehicleVin() != null
        && !"".equals(mVehicleInfo.getVehicleVin())
        && !"null".equals(mVehicleInfo.getVehicleVin())) {
      bindcarvehiclevin.setText(mVehicleInfo.getVehicleVin() + "");
    }
    if (mVehicleInfo.getEngineNo() != null
        && !"".equals(mVehicleInfo.getEngineNo())
        && !"null".equals(mVehicleInfo.getEngineNo())) {
      TongGouApplication.showLog(
          "mVehicleInfo.getEngineNo()  +  " + mVehicleInfo.getEngineNo() + "");
      bindcarengineno.setText(mVehicleInfo.getEngineNo() + "");
    }
    if (mVehicleInfo.getRegistNo() != null
        && !"".equals(mVehicleInfo.getRegistNo())
        && !"null".equals(mVehicleInfo.getRegistNo())) {
      bindcarregistno.setText(mVehicleInfo.getRegistNo() + "");
    }

    if (mTxtOBDBinded.getVisibility() == View.VISIBLE) {
      setViewMargins(mTxtOBDBinded, 0, SomeUtil.Dp2Px(this, 5), 0, 0);
    }

    if (mTxtShopBinded.getVisibility() == View.VISIBLE) {
      if (mTxtOBDBinded.getVisibility() != View.VISIBLE) {
        setViewMargins(mTxtShopBinded, 0, SomeUtil.Dp2Px(this, 5), 0, 0);
      }
    }
  }