| | |
| | | initView(view); |
| | | |
| | | failedProjViewModel = ViewModelProviders.of(this).get(FailedProjViewModel.class); |
| | | |
| | | failedProjViewModel.getFailedProjectsForIII(Constant.TEST_STU_ID).observe(this, new Observer<List<FailedProj_select>>() { |
| | | @Override |
| | | public void onChanged(List<FailedProj_select> failedProj_selects) { |
| | | MyLog.i("现在是路考状态,监视路考数据失败项目"); |
| | | if (failedProj_selects != null && failedProj_selects.size()>0){ |
| | | |
| | | item_id = 0; |
| | | currTotalScore = 100; |
| | | mArrayList.clear(); |
| | | item_conents.clear(); |
| | | for (FailedProj_select f : |
| | | failedProj_selects) { |
| | | item_id += f.getScore_deducting(); |
| | | Log.i(TAG, "onChanged: " + f.toString()); |
| | | mArrayList.add(new ScoreBean(f.getScore_deducting(), f.getItem_content(), f.getDeducting_reason())); |
| | | item_conents.add(f.getItem_content()); |
| | | Collections.reverse(mArrayList); |
| | | mScoreAdapter.addDatas(mArrayList); |
| | | MyLog.i("item_score="+item_id); |
| | | } |
| | | //TODO 发送JKMessage0203 给平台,这儿有点复杂,看怎么处理 |
| | | sendJKMessage0203(failedProj_selects); |
| | | MyLog.i("没扣分之前得分:"+currTotalScore); |
| | | currTotalScore -=item_id; |
| | | MyLog.i("路考当前得分:"+currTotalScore); |
| | | if (currTotalScore < Constant.PASSING_SCORE){ |
| | | MyLog.i("路考低于80,不合格"+currTotalScore); |
| | | ExamPlatformData.getInstance().getTTS().speak("考试不合格"); |
| | | stopExam(); |
| | | } |
| | | MyLog.i("路考监测到有失败项目加入,通知UI更新颜色"); |
| | | mHandler.obtainMessage(ADD_DATA).sendToTarget(); |
| | | }else{ |
| | | MyLog.i(TAG,"路考失败项目数据表被清空更新UI"); |
| | | item_id = 0; |
| | | mArrayList.clear(); |
| | | item_conents.clear(); |
| | | Collections.reverse(mArrayList); |
| | | mScoreAdapter.addDatas(mArrayList); |
| | | mHandler.obtainMessage(ADD_DATA).sendToTarget(); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | |
| | | failedProjViewModel.getFailedProjectsForI(Constant.TEST_STU_ID).observe(this, new Observer<List<FailedProj_select>>() { |
| | | @Override |
| | | public void onChanged(List<FailedProj_select> failedProj_selects) { |
| | | MyLog.i("现在是场考状态,监视路考数据失败项目"); |
| | | if (failedProj_selects != null && failedProj_selects.size()>0){ |
| | | |
| | | item_id = 0; |
| | |
| | | currTotalScore -=item_id; |
| | | MyLog.i("当前得分:"+currTotalScore); |
| | | if (currTotalScore < Constant.PASSING_SCORE){ |
| | | MyLog.i("低于80,不合格"+currTotalScore); |
| | | // ExamPlatformData.getInstance().getTTS().speak("考试不合格"); |
| | | // stopExam(); |
| | | MyLog.i("场考低于80,不合格"+currTotalScore); |
| | | ExamPlatformData.getInstance().getTTS().speak("考试不合格"); |
| | | stopExam(); |
| | | } |
| | | MyLog.i("监测到有失败项目加入,通知UI更新颜色"); |
| | | MyLog.i("场考监测到有失败项目加入,通知UI更新颜色"); |
| | | mHandler.obtainMessage(ADD_DATA).sendToTarget(); |
| | | }else{ |
| | | MyLog.i(TAG,"失败项目数据表被清空更新UI"); |
| | | MyLog.i(TAG,"场考失败项目数据表被清空更新UI"); |
| | | item_id = 0; |
| | | mArrayList.clear(); |
| | | item_conents.clear(); |
| | |
| | | exam_type = 2; |
| | | |
| | | iv_head.getDrawable().setLevel(1); |
| | | ExamPlatformData.getInstance().setExamType(exam_type); |
| | | examStatusViewModel.updateStartExam(exam_type); |
| | | sendExamJson(1,exam_type); |
| | | ExamPlatformData.getInstance().getTTS().speak("开始考试"); |
| | |
| | | @Override |
| | | public void luKao() { |
| | | exam_type = 3; |
| | | ExamPlatformData.getInstance().setExamType(exam_type); |
| | | examStatusViewModel.updateStartExam(exam_type); |
| | | sendExamJson(1,exam_type); |
| | | jkMessage0202.curr_exam = 1; |
| | | iv_head.getDrawable().setLevel(1); |
| | | MessageProcessor.getInstance().sendMessage(jkMessage0202); |
| | | // if (simulateNightBean == null){ |
| | | // simulateNightBean = new SimulateNightBean(); |
| | | // } |
| | | // simulateNightBean.setExam(0); |
| | | // |
| | | // final List<SimulateNightBean.QuestionBean> list = ExamPlatformData.getInstance().getSimulate_light_tips(); |
| | | // simulateNightBean.setQuestion(list.subList(list.size()-2,list.size()-1)); |
| | | // AYSdk.getInstance().sendCmd(0x8012,gson.toJson(simulateNightBean)); |
| | | // |
| | | // |
| | | // |
| | | // tempQs.add(list.get(0)); |
| | | // int [] a =Utils.getRandomInts(4,12); |
| | | // for (int i = 0; i < a.length; i++) { |
| | | // tempQs.add(list.get(a[i])); |
| | | // } |
| | | // |
| | | // simulateNightBean.setQuestion(tempQs); |
| | | // mHandler.postDelayed(new Runnable() { |
| | | // @Override |
| | | // public void run() { |
| | | // AYSdk.getInstance().sendCmd(0x8012,gson.toJson(simulateNightBean)); |
| | | // tempQs.clear(); |
| | | // } |
| | | // },10*1000); |
| | | ExamPlatformData.getInstance().getTTS().speak("开始考试"); |
| | | |
| | | } |
| | | }); |
| | |
| | | private void stopExam() { |
| | | MyLog.i(TAG,"结束考试"); |
| | | |
| | | |
| | | sns.clear(); |
| | | tv_total_score.setText(String.valueOf(currTotalScore)); |
| | | iv_head.getDrawable().setLevel(0); |
| | | |