| | |
| | | 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.StraightLineSetting; |
| | | import safeluck.drive.evaluation.fragment.rulefragments.cview.TextEditText; |
| | | import safeluck.drive.evaluation.viewmodels.CommonSettingViewModel; |
| | | import safeluck.drive.evaluation.viewmodels.StraightLineSettingViewModel; |
| | | |
| | | /** |
| | | * DriveJudge |
| | | * |
| | | * 直线行驶设置 |
| | | * Created by lzw on 2020/9/14. 10:16:39 |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | |
| | | |
| | | |
| | | private int mNumber; |
| | | |
| | | private TextEditText te_straight_limit_distance; |
| | | private TextEditText te_straight_max_offset; |
| | | |
| | | private StraightLineSetting mStrarightLineSetting; |
| | | private StraightLineSettingViewModel straightLineSettingViewModel; |
| | | |
| | | public static FragmentSetting4 newInstance(String number) { |
| | | FragmentSetting4 fragment = new FragmentSetting4(); |
| | |
| | | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
| | | View view = inflater.inflate(R.layout.layout_fragment_straight_line, container, false); |
| | | initView(view); |
| | | straightLineSettingViewModel = ViewModelProviders.of(this).get(StraightLineSettingViewModel.class); |
| | | straightLineSettingViewModel.getStraightLineSetting().observe(this, new Observer<StraightLineSetting>() { |
| | | @Override |
| | | public void onChanged(StraightLineSetting commonSetting) { |
| | | if (commonSetting != null){ |
| | | mStrarightLineSetting = commonSetting; |
| | | setDatas(); |
| | | } |
| | | } |
| | | }); |
| | | return view; |
| | | } |
| | | |
| | | private void initView(View view) { |
| | | |
| | | te_straight_limit_distance = view.findViewById(R.id.straight_limit_distance); |
| | | te_straight_max_offset = view.findViewById(R.id.straight_max_offset); |
| | | |
| | | } |
| | | |
| | | private void setDatas() { |
| | | te_straight_limit_distance.setInput(String.valueOf(mStrarightLineSetting.getStraight_limit_distance())); |
| | | te_straight_max_offset.setInput(String.valueOf(mStrarightLineSetting.getStraight_max_offset())); |
| | | } |
| | | } |