| | |
| | | public boolean handleMessage(Message msg) { |
| | | if (msg.what == ADD_DATA){ |
| | | tv_total_score.setText(getResources().getString(R.string.total_score,currTotalScore)); |
| | | houseView.setColor(whatPaintColor(examStatusList.get(0))); |
| | | av_podao.setColor(whatPaintColor(examStatusList.get(1))); |
| | | av_park.setColor(whatPaintColor(examStatusList.get(2))); |
| | | av_curve.setColor(whatPaintColor(examStatusList.get(3))); |
| | | av_zhijiao.setColor(whatPaintColor(examStatusList.get(4))); |
| | | // houseView.setColor(whatPaintColor(examStatusList)); |
| | | houseView.setColor(aaa(safeluck.drive.evaluation.DB.Constant.EXAM_MAP_TYPE_REVERSE));//倒车入库 type =1 |
| | | av_podao.setColor(aaa(safeluck.drive.evaluation.DB.Constant.EXAM_MAP_TYPE_RAMP)); |
| | | av_park.setColor(aaa(safeluck.drive.evaluation.DB.Constant.EXAM_MAP_TYPE_PARK)); |
| | | av_curve.setColor(aaa(safeluck.drive.evaluation.DB.Constant.EXAM_MAP_TYPE_CURVE)); |
| | | av_zhijiao.setColor(aaa(safeluck.drive.evaluation.DB.Constant.EXAM_MAP_TYPE_ANGLE)); |
| | | } |
| | | if (msg.what == SPEED_DATA){ |
| | | tv_speed.setText(getResources().getString(R.string.speed,speed)); |
| | |
| | | if (result == 0) { |
| | | JKMessage0201 jkMessage0201 = new JKMessage0201(); |
| | | jkMessage0201.phone = ExamPlatformData.getInstance().getPhone(); |
| | | jkMessage0201.currentExam = 0; |
| | | if (exam_type==Constant.Chang_di){ |
| | | jkMessage0201.currentExam = 0; |
| | | }else{ |
| | | jkMessage0201.currentExam = 1; |
| | | } |
| | | |
| | | jkMessage0201.id = icStr; |
| | | MessageProcessor.getInstance().sendMessage(jkMessage0201); |
| | | } |
| | |
| | | return false; |
| | | } |
| | | }); |
| | | |
| | | private int aaa(int type) { |
| | | if (examStatusList!=null &&examStatusList.size()>0){ |
| | | for (ExamStatus examStatus: |
| | | examStatusList) { |
| | | if (type == examStatus.getMap_item()){ |
| | | if (examStatus.getEnter() == safeluck.drive.evaluation.DB.Constant.BEGIN_ITEM){ |
| | | //进入考场 |
| | | if (examStatusList.get(0).getStartExam() == Constant.NONE_BEEN_START_EXAM){ |
| | | //结束考试了 |
| | | MyLog.i("进入考场结束考试,startexam="+examStatus.getStartExam()); |
| | | return getResources().getColor(R.color.colorAccent); |
| | | }else{ |
| | | MyLog.i("进入考场,type="+type); |
| | | return getResources().getColor(R.color.pink); |
| | | } |
| | | |
| | | |
| | | }else if (examStatus.getEnter() == safeluck.drive.evaluation.DB.Constant.FINISH_ITEM){ |
| | | |
| | | if (examStatusList.get(0).getStartExam()==Constant.NONE_BEEN_START_EXAM){ |
| | | return getResources().getColor(R.color.examing); |
| | | } |
| | | |
| | | switch (type) { |
| | | case 1://倒库 |
| | | if (item_conents.contains("倒车入库")) { |
| | | MyLog.i("该项考试失败,type="+type); |
| | | |
| | | return getResources().getColor(R.color.colorAccent); |
| | | }else{ |
| | | ExamPlatformData.getInstance().getTTS().speak("倒车入库合格"); |
| | | return getResources().getColor(R.color.train_btn_return); |
| | | } |
| | | case 2: |
| | | if (item_conents.contains("坡道定点停车和起步")) { |
| | | MyLog.i("该项考试失败,type="+type); |
| | | return getResources().getColor(R.color.colorAccent); |
| | | }else{ |
| | | ExamPlatformData.getInstance().getTTS().speak("坡道定点停车和起步合格"); |
| | | return getResources().getColor(R.color.train_btn_return); |
| | | } |
| | | case 3: |
| | | if (item_conents.contains("侧方停车")) { |
| | | MyLog.i("该项考试失败,type="+type); |
| | | return getResources().getColor(R.color.colorAccent); |
| | | }else{ |
| | | ExamPlatformData.getInstance().getTTS().speak("侧方停车合格"); |
| | | return getResources().getColor(R.color.train_btn_return); |
| | | } |
| | | case 4: |
| | | if (item_conents.contains("曲线行驶")) { |
| | | MyLog.i("该项考试失败,type="+type); |
| | | return getResources().getColor(R.color.colorAccent); |
| | | }else{ |
| | | ExamPlatformData.getInstance().getTTS().speak("曲线行驶合格"); |
| | | return getResources().getColor(R.color.train_btn_return); |
| | | } |
| | | case 5: |
| | | if (item_conents.contains("直角转弯")) { |
| | | MyLog.i("该项考试失败,type="+type); |
| | | return getResources().getColor(R.color.colorAccent); |
| | | }else{ |
| | | MyLog.i("该项考试成功,type="+type); |
| | | ExamPlatformData.getInstance().getTTS().speak("直角转弯合格"); |
| | | return getResources().getColor(R.color.train_btn_return); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | }else{ |
| | | return getResources().getColor(R.color.examing); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return getResources().getColor(R.color.examing); |
| | | } |
| | | |
| | | @Nullable |
| | | @Override |
| | |
| | | currTotalScore -=item_id; |
| | | MyLog.i("当前得分:"+currTotalScore); |
| | | if (currTotalScore < Constant.PASSING_SCORE){ |
| | | MyLog.i(TAG,"低于80,不合格"+currTotalScore); |
| | | MyLog.i("低于80,不合格"+currTotalScore); |
| | | ExamPlatformData.getInstance().getTTS().speak("考试不合格"); |
| | | stopExam(); |
| | | } |
| | | MyLog.i(TAG,"监测到有失败项目加入,通知UI更新颜色"); |
| | | MyLog.i("监测到有失败项目加入,通知UI更新颜色"); |
| | | mHandler.obtainMessage(ADD_DATA).sendToTarget(); |
| | | }else{ |
| | | MyLog.i(TAG,"失败项目数据表被清空更新UI"); |
| | |
| | | failedProj_selects.get(i).getScore_deducting()+"分")); |
| | | MyLog.i("没有相同的sn,发送"+failedProj_selects.get(i).getSn()); |
| | | sns.add(failedProj_selects.get(i).getSn()); |
| | | jkMessage0203.timeBCD = failedProj_selects.get(i).getUtc(); |
| | | String utc = failedProj_selects.get(i).getUtc(); |
| | | if (!TextUtils.isEmpty(utc)&&utc.length()>12){ |
| | | utc =utc.substring(0,12); |
| | | } |
| | | jkMessage0203.timeBCD = utc ; |
| | | |
| | | jkMessage0203.fail_item_id = failedProj_selects.get(i).getEmp_id(); |
| | | jkMessage0203.fail_score = failedProj_selects.get(i).getScore_deducting(); |
| | | jkMessage0203.fail_reason = failedProj_selects.get(i).getDeducting_reason(); |
| | |
| | | switch (status) { |
| | | case 0://考试完成 |
| | | switch (map_id) { |
| | | case 863://倒库 |
| | | case 1://倒库 |
| | | if (item_conents.contains("倒车入库")) { |
| | | return getResources().getColor(R.color.colorAccent); |
| | | }else{ |
| | |
| | | public void onClick(View v) { |
| | | switch (v.getId()) { |
| | | case R.id.btn_start: |
| | | OneTimeWorkRequest examStatusInitWork = OneTimeWorkRequest.from(ExamStatusInitWorker.class); |
| | | WorkManager.getInstance(_mActivity).enqueue(examStatusInitWork); |
| | | //TODO 发送JKMessage0202 给平台,开始考试 |
| | | final JKMessage0202 jkMessage0202 = new JKMessage0202(); |
| | | jkMessage0202.phone = ExamPlatformData.getInstance().getPhone(); |
| | |
| | | @Override |
| | | public void changKao() { |
| | | exam_type = 2; |
| | | examStatusViewModel.updateStartExam(exam_type); |
| | | sendExamJson(1,exam_type); |
| | | ExamPlatformData.getInstance().getTTS().speak("开始考试"); |
| | | jkMessage0202.curr_exam = 0; |
| | |
| | | @Override |
| | | public void luKao() { |
| | | exam_type = 3; |
| | | examStatusViewModel.updateStartExam(exam_type); |
| | | sendExamJson(1,exam_type); |
| | | if (simulateNightBean == null){ |
| | | simulateNightBean = new SimulateNightBean(); |
| | |
| | | |
| | | private void sendExamJson(int i,int type) { |
| | | try { |
| | | examStatusViewModel.updateStartExam(type); |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("exam", i); |
| | | jsonObject.put("type", type); |
| | |
| | | |
| | | private void stopExam() { |
| | | MyLog.i(TAG,"结束考试"); |
| | | //清空已经存在的sns |
| | | sns.clear(); |
| | | |
| | | item_id = 0; |
| | | currTotalScore = 100; |
| | | tv_total_score.setText(String.valueOf(currTotalScore)); |
| | | iv_head.getDrawable().setLevel(0); |
| | | OneTimeWorkRequest examStatusInitWork = OneTimeWorkRequest.from(ExamStatusInitWorker.class); |
| | | WorkManager.getInstance(_mActivity).enqueue(examStatusInitWork); |
| | | |
| | | ExamPlatformData.getInstance().getTTS().speak("结束考试"); |
| | | sendExamJson(0,exam_type); |
| | | examStatusViewModel.updateStartExam(Constant.NONE_BEEN_START_EXAM); |
| | | sendExamJson(0,0);//结束考试 exstart=0 |
| | | //TODO 发送JKMessage0204给平台 结束考试 |
| | | JKMessage0204 jkMessage0204 = new JKMessage0204(); |
| | | jkMessage0204.phone = ExamPlatformData.getInstance().getPhone(); |