| | |
| | | import android.view.ViewGroup; |
| | | |
| | | import androidx.annotation.Nullable; |
| | | import androidx.lifecycle.Observer; |
| | | import androidx.lifecycle.ViewModelProviders; |
| | | |
| | | import me.yokeyword.fragmentation.SupportFragment; |
| | | import safeluck.drive.evaluation.R; |
| | | import safeluck.drive.evaluation.bean.CommonSetting; |
| | | import safeluck.drive.evaluation.bean.StationSetting; |
| | | import safeluck.drive.evaluation.fragment.rulefragments.cview.TextEditText; |
| | | import safeluck.drive.evaluation.viewmodels.CommonSettingViewModel; |
| | | import safeluck.drive.evaluation.viewmodels.StationSettingViewModel; |
| | | |
| | | /** |
| | | * DriveJudge |
| | | * |
| | | * 通过站点设置 |
| | | * Created by lzw on 2020/9/14. 10:16:39 |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | |
| | | private static final String ARG_NUMBER = "arg_number"; |
| | | private static final String TAG = FragmentSetting5.class.getSimpleName(); |
| | | |
| | | private StationSetting mStationSetting; |
| | | private StationSettingViewModel mStationSettingViewModel; |
| | | |
| | | private TextEditText te_cross_school_max_speed; |
| | | private TextEditText te_crossing_break_valid_distance; |
| | | private TextEditText te_crossing_stop_valid_distance; |
| | | |
| | | private int mNumber; |
| | | |
| | |
| | | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
| | | View view = inflater.inflate(R.layout.layout_fragment_stationsettin, container, false); |
| | | initView(view); |
| | | mStationSettingViewModel = ViewModelProviders.of(this).get(StationSettingViewModel.class); |
| | | mStationSettingViewModel.getStationSetting().observe(this, new Observer<StationSetting>() { |
| | | @Override |
| | | public void onChanged(StationSetting commonSetting) { |
| | | if (commonSetting != null){ |
| | | mStationSetting = commonSetting; |
| | | setDatas(); |
| | | } |
| | | } |
| | | }); |
| | | return view; |
| | | } |
| | | |
| | | private void initView(View view) { |
| | | |
| | | te_cross_school_max_speed = view.findViewById(R.id.cross_school_max_speed); |
| | | te_crossing_break_valid_distance = view.findViewById(R.id.crossing_break_valid_distance); |
| | | te_crossing_stop_valid_distance = view.findViewById(R.id.crossing_stop_valid_distance); |
| | | |
| | | } |
| | | |
| | | private void setDatas() { |
| | | te_cross_school_max_speed.setInput(String.valueOf(mStationSetting.getCross_school_max_speed())); |
| | | te_crossing_break_valid_distance.setInput(String.valueOf(mStationSetting.getCrossing_break_valid_distance())); |
| | | te_crossing_stop_valid_distance.setInput(String.valueOf(mStationSetting.getCrossing_stop_valid_distance())); |
| | | } |
| | | } |