| | |
| | | import android.os.Bundle; |
| | | import androidx.annotation.NonNull; |
| | | import androidx.annotation.Nullable; |
| | | import androidx.lifecycle.ViewModelProviders; |
| | | |
| | | import android.util.Log; |
| | | import android.view.LayoutInflater; |
| | |
| | | import safeluck.drive.evaluation.R; |
| | | import safeluck.drive.evaluation.bean.ExamPlatformData; |
| | | import safeluck.drive.evaluation.util.FileUtil; |
| | | import safeluck.drive.evaluation.viewmodels.ExamPlatformModel; |
| | | |
| | | /** |
| | | * 基础数据设置 |
| | |
| | | private Button btn_config_signal; |
| | | private Button btn_mcu_upgrade; |
| | | private EditText et_ip,et_port; |
| | | |
| | | 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); |
| | | return view; |
| | | } |
| | | |
| | | private void initView(View view) { |
| | | view.findViewById(R.id.btn_save_platform); |
| | | 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); |
| | | btn_inspect_signal = view.findViewById(R.id.btn_inpsect_signal); |
| | |
| | | } |
| | | break; |
| | | case R.id.btn_save_platform: |
| | | ExamPlatformData.getInstance().insertPlatformIp(et_ip.getText().toString().trim()); |
| | | ExamPlatformData.getInstance().insertPlatformPort(Integer.parseInt(et_port.getText().toString().trim())); |
| | | if(ExamPlatformData.getInstance().compareIPandPort(et_ip.getText().toString().trim(),Integer.parseInt(et_port.getText().toString().trim()))){ |
| | | examPlatformModel.changeDataValue(1); |
| | | ExamPlatformData.getInstance().insertPlatformIp(et_ip.getText().toString().trim()); |
| | | ExamPlatformData.getInstance().insertPlatformPort(Integer.parseInt(et_port.getText().toString().trim())); |
| | | } |
| | | break; |
| | | default: |
| | | break; |