| | |
| | | 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.SubDecGearSetting; |
| | | import safeluck.drive.evaluation.fragment.rulefragments.cview.TextEditText; |
| | | import safeluck.drive.evaluation.viewmodels.CommonSettingViewModel; |
| | | import safeluck.drive.evaluation.viewmodels.SubDecGearSettingViewModel; |
| | | |
| | | /** |
| | | * DriveJudge |
| | |
| | | |
| | | |
| | | private int mNumber; |
| | | |
| | | |
| | | private TextEditText te_shift_limit_distance; |
| | | private TextEditText te_road_shift_hold_time; |
| | | |
| | | private SubDecGearSetting mSubGearSetting; |
| | | private SubDecGearSettingViewModel subDecGearSettingViewModel; |
| | | |
| | | public static FragmentSetting8 newInstance(String number) { |
| | | FragmentSetting8 fragment = new FragmentSetting8(); |
| | |
| | | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
| | | View view = inflater.inflate(R.layout.fragment_add_sub_gear_setting_1, container, false); |
| | | initView(view); |
| | | subDecGearSettingViewModel = ViewModelProviders.of(this).get(SubDecGearSettingViewModel.class); |
| | | subDecGearSettingViewModel.getSubDecGearSetting().observe(this, new Observer<SubDecGearSetting>() { |
| | | @Override |
| | | public void onChanged(SubDecGearSetting commonSetting) { |
| | | if (commonSetting != null){ |
| | | mSubGearSetting = commonSetting; |
| | | setDatas(); |
| | | } |
| | | } |
| | | }); |
| | | return view; |
| | | } |
| | | |
| | | private void initView(View view) { |
| | | |
| | | |
| | | te_shift_limit_distance = view.findViewById(R.id.shift_limit_distance); |
| | | te_road_shift_hold_time =view.findViewById(R.id.road_shift_hold_time); |
| | | } |
| | | |
| | | private void setDatas() { |
| | | if (mSubGearSetting != null){ |
| | | te_shift_limit_distance.setInput(String.valueOf(mSubGearSetting.getShift_limit_distance())); |
| | | te_road_shift_hold_time.setInput(String.valueOf(mSubGearSetting.getShift_hold_time())); |
| | | } |
| | | } |
| | | } |