| | |
| | | |
| | | import me.yokeyword.fragmentation.SupportFragment; |
| | | import safeluck.drive.evaluation.Constant; |
| | | import safeluck.drive.evaluation.MainActivity; |
| | | import safeluck.drive.evaluation.R; |
| | | import safeluck.drive.evaluation.bean.ExamPlatformData; |
| | | import safeluck.drive.evaluation.util.FileUtil; |
| | |
| | | private Button btn_config_signal; |
| | | private Button btn_mcu_upgrade; |
| | | private EditText et_ip,et_port; |
| | | private ExamPlatformModel examPlatformModel; |
| | | // private ExamPlatformModel examPlatformModel; |
| | | public static SupportFragment newInstance() { |
| | | return new BaseDatasFragment(); |
| | | } |
| | |
| | | |
| | | View view = inflater.inflate(R.layout.layout_base_datas, container, false); |
| | | initView(view); |
| | | examPlatformModel = ViewModelProviders.of(this).get(ExamPlatformModel.class); |
| | | // examPlatformModel = ViewModelProviders.of(this).get(ExamPlatformModel.class); |
| | | return view; |
| | | } |
| | | |
| | |
| | | view.findViewById(R.id.btn_save_platform).setOnClickListener(this); |
| | | et_ip = view.findViewById(R.id.et_platform_ip); |
| | | et_port = view.findViewById(R.id.et_platform_port); |
| | | et_ip.setText(ExamPlatformData.getInstance().getPlatformIP()); |
| | | et_port.setText(ExamPlatformData.getInstance().getPlatformPort()+""); |
| | | btn_inspect_signal = view.findViewById(R.id.btn_inpsect_signal); |
| | | btn_mcu_upgrade = view.findViewById(R.id.btn_mcu_upgrade); |
| | | btn_mcu_upgrade.setOnClickListener(this); |
| | |
| | | break; |
| | | case R.id.btn_save_platform: |
| | | if(ExamPlatformData.getInstance().compareIPandPort(et_ip.getText().toString().trim(),Integer.parseInt(et_port.getText().toString().trim()))){ |
| | | examPlatformModel.changeDataValue(1); |
| | | ((MainActivity)getActivity()).examPlatformModel.getDataChange().postValue(1); |
| | | ExamPlatformData.getInstance().insertPlatformIp(et_ip.getText().toString().trim()); |
| | | ExamPlatformData.getInstance().insertPlatformPort(Integer.parseInt(et_port.getText().toString().trim())); |
| | | } |