| | |
| | | import safeluck.drive.evaluation.Constant; |
| | | import safeluck.drive.evaluation.DB.Student; |
| | | import safeluck.drive.evaluation.DB.WokViewModel; |
| | | import safeluck.drive.evaluation.DB.WorkRoomDataBase; |
| | | import safeluck.drive.evaluation.DB.exam_status.ExamStatus; |
| | | import safeluck.drive.evaluation.DB.exam_status.ExamStatusViewModel; |
| | | import safeluck.drive.evaluation.DB.failitems.FailedProjViewModel; |
| | | import safeluck.drive.evaluation.DB.failitems.FailedProj_select; |
| | | import safeluck.drive.evaluation.DB.route.RouteLineViewModel; |
| | | import safeluck.drive.evaluation.MainActivity; |
| | | import safeluck.drive.evaluation.R; |
| | | import safeluck.drive.evaluation.adapter.ScoreAdapter; |
| | |
| | | import safeluck.drive.evaluation.platformMessage.JKMessage0202; |
| | | import safeluck.drive.evaluation.platformMessage.JKMessage0204; |
| | | import safeluck.drive.evaluation.platformMessage.PlatFormConstant; |
| | | import safeluck.drive.evaluation.util.CThreadPoolExecutor; |
| | | import safeluck.drive.evaluation.util.Utils; |
| | | import safeluck.drive.evaluation.widget.StatusDialog; |
| | | |
| | |
| | | public class TrainFragment extends SupportFragment implements View.OnClickListener { |
| | | |
| | | private static final String TAG = TrainFragment.class.getSimpleName(); |
| | | private static final int ROUTE_COLLECT = 5;//线路采集标志 |
| | | |
| | | |
| | | public static SupportFragment newInstance() { |
| | | return new TrainFragment(); |
| | | } |
| | | |
| | | |
| | | private int exam_type = 2;//2 场地;3 道路,模拟夜考;4 道路,实际夜考; |
| | | private View route_collect; |
| | | private View items,items_score; |
| | | private int exam_type = 2;//2 场地;3 道路,模拟夜考;4 道路,实际夜考 5,线路采集; |
| | | private ListView mListView; |
| | | private Button btn_start_exam; |
| | | private TextView tv_stop;//呼叫请求(结束考试) |
| | | private ScoreAdapter mScoreAdapter; |
| | | private Button av_zhijiao, av_curve, av_park, av_podao; |
| | | private Button houseView; |
| | | private RouteLineViewModel routeLineViewModel; |
| | | private List<ExamStatus> examStatusList = new ArrayList<>(); |
| | | private List<String> item_conents = new ArrayList<>();//坡道定点停车和起步 |
| | | |
| | |
| | | |
| | | |
| | | private void showChangKaoOrLukao(int exam_type){ |
| | | if (exam_type > ExamPlatformData.EXAM_TYPE_ChangKAO){ |
| | | //show路考 |
| | | view.findViewById(R.id.lukao).setVisibility(View.VISIBLE); |
| | | view.findViewById(R.id.changkao).setVisibility(View.GONE); |
| | | if (exam_type >= ExamPlatformData.EXAM_TYPE_ChangKAO && exam_type<ROUTE_COLLECT){ |
| | | items_score.setVisibility(View.VISIBLE); |
| | | items.setVisibility(View.VISIBLE); |
| | | route_collect.setVisibility(View.GONE); |
| | | if(exam_type == ExamPlatformData.EXAM_TYPE_ChangKAO) { |
| | | //show场考 |
| | | view.findViewById(R.id.lukao).setVisibility(View.GONE); |
| | | view.findViewById(R.id.changkao).setVisibility(View.VISIBLE); |
| | | }else{ |
| | | |
| | | //show路考 |
| | | view.findViewById(R.id.lukao).setVisibility(View.VISIBLE); |
| | | view.findViewById(R.id.changkao).setVisibility(View.GONE); |
| | | } |
| | | |
| | | }else{ |
| | | //show场考 |
| | | view.findViewById(R.id.lukao).setVisibility(View.GONE); |
| | | view.findViewById(R.id.changkao).setVisibility(View.VISIBLE); |
| | | if (exam_type == ROUTE_COLLECT){ |
| | | items_score.setVisibility(View.GONE); |
| | | items.setVisibility(View.GONE); |
| | | route_collect.setVisibility(View.VISIBLE); |
| | | } |
| | | |
| | | } |
| | | } |
| | | View view; |
| | |
| | | initView(view); |
| | | |
| | | failedProjViewModel = ViewModelProviders.of(this).get(FailedProjViewModel.class); |
| | | |
| | | routeLineViewModel = ViewModelProviders.of(this).get(RouteLineViewModel.class); |
| | | |
| | | failedProjViewModel.getFailedProjectsForIII(Constant.TEST_STU_ID).observe(this, new Observer<List<FailedProj_select>>() { |
| | | @Override |
| | |
| | | mHandler.obtainMessage(ADD_DATA).sendToTarget(); |
| | | exam_type = examStatus.get(0).getStartExam(); |
| | | if (exam_type != Constant.NONE_BEEN_START_EXAM){ |
| | | btn_start_exam.setText("结束训练"); |
| | | if (ROUTE_COLLECT == exam_type){ |
| | | btn_start_exam.setText("结束采集"); |
| | | }else{ |
| | | |
| | | btn_start_exam.setText("结束训练"); |
| | | } |
| | | }else{ |
| | | btn_start_exam.setText("开始训练"); |
| | | } |
| | |
| | | |
| | | |
| | | private void initView(View view) { |
| | | items = view.findViewById(R.id.items); |
| | | items_score=view.findViewById(R.id.items_score); |
| | | route_collect=view.findViewById(R.id.route_collect); |
| | | Log.i(TAG,"currTopFragment="+getTopFragment().getClass().getSimpleName()); |
| | | if (HomeFragment.class.getSimpleName().equals(getTopFragment().getClass().getSimpleName())){ |
| | | ((MainActivity)_mActivity).viewtitle.setVisibility(View.GONE); |
| | |
| | | sendJK0202(4); |
| | | }else{ |
| | | Toast.makeText(_mActivity, "线路采集", Toast.LENGTH_SHORT).show(); |
| | | ExamPlatformData.getInstance().setTrainingMode(ExamPlatformData.TRAINING_MODE); |
| | | exam_type = 5; |
| | | examStatusViewModel.updateStartExam(exam_type); |
| | | items.setVisibility(View.GONE); |
| | | items_score.setVisibility(View.GONE); |
| | | route_collect.setVisibility(View.VISIBLE); |
| | | } |
| | | } |
| | | }); |
| | | selectDialog.show(getFragmentManager(),"selectdialog"); |
| | | }else{ |
| | | if (exam_type == ROUTE_COLLECT){ |
| | | Toast.makeText(_mActivity, "结束采集", Toast.LENGTH_SHORT).show(); |
| | | |
| | | ExamPlatformData.getInstance().setTrainingMode(ExamPlatformData.MODE_NONE); |
| | | exam_type = 0; |
| | | examStatusViewModel.updateStartExam(exam_type); |
| | | items.setVisibility(View.VISIBLE); |
| | | items_score.setVisibility(View.VISIBLE); |
| | | route_collect.setVisibility(View.GONE); |
| | | }else{ |
| | | |
| | | stopExam(); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | private void sendJK0202(int type) { |
| | | |
| | | //隐藏采集项目 |
| | | items_score.setVisibility(View.VISIBLE); |
| | | items.setVisibility(View.VISIBLE); |
| | | route_collect.setVisibility(View.GONE); |
| | | final JKMessage0202 jkMessage0202 = new JKMessage0202(); |
| | | exam_type = type; |
| | | ExamPlatformData.getInstance().setTrainingMode(ExamPlatformData.TRAINING_MODE); |