| | |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.widget.Toast; |
| | | |
| | | import androidx.annotation.Nullable; |
| | | import androidx.lifecycle.Observer; |
| | | import androidx.lifecycle.ViewModelProviders; |
| | | |
| | | import com.anyun.exam.lib.AYSdk; |
| | | import com.google.gson.Gson; |
| | | |
| | | import me.yokeyword.fragmentation.SupportFragment; |
| | | import safeluck.drive.evaluation.Constant; |
| | | 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.util.Utils; |
| | | import safeluck.drive.evaluation.viewmodels.CommonSettingViewModel; |
| | | import safeluck.drive.evaluation.viewmodels.StationSettingViewModel; |
| | | |
| | |
| | | public class FragmentSetting5 extends SupportFragment { |
| | | private static final String ARG_NUMBER = "arg_number"; |
| | | private static final String TAG = FragmentSetting5.class.getSimpleName(); |
| | | |
| | | private Gson gson = new Gson(); |
| | | private StationSetting mStationSetting; |
| | | private StationSettingViewModel mStationSettingViewModel; |
| | | |
| | |
| | | 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); |
| | | |
| | | view.findViewById(R.id.btn_setting_save).setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | String teCrossSchoolMaxSpeedInput = te_cross_school_max_speed.getInput(); |
| | | String teCrossingBreakValidDistanceInput = te_crossing_break_valid_distance.getInput(); |
| | | String teCrossingStopValidDistanceInput = te_crossing_stop_valid_distance.getInput(); |
| | | if (mStationSetting != null){ |
| | | if (Utils.isDigital(teCrossingBreakValidDistanceInput)){ |
| | | mStationSetting.setCrossing_break_valid_distance(Integer.parseInt(teCrossingBreakValidDistanceInput)); |
| | | } if (Utils.isDigital(teCrossSchoolMaxSpeedInput)){ |
| | | mStationSetting.setCross_school_max_speed(Integer.parseInt(teCrossSchoolMaxSpeedInput)); |
| | | } if (Utils.isNumber(teCrossingStopValidDistanceInput)){ |
| | | mStationSetting.setCrossing_stop_valid_distance(Double.parseDouble(teCrossingStopValidDistanceInput)); |
| | | } |
| | | mStationSettingViewModel.saveCommonSetting(mStationSetting); |
| | | Toast.makeText(_mActivity, "通过站点设置成功", Toast.LENGTH_SHORT).show(); |
| | | AYSdk.getInstance().sendCmd(Constant.ID_judge_args,gson.toJson(mStationSetting)); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | private void setDatas() { |