| | |
| | | import androidx.lifecycle.Observer; |
| | | import androidx.lifecycle.ViewModelProviders; |
| | | import androidx.work.OneTimeWorkRequest; |
| | | import androidx.work.PeriodicWorkRequest; |
| | | import androidx.work.WorkInfo; |
| | | import androidx.work.WorkManager; |
| | | |
| | | import com.anyun.exam.lib.AYSdk; |
| | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Random; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | import me.yokeyword.fragmentation.SupportFragment; |
| | | import safeluck.drive.evaluation.Constant; |
| | |
| | | import safeluck.drive.evaluation.platformMessage.JKMessage0203; |
| | | import safeluck.drive.evaluation.platformMessage.JKMessage0204; |
| | | import safeluck.drive.evaluation.util.Utils; |
| | | import safeluck.drive.evaluation.worker.TimeWorker; |
| | | |
| | | /** |
| | | * 联网训练UI |
| | |
| | | private int item_id;//扣分分数总和 |
| | | private ExamStatusViewModel examStatusViewModel; |
| | | private static final int ADD_DATA = 1; |
| | | private TextView tv_speed,tv_total_score,tv_sat_num,tv_name,tv_id,tv_work_platform; |
| | | private TextView tv_speed,tv_total_score,tv_sat_num,tv_name,tv_id,tv_work_platform,tv_network_time; |
| | | private double speed=0.0; |
| | | private ImageView iv_rtk_status,iv_head; |
| | | |
| | |
| | | @Override |
| | | public boolean handleMessage(Message msg) { |
| | | if (msg.what == ADD_DATA){ |
| | | MyLog.i("handler add_data totalScore="+currTotalScore); |
| | | tv_total_score.setText(getResources().getString(R.string.total_score,currTotalScore)); |
| | | // 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)); |
| | |
| | | if (failedProj_selects != null && failedProj_selects.size()>0){ |
| | | |
| | | item_id = 0; |
| | | currTotalScore = 100; |
| | | mArrayList.clear(); |
| | | item_conents.clear(); |
| | | for (FailedProj_select f : |
| | |
| | | } |
| | | //TODO 发送JKMessage0203 给平台,这儿有点复杂,看怎么处理 |
| | | sendJKMessage0203(failedProj_selects); |
| | | MyLog.i("没扣分之前得分:"+currTotalScore); |
| | | currTotalScore -=item_id; |
| | | MyLog.i("当前得分:"+currTotalScore); |
| | | if (currTotalScore < Constant.PASSING_SCORE){ |
| | |
| | | tv_sat_num = view.findViewById(R.id.tv_sat_num); |
| | | tv_speed = view.findViewById(R.id.tv_speed); |
| | | tv_total_score = view.findViewById(R.id.tv_total_score); |
| | | tv_network_time = view.findViewById(R.id.network_time); |
| | | |
| | | |
| | | PeriodicWorkRequest periodicWorkRequest = new PeriodicWorkRequest.Builder(TimeWorker.class,30, TimeUnit.SECONDS).build(); |
| | | WorkManager.getInstance(getContext().getApplicationContext()).enqueue(periodicWorkRequest); |
| | | WorkManager.getInstance(getContext().getApplicationContext()).getWorkInfoByIdLiveData(periodicWorkRequest.getId()) |
| | | .observe(this, new Observer<WorkInfo>() { |
| | | @Override |
| | | public void onChanged(WorkInfo workInfo) { |
| | | if (workInfo!= null&&workInfo.getState().isFinished()){ |
| | | String time = workInfo.getOutputData().getString(Constant.TIME_MINUTE); |
| | | MyLog.i("Time="+time); |
| | | tv_network_time.setText(time); |
| | | } |
| | | |
| | | } |
| | | }); |
| | | tv_network_time.setText(Utils.getHHmm()); |
| | | |
| | | tv_speed.setText(getResources().getString(R.string.speed,speed)); |
| | | |
| | | view.findViewById(R.id.btn_return).setOnClickListener(this); |
| | |
| | | case R.id.btn_start: |
| | | OneTimeWorkRequest examStatusInitWork = OneTimeWorkRequest.from(ExamStatusInitWorker.class); |
| | | WorkManager.getInstance(_mActivity).enqueue(examStatusInitWork); |
| | | item_id = 0; |
| | | currTotalScore = 100; |
| | | //TODO 发送JKMessage0202 给平台,开始考试 |
| | | final JKMessage0202 jkMessage0202 = new JKMessage0202(); |
| | | jkMessage0202.phone = ExamPlatformData.getInstance().getPhone(); |
| | |
| | | private void stopExam() { |
| | | MyLog.i(TAG,"结束考试"); |
| | | |
| | | item_id = 0; |
| | | currTotalScore = 100; |
| | | |
| | | tv_total_score.setText(String.valueOf(currTotalScore)); |
| | | iv_head.getDrawable().setLevel(0); |
| | | |