| | |
| | | import safeluck.drive.evaluation.DB.Constant |
| | | import safeluck.drive.evaluation.DB.WorkRoomDataBase |
| | | import safeluck.drive.evaluation.app |
| | | import safeluck.drive.evaluation.bean.BaseDataUIBean |
| | | import safeluck.drive.evaluation.bean.ExamPlatformData |
| | | import safeluck.drive.evaluation.bean.MapInfoHead |
| | | import safeluck.drive.evaluation.httpmodule.HttpCarRespBean |
| | | import safeluck.drive.evaluation.httpmodule.HttpRequetBean |
| | | import safeluck.drive.evaluation.httpmodule.HttpRoadMapRsp |
| | |
| | | jsonObject1 = JSONObject(str) |
| | | val result = jsonObject1!!.getBoolean("result") |
| | | if (result) { |
| | | var mapInfoHead:MapInfoHead = MapInfoHead("","",BaseDataUIBean.TYPE_.car) |
| | | |
| | | when(type){ |
| | | "road" ->{ |
| | | mapInfoHead.type = BaseDataUIBean.TYPE_.road |
| | | val map = gson.fromJson<HttpRoadMapRsp>(str, HttpRoadMapRsp::class.java) |
| | | if (map.isResult) { |
| | | if (map.data != null) { |
| | | mapInfoHead.version = map.data.version |
| | | |
| | | if (map.data.map_json.type.equals("road")) { |
| | | mapInfoHead.str = map.data.map_json.name |
| | | ExamPlatformData.getInstance().setNewRoadMapPath(Environment.getExternalStorageDirectory().absolutePath + "/" |
| | | + applicationContext.getPackageName() + "/" + fileName) |
| | | CThreadPoolExecutor.runInBackground(Runnable { |
| | |
| | | |
| | | }} |
| | | "yard" ->{ |
| | | mapInfoHead.type = BaseDataUIBean.TYPE_.yard |
| | | val yard = gson.fromJson<HttpYardRsp>(str,HttpYardRsp::class.java) |
| | | if (yard.isResult){ |
| | | if (yard.data !=null){ |
| | | mapInfoHead.version = yard.data.version |
| | | Log.i(TAG,"yard====") |
| | | mapInfoHead.str = yard.data.map_json.name |
| | | ExamPlatformData.getInstance().setNewMapPath(Environment.getExternalStorageDirectory().absolutePath + "/" |
| | | + applicationContext.getPackageName() + "/"+fileName) |
| | | CThreadPoolExecutor.runInBackground(Runnable{ |
| | |
| | | } |
| | | } |
| | | else ->{ |
| | | mapInfoHead.type = BaseDataUIBean.TYPE_.car |
| | | val car = gson.fromJson<HttpCarRespBean>(str,HttpCarRespBean::class.java) |
| | | |
| | | if (car.isResult){ |
| | | if (car.data !=null){ |
| | | mapInfoHead.version = car.data.version |
| | | mapInfoHead.str = car.data.map_json.name |
| | | ExamPlatformData.getInstance().carModelPath = Environment.getExternalStorageDirectory().absolutePath + "/" + |
| | | applicationContext.getPackageName() + "/"+fileName |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | ExamPlatformData.getInstance().setMapHeadInfo(mapInfoHead) |
| | | } else { |
| | | // Toast.makeText(applicationContext, jsonObject1!!.getString("data"), Toast.LENGTH_SHORT).show() |
| | | } |