| | |
| | | if (examStatus.get(0).getStartExam() == Constant.HAS_BEEN_START_EXAM){ |
| | | btn_start_exam.setEnabled(false); |
| | | tv_stop.setEnabled(true); |
| | | sendExamJson(Constant.HAS_BEEN_START_EXAM); |
| | | }else{ |
| | | btn_start_exam.setEnabled(true); |
| | | tv_stop.setEnabled(false); |
| | |
| | | switch (v.getId()) { |
| | | case R.id.btn_start: |
| | | examStatusViewModel.updateStartExam(Constant.HAS_BEEN_START_EXAM); |
| | | try { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("exam", 1); |
| | | String examJson = jsonObject.toString(); |
| | | Log.i(TAG, "onClick: " + examJson); |
| | | AYSdk.getInstance().sendCmd(Constant.EXAM_STATUS, examJson); |
| | | } catch (JSONException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | sendExamJson(1); |
| | | iv_head.getDrawable().setLevel(1); |
| | | break; |
| | | case R.id.tv_stop: |
| | |
| | | } |
| | | } |
| | | |
| | | private void sendExamJson(int i) { |
| | | try { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("exam", i); |
| | | String examJson = jsonObject.toString(); |
| | | Log.i(TAG, "onClick: " + examJson); |
| | | AYSdk.getInstance().sendCmd(Constant.EXAM_STATUS, examJson); |
| | | } catch (JSONException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | private void stopExam() { |
| | | MyLog.i(TAG,"结束考试"); |
| | | item_id = 0; |
| | |
| | | iv_head.getDrawable().setLevel(0); |
| | | OneTimeWorkRequest examStatusInitWork = OneTimeWorkRequest.from(ExamStatusInitWorker.class); |
| | | WorkManager.getInstance(_mActivity).enqueue(examStatusInitWork); |
| | | try { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("exam", 0); |
| | | String examJson = jsonObject.toString(); |
| | | Log.i(TAG, "onClick: " + examJson); |
| | | AYSdk.getInstance().sendCmd(Constant.EXAM_STATUS, examJson); |
| | | } catch (JSONException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | sendExamJson(0); |
| | | } |
| | | |
| | | private ICEventListener icEventListener = new ICEventListener() { |