| | |
| | | import android.view.ViewGroup; |
| | | import android.widget.Button; |
| | | import android.widget.ListView; |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import com.anyun.exam.lib.AYSdk; |
| | |
| | | |
| | | private ExamStatusViewModel examStatusViewModel; |
| | | private static final int ADD_DATA = 1; |
| | | private static final int SPEED_DATA = 2; |
| | | |
| | | private List<ScoreBean> mArrayList = new ArrayList<>(); |
| | | private View tv_stop; |
| | | |
| | | private TextView tv_speed,tv_total_score; |
| | | private int currTotalScore = 100; |
| | | private double speed=0.0; |
| | | |
| | | private Handler mHandler = new Handler(new Handler.Callback() { |
| | | @Override |
| | | public boolean handleMessage(Message msg) { |
| | | if (msg.what == ADD_DATA){ |
| | | tv_total_score.setText(getResources().getString(R.string.total_score,currTotalScore)); |
| | | houseView.setColor(whatPaintColor(examStatusList.get(0))); |
| | | av_podao.setColor(whatPaintColor(examStatusList.get(1))); |
| | | av_park.setColor(whatPaintColor(examStatusList.get(2))); |
| | | av_curve.setColor(whatPaintColor(examStatusList.get(3))); |
| | | av_zhijiao.setColor(whatPaintColor(examStatusList.get(4))); |
| | | } |
| | | if (msg.what == SPEED_DATA){ |
| | | tv_speed.setText(getResources().getString(R.string.speed,speed)); |
| | | } |
| | | return false; |
| | | } |
| | | }); |
| | | |
| | | |
| | | @Override |
| | | public void onAttach(Context context) { |
| | | super.onAttach(context); |
| | | } |
| | | |
| | | @Override |
| | | public void onDetach() { |
| | | super.onDetach(); |
| | | } |
| | | |
| | | public static SupportFragment newInstance(){ |
| | | return new TrainFragment(); |
| | |
| | | mArrayList.add(new ScoreBean(f.getScore_deducting(), f.getItem_content(), f.getDeducting_reason())); |
| | | item_conents.add(f.getItem_content()); |
| | | mScoreAdapter.addDatas(mArrayList); |
| | | } |
| | | currTotalScore -=item_id; |
| | | if (currTotalScore < Constant.PASSING_SCORE){ |
| | | MyLog.i(TAG,"低于80,不合格"); |
| | | } |
| | | |
| | | MyLog.i(TAG,"监测到有失败项目加入,通知UI更新颜色"); |
| | |
| | | av_zhijiao = view.findViewById(R.id.av4); |
| | | houseView = view.findViewById(R.id.hv); |
| | | |
| | | tv_speed = view.findViewById(R.id.tv_speed); |
| | | tv_total_score = view.findViewById(R.id.tv_total_score); |
| | | tv_speed.setText(getResources().getString(R.string.speed,speed)); |
| | | view.findViewById(R.id.btn_return).setOnClickListener(this); |
| | | mListView = view.findViewById(R.id.lv); |
| | | tv_stop = view.findViewById(R.id.tv_stop); |
| | |
| | | break; |
| | | } |
| | | } |
| | | |
| | | private ICEventListener icEventListener = new ICEventListener() { |
| | | @Override |
| | | public void onCEvent(String topic, int msgCode, int resultCode, Object obj) { |
| | | speed = (double)obj; |
| | | mHandler.obtainMessage(SPEED_DATA).sendToTarget(); |
| | | } |
| | | }; |
| | | @Override |
| | | public void onAttach(Context context) { |
| | | super.onAttach(context); |
| | | CEventCenter.onBindEvent(true,icEventListener,Constant.BIND_SPEED_TOPIC); |
| | | } |
| | | |
| | | @Override |
| | | public void onDetach() { |
| | | super.onDetach(); |
| | | CEventCenter.onBindEvent(false,icEventListener,Constant.BIND_SPEED_TOPIC); |
| | | } |
| | | } |