| | |
| | | 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.SideStopSetting; |
| | | 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.SideStopSettingViewModel; |
| | | |
| | |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | | */ |
| | | public class FragmentSetting9 extends SupportFragment { |
| | | private Gson gson = new Gson(); |
| | | private static final String ARG_NUMBER = "arg_number"; |
| | | private static final String TAG = FragmentSetting9.class.getSimpleName(); |
| | | |
| | |
| | | te_stop_car_limit_distance = view.findViewById(R.id.stop_car_limit_distance); |
| | | te_stop_car_edge_red_distance = view.findViewById(R.id.stop_car_edge_red_distance); |
| | | te_stop_car_edge_yellow_distance = view.findViewById(R.id.stop_car_edge_yellow_distance); |
| | | view.findViewById(R.id.btn_setting_save).setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | String teRoadMaxSpeedInput = te_road_max_speed.getInput(); |
| | | String teRoadTotalDistanceInput = te_road_total_distance.getInput(); |
| | | String teStopCarOpenDoorAllowTimeInput = te_stop_car_open_door_allow_time.getInput(); |
| | | String teStopCarLimitDistanceInput = te_stop_car_limit_distance.getInput(); |
| | | String teStopCarEdgeRedDistanceInput = te_stop_car_edge_red_distance.getInput(); |
| | | String teStopCarEdgeYellowDistanceInput = te_stop_car_edge_yellow_distance.getInput(); |
| | | |
| | | if (mSideStopSetting!=null){ |
| | | if (Utils.isDigital(teRoadTotalDistanceInput)){ |
| | | mSideStopSetting.setRoad_total_distance(Integer.parseInt(teRoadTotalDistanceInput)); |
| | | } |
| | | if (Utils.isDigital(teRoadMaxSpeedInput)){ |
| | | mSideStopSetting.setRoad_max_speed(Integer.parseInt(teRoadMaxSpeedInput)); |
| | | } |
| | | if (Utils.isDigital(teStopCarOpenDoorAllowTimeInput)){ |
| | | mSideStopSetting.setStop_car_open_door_allow_time(Integer.parseInt(teStopCarOpenDoorAllowTimeInput)); |
| | | } |
| | | if (Utils.isDigital(teStopCarLimitDistanceInput)){ |
| | | mSideStopSetting.setStop_car_limit_distance(Integer.parseInt(teStopCarLimitDistanceInput)); |
| | | } |
| | | if (Utils.isNumber(teStopCarEdgeRedDistanceInput)){ |
| | | mSideStopSetting.setStop_car_edge_red_distance(Double.parseDouble(teStopCarEdgeRedDistanceInput)); |
| | | } |
| | | if (Utils.isNumber(teStopCarEdgeYellowDistanceInput)){ |
| | | mSideStopSetting.setStop_car_edge_yellow_distance(Double.parseDouble(teStopCarEdgeYellowDistanceInput)); |
| | | } |
| | | |
| | | |
| | | mSideStopSettingViewModel.saveSideStopSetting(mSideStopSetting); |
| | | Toast.makeText(_mActivity, "靠边停车设置", Toast.LENGTH_SHORT).show(); |
| | | AYSdk.getInstance().sendCmd(Constant.ID_judge_args,gson.toJson(mSideStopSetting)); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | private void setDatas() { |