| | |
| | | |
| | | import android.os.Bundle; |
| | | |
| | | import android.os.Handler; |
| | | import android.os.Message; |
| | | import android.util.Log; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | |
| | | import androidx.lifecycle.ViewModelProviders; |
| | | |
| | | import com.anyun.exam.lib.AYSdk; |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.JsonElement; |
| | | import com.google.gson.JsonObject; |
| | | |
| | | import org.json.JSONException; |
| | | import org.json.JSONObject; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | import me.yokeyword.fragmentation.SupportFragment; |
| | | import safeluck.drive.evaluation.Constant; |
| | | 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.R; |
| | | import safeluck.drive.evaluation.adapter.ScoreAdapter; |
| | | import safeluck.drive.evaluation.bean.ExamStatus; |
| | | import safeluck.drive.evaluation.DB.exam_status.ExamStatus; |
| | | import safeluck.drive.evaluation.bean.ScoreBean; |
| | | import safeluck.drive.evaluation.cEventCenter.CEventCenter; |
| | | import safeluck.drive.evaluation.customview.ArrowView; |
| | | import safeluck.drive.evaluation.customview.HouseView; |
| | | |
| | |
| | | private List<String> item_conents = new ArrayList<>();//坡道定点停车和起步 |
| | | |
| | | private int item_id;//扣分分数总和 |
| | | private ExamStatusViewModel examStatusViewModel; |
| | | private static final int ADD_DATA = 1; |
| | | |
| | | private List<ScoreBean> mArrayList = new ArrayList<>(); |
| | | |
| | | public static SupportFragment newInstance() { |
| | | return new NetWorkTrainFragment(); |
| | | } |
| | | |
| | | private Handler mHandler = new Handler(new Handler.Callback() { |
| | | @Override |
| | | public boolean handleMessage(Message msg) { |
| | | if (msg.what == ADD_DATA){ |
| | | av_curve.setColor(whatPaintColor(examStatusList.get(3))); |
| | | av_zhijiao.setColor(whatPaintColor(examStatusList.get(4))); |
| | | av_podao.setColor(whatPaintColor(examStatusList.get(1))); |
| | | av_park.setColor(whatPaintColor(examStatusList.get(2))); |
| | | houseView.setColor(whatPaintColor(examStatusList.get(0))); |
| | | } |
| | | return false; |
| | | } |
| | | }); |
| | | |
| | | @Nullable |
| | | @Override |
| | |
| | | }); |
| | | |
| | | |
| | | examStatusViewModel = ViewModelProviders.of(this).get(ExamStatusViewModel.class); |
| | | examStatusViewModel.getExamStatus().observe(this, new Observer<List<ExamStatus>>() { |
| | | @Override |
| | | public void onChanged(List<ExamStatus> examStatus) { |
| | | |
| | | for (ExamStatus e : |
| | | examStatus) { |
| | | Log.i(TAG, "onChanged: e="+e.toString()); |
| | | } |
| | | Log.i(TAG, "onChanged: "); |
| | | examStatusList.clear(); |
| | | examStatusList.addAll(examStatus); |
| | | mHandler.obtainMessage(ADD_DATA).sendToTarget(); |
| | | |
| | | } |
| | | }); |
| | | |
| | | return view; |
| | | } |
| | | |
| | | private int whatPaintColor(ExamStatus examStatus) { |
| | | int map_id = examStatus.getMap_id(); |
| | | int status = examStatus.getEnter(); |
| | | private int whatPaintColor(ExamStatus examStat) { |
| | | int map_id = examStat.getMap_id(); |
| | | int status = examStat.getEnter(); |
| | | Log.i(TAG, "whatPaintColor: map_id="+map_id+" status="+status); |
| | | switch (status) { |
| | | case 0://考试完成 |
| | | switch (map_id) { |
| | |
| | | av_zhijiao = view.findViewById(R.id.av1); |
| | | houseView = view.findViewById(R.id.hv); |
| | | //粉红色正在进行该项目的考试 |
| | | examStatusList.add(new ExamStatus(1, 0)); |
| | | examStatusList.add(new ExamStatus(2, 1)); |
| | | examStatusList.add(new ExamStatus(3, 0)); |
| | | examStatusList.add(new ExamStatus(4, 2)); |
| | | examStatusList.add(new ExamStatus(5, 1)); |
| | | // examStatusList.add(new ExamStatus(1, 0)); |
| | | // examStatusList.add(new ExamStatus(2, 1)); |
| | | // examStatusList.add(new ExamStatus(3, 0)); |
| | | // examStatusList.add(new ExamStatus(4, 2)); |
| | | // examStatusList.add(new ExamStatus(5, 1)); |
| | | |
| | | |
| | | av_curve.setColor(whatPaintColor(examStatusList.get(3))); |
| | | av_zhijiao.setColor(whatPaintColor(examStatusList.get(4))); |
| | | av_podao.setColor(whatPaintColor(examStatusList.get(1))); |
| | | av_park.setColor(whatPaintColor(examStatusList.get(2))); |
| | | houseView.setColor(whatPaintColor(examStatusList.get(0))); |
| | | // mHandler.obtainMessage(ADD_DATA).sendToTarget(); |
| | | // av_curve.setColor(whatPaintColor(examStatusList.get(3))); |
| | | // av_zhijiao.setColor(whatPaintColor(examStatusList.get(4))); |
| | | // av_podao.setColor(whatPaintColor(examStatusList.get(1))); |
| | | // av_park.setColor(whatPaintColor(examStatusList.get(2))); |
| | | // houseView.setColor(whatPaintColor(examStatusList.get(0))); |
| | | |
| | | mListView = view.findViewById(R.id.lv); |
| | | mListView.setFocusable(false); |