yy1717
2020-03-09 59798b3c20c1b6e7bde1c03cd1caecbaf0860572
app/src/main/java/safeluck/drive/evaluation/app.java
@@ -59,6 +59,7 @@
import safeluck.drive.evaluation.platformMessage.JKMessage0101;
import safeluck.drive.evaluation.platformMessage.JKMessage0203;
import safeluck.drive.evaluation.platformMessage.JKMessage0206;
import safeluck.drive.evaluation.util.CThreadPoolExecutor;
import safeluck.drive.evaluation.util.FileUtil;
import safeluck.drive.evaluation.util.SPUtils;
import safeluck.drive.evaluation.util.SystemUtil;
@@ -245,6 +246,17 @@
                WorkManager.getInstance(getApplicationContext()).enqueue(gpsinfoWorkRequest);
                break;
            case Constant.ENTER_OR_EXIT_ITEM:
                int type = 0;
                int enter_status = -1;
                try {
                    JSONObject rtkConfigUpdtea = new JSONObject(json);
                    type = rtkConfigUpdtea.getInt("type");
                    enter_status = rtkConfigUpdtea.getInt("enter");
                    String itemstr=ExamPlatformData.getInstance().getItemStatusStr(type);
                    ExamPlatformData.getInstance().getTTS().speak(itemstr+(enter_status==Constant.EXIT_CURRENT_ITEM?"结束":"开始"));
                } catch (JSONException e) {
                    e.printStackTrace();
                }
                Data exam_enter_exitdata = new Data.Builder().putString(Constant.exam_enter_exitdata,json).build();
                OneTimeWorkRequest examStatusWorker = new OneTimeWorkRequest.Builder(ExamStatusWoker.class).setInputData(exam_enter_exitdata).build();
                WorkManager.getInstance(getApplicationContext()).enqueue(examStatusWorker);
@@ -369,7 +381,7 @@
        new Thread(new Runnable() {
            @Override
            public void run() {
                String mapPath = ExamPlatformData.getInstance().getMapPath();
                final String mapPath = ExamPlatformData.getInstance().getMapPath();
                if (!TextUtils.isEmpty(mapPath)){
                    MyLog.i("调用更新Map路径后的地图"+mapPath);
                    byte[] fileContent = FileUtil.readFile(mapPath);
@@ -379,15 +391,34 @@
                        AYSdk.getInstance().sendCmd(Constant.PUSH_MAP_INFO,str);
                    }else{
                        MyLog.i(String.format("文件:%s不存在",mapPath));
                        CThreadPoolExecutor.runOnMainThread(new Runnable() {
                            @Override
                            public void run() {
                                Toast.makeText(getAppContext(), "文件:"+mapPath+"不存在", Toast.LENGTH_SHORT).show();
                            }
                        });
                    }
                }else{
                    MyLog.i("读取Assert目录下初始化的地图");
                    CThreadPoolExecutor.runOnMainThread(new Runnable() {
                        @Override
                        public void run() {
                            Toast.makeText(getAppContext(), "读取Assert目录下初始化的地图", Toast.LENGTH_SHORT).show();
                        }
                    });
                    StringBuffer buffer =FileUtil.readAssetTxtFile(getApplicationContext(),Constant.MAP);
                    if (buffer != null){
                        AYSdk.getInstance().sendCmd(Constant.PUSH_MAP_INFO,buffer.toString());
                    }else{
                        MyLog.d(TAG,String.format("地图模型未拷入[%s]目录下", Environment.getExternalStorageDirectory().getAbsolutePath()+"/"+getApplicationContext().getPackageName()));
                        CThreadPoolExecutor.runOnMainThread(new Runnable() {
                            @Override
                            public void run() {
                                Toast.makeText(getAppContext(), String.format("地图模型未拷入[%s]目录下", Environment.getExternalStorageDirectory().getAbsolutePath()+"/"+getApplicationContext().getPackageName()), Toast.LENGTH_SHORT).show();
                            }
                        });
                    }
                }