| | |
| | | package safeluck.drive.evaluation.fragment; |
| | | |
| | | import android.content.Context; |
| | | import android.os.Bundle; |
| | | |
| | | import android.os.Handler; |
| | |
| | | import safeluck.drive.evaluation.adapter.ScoreAdapter; |
| | | import safeluck.drive.evaluation.DB.exam_status.ExamStatus; |
| | | import safeluck.drive.evaluation.bean.ScoreBean; |
| | | import safeluck.drive.evaluation.cEventCenter.CEventCenter; |
| | | import safeluck.drive.evaluation.cEventCenter.ICEventListener; |
| | | import safeluck.drive.evaluation.customview.ArrowView; |
| | | import safeluck.drive.evaluation.customview.HouseView; |
| | | |
| | |
| | | private ExamStatusViewModel examStatusViewModel; |
| | | private static final int ADD_DATA = 1; |
| | | private TextView tv_speed; |
| | | private double speed=0.0; |
| | | |
| | | private List<ScoreBean> mArrayList = new ArrayList<>(); |
| | | private static final int SPEED_DATA = 2; |
| | | |
| | | public static SupportFragment newInstance() { |
| | | return new NetWorkTrainFragment(); |
| | |
| | | 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; |
| | | } |
| | |
| | | houseView = view.findViewById(R.id.hv); |
| | | |
| | | tv_speed = view.findViewById(R.id.tv_speed); |
| | | tv_speed.setText(getResources().getString(R.string.speed,56.5)); |
| | | tv_speed.setText(getResources().getString(R.string.speed,speed)); |
| | | |
| | | view.findViewById(R.id.btn_return).setOnClickListener(this); |
| | | mListView = view.findViewById(R.id.lv); |
| | |
| | | } |
| | | } |
| | | |
| | | 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); |
| | | } |
| | | } |