| | |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.annotation.Nullable; |
| | | import androidx.lifecycle.Observer; |
| | | import androidx.lifecycle.ViewModelProviders; |
| | | |
| | | import com.anyun.exam.lib.AYSdk; |
| | | import com.google.gson.Gson; |
| | |
| | | |
| | | import me.yokeyword.fragmentation.SupportFragment; |
| | | import safeluck.drive.evaluation.Constant; |
| | | import safeluck.drive.evaluation.DB.failitems.FailedProjViewModel; |
| | | import safeluck.drive.evaluation.DB.failitems.FailedProj_select; |
| | | import safeluck.drive.evaluation.R; |
| | | import safeluck.drive.evaluation.adapter.ScoreAdapter; |
| | | import safeluck.drive.evaluation.bean.ScoreBean; |
| | |
| | | private Button btn_start_exam; |
| | | private ScoreAdapter mScoreAdapter; |
| | | |
| | | private int item_id;//扣分分数总和 |
| | | |
| | | private List<ScoreBean> mArrayList = new ArrayList<>(); |
| | | |
| | | public static SupportFragment newInstance() { |
| | |
| | | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
| | | View view = inflater.inflate(R.layout.layout_train_fragment,container,false); |
| | | initView(view); |
| | | |
| | | FailedProjViewModel failedProjViewModel = ViewModelProviders.of(this).get(FailedProjViewModel.class); |
| | | failedProjViewModel.getFailedProjectsForI(Constant.TEST_STU_ID).observe(this, new Observer<List<FailedProj_select>>() { |
| | | @Override |
| | | public void onChanged(List<FailedProj_select> failedProj_selects) { |
| | | item_id = 0; |
| | | mArrayList.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())); |
| | | mScoreAdapter.addDatas(mArrayList); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | |
| | | return view; |
| | | } |
| | | |
| | |
| | | btn_start_exam.setOnClickListener(this); |
| | | view.findViewById(R.id.tv_stop).setOnClickListener(this); |
| | | mListView.addHeaderView(LayoutInflater.from(_mActivity).inflate(R.layout.layout_score_item,null)); |
| | | mArrayList.add(new ScoreBean(12,"直角转弯","后轮胎压线")); |
| | | mArrayList.add(new ScoreBean(100,"倒车入库","未系安全带")); |
| | | mArrayList.add(new ScoreBean(10,"坡道起步","一次熄火")); |
| | | mArrayList.add(new ScoreBean(0,"","")); |
| | | mArrayList.add(new ScoreBean(0,"","")); |
| | | |
| | | mScoreAdapter.addDatas(mArrayList); |
| | | |
| | | } |
| | | |