| | |
| | | |
| | | 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; |
| | | |
| | | private double speed=0.0; |
| | | |
| | | private Handler mHandler = new Handler(new Handler.Callback() { |
| | | @Override |
| | |
| | | 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(); |
| | |
| | | houseView = view.findViewById(R.id.hv); |
| | | |
| | | tv_speed = view.findViewById(R.id.tv_speed); |
| | | tv_speed.setText(getResources().getString(R.string.speed,123.4)); |
| | | 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); |
| | | } |
| | | } |