Commit ff29c54f37a7da43269e9e3ff51d0dfc7d1759e6
1 parent
13c34975
1.修改报名页面相关逻辑
Showing
6 changed files
with
143 additions
and
37 deletions
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/presenter/CollRunningMapFragmentPresenter.java
| @@ -46,6 +46,7 @@ import com.baidu.trace.model.StatusCodes; | @@ -46,6 +46,7 @@ import com.baidu.trace.model.StatusCodes; | ||
| 46 | import com.baidu.trace.model.TraceLocation; | 46 | import com.baidu.trace.model.TraceLocation; |
| 47 | import com.baidu.trace.model.TransportMode; | 47 | import com.baidu.trace.model.TransportMode; |
| 48 | import com.cnlive.moudle.collectionTrace.frame.view.CollRunningMapFragmentView; | 48 | import com.cnlive.moudle.collectionTrace.frame.view.CollRunningMapFragmentView; |
| 49 | +import com.cnlive.moudle.pedometer.model.Constant; | ||
| 49 | import com.cnlive.moudle.pedometer.service.StepService; | 50 | import com.cnlive.moudle.pedometer.service.StepService; |
| 50 | import com.cnlive.moudle.pedometer.utils.CommonUtil; | 51 | import com.cnlive.moudle.pedometer.utils.CommonUtil; |
| 51 | import com.cnlive.moudle.pedometer.utils.GsonUtil; | 52 | import com.cnlive.moudle.pedometer.utils.GsonUtil; |
| @@ -68,8 +69,6 @@ public class CollRunningMapFragmentPresenter extends MvpBasePresenter<CollRunnin | @@ -68,8 +69,6 @@ public class CollRunningMapFragmentPresenter extends MvpBasePresenter<CollRunnin | ||
| 68 | private int realTimePageSize = 1000; | 69 | private int realTimePageSize = 1000; |
| 69 | //分页索引 | 70 | //分页索引 |
| 70 | private int realTimePageIndex = 1; | 71 | private int realTimePageIndex = 1; |
| 71 | - //查询标识 | ||
| 72 | - private int tag = 1; | ||
| 73 | /** | 72 | /** |
| 74 | * 历史轨迹请求 | 73 | * 历史轨迹请求 |
| 75 | */ | 74 | */ |
| @@ -115,7 +114,7 @@ public class CollRunningMapFragmentPresenter extends MvpBasePresenter<CollRunnin | @@ -115,7 +114,7 @@ public class CollRunningMapFragmentPresenter extends MvpBasePresenter<CollRunnin | ||
| 115 | } | 114 | } |
| 116 | 115 | ||
| 117 | if (historyTrackRequest == null) { | 116 | if (historyTrackRequest == null) { |
| 118 | - historyTrackRequest = new HistoryTrackRequest(tag, StepService.serviceId, entityName); | 117 | + historyTrackRequest = new HistoryTrackRequest(Constant.TAG, Constant.SERVICE_ID, entityName); |
| 119 | //设置查询设备名称 | 118 | //设置查询设备名称 |
| 120 | historyTrackRequest.setEntityName(entityName); | 119 | historyTrackRequest.setEntityName(entityName); |
| 121 | //历史轨迹开始时间 | 120 | //历史轨迹开始时间 |
| @@ -151,7 +150,7 @@ public class CollRunningMapFragmentPresenter extends MvpBasePresenter<CollRunnin | @@ -151,7 +150,7 @@ public class CollRunningMapFragmentPresenter extends MvpBasePresenter<CollRunnin | ||
| 151 | //创建里程查询 | 150 | //创建里程查询 |
| 152 | if (distanceRequest == null) { | 151 | if (distanceRequest == null) { |
| 153 | // 创建里程查询请求实例 | 152 | // 创建里程查询请求实例 |
| 154 | - distanceRequest = new DistanceRequest(tag, StepService.serviceId, entityName); | 153 | + distanceRequest = new DistanceRequest(Constant.TAG, Constant.SERVICE_ID, entityName); |
| 155 | // 设置开始时间 | 154 | // 设置开始时间 |
| 156 | distanceRequest.setStartTime(startTime); | 155 | distanceRequest.setStartTime(startTime); |
| 157 | // 设置结束时间 | 156 | // 设置结束时间 |
| @@ -293,8 +292,8 @@ public class CollRunningMapFragmentPresenter extends MvpBasePresenter<CollRunnin | @@ -293,8 +292,8 @@ public class CollRunningMapFragmentPresenter extends MvpBasePresenter<CollRunnin | ||
| 293 | List<String> names = new ArrayList<>(); | 292 | List<String> names = new ArrayList<>(); |
| 294 | names.add(entityName); | 293 | names.add(entityName); |
| 295 | realTimeListRequest = new LocRequest(); | 294 | realTimeListRequest = new LocRequest(); |
| 296 | - realTimeListRequest.setServiceId(StepService.serviceId); | ||
| 297 | - realTimeListRequest.setTag(1); | 295 | + realTimeListRequest.setServiceId(Constant.SERVICE_ID); |
| 296 | + realTimeListRequest.setTag(Constant.TAG); | ||
| 298 | } | 297 | } |
| 299 | if (realTimePoints == null) { | 298 | if (realTimePoints == null) { |
| 300 | realTimePoints = new ArrayList<>(); | 299 | realTimePoints = new ArrayList<>(); |
| @@ -480,7 +479,7 @@ public class CollRunningMapFragmentPresenter extends MvpBasePresenter<CollRunnin | @@ -480,7 +479,7 @@ public class CollRunningMapFragmentPresenter extends MvpBasePresenter<CollRunnin | ||
| 480 | // } | 479 | // } |
| 481 | // } | 480 | // } |
| 482 | 481 | ||
| 483 | - FenceListRequest request = FenceListRequest.buildServerRequest(tag, StepService.serviceId, "yangshuai", null, CoordType.gcj02); | 482 | + FenceListRequest request = FenceListRequest.buildServerRequest(Constant.TAG, Constant.SERVICE_ID, "yangshuai", null, CoordType.gcj02); |
| 484 | 483 | ||
| 485 | //发起查询围栏请求 | 484 | //发起查询围栏请求 |
| 486 | if (StepService.mClient != null) { | 485 | if (StepService.mClient != null) { |
| @@ -489,8 +488,8 @@ public class CollRunningMapFragmentPresenter extends MvpBasePresenter<CollRunnin | @@ -489,8 +488,8 @@ public class CollRunningMapFragmentPresenter extends MvpBasePresenter<CollRunnin | ||
| 489 | 488 | ||
| 490 | List<Long> fenid = new ArrayList<>(); | 489 | List<Long> fenid = new ArrayList<>(); |
| 491 | fenid.add(1L); | 490 | fenid.add(1L); |
| 492 | - MonitoredStatusRequest request1 = MonitoredStatusRequest.buildServerRequest(tag, | ||
| 493 | - StepService.serviceId, "yangshuai", fenid); | 491 | + MonitoredStatusRequest request1 = MonitoredStatusRequest.buildServerRequest(Constant.TAG, |
| 492 | + Constant.SERVICE_ID, "yangshuai", fenid); | ||
| 494 | Handler handler = new Handler(); | 493 | Handler handler = new Handler(); |
| 495 | Runnable runnable = new Runnable() { | 494 | Runnable runnable = new Runnable() { |
| 496 | @Override | 495 | @Override |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/service/CollStepService.java
| @@ -139,12 +139,6 @@ public class CollStepService extends Service implements SensorEventListener { | @@ -139,12 +139,6 @@ public class CollStepService extends Service implements SensorEventListener { | ||
| 139 | * 轨迹监听器(用于接收纠偏后实时位置回调) | 139 | * 轨迹监听器(用于接收纠偏后实时位置回调) |
| 140 | */ | 140 | */ |
| 141 | private OnTrackListener realTimeTraceListener = null; | 141 | private OnTrackListener realTimeTraceListener = null; |
| 142 | - //位置采集周期 | ||
| 143 | - private int gatherInterval = 3; | ||
| 144 | - //打包周期 | ||
| 145 | - private int packInterval = 10; | ||
| 146 | - // 轨迹服务ID | ||
| 147 | - public static final long serviceId = 213511; | ||
| 148 | // public static final long serviceId = 213553;//杨帅 | 142 | // public static final long serviceId = 213553;//杨帅 |
| 149 | 143 | ||
| 150 | // 设备标识 | 144 | // 设备标识 |
| @@ -179,12 +173,12 @@ public class CollStepService extends Service implements SensorEventListener { | @@ -179,12 +173,12 @@ public class CollStepService extends Service implements SensorEventListener { | ||
| 179 | if (mClient == null) { | 173 | if (mClient == null) { |
| 180 | mClient = new LBSTraceClient(getApplicationContext()); | 174 | mClient = new LBSTraceClient(getApplicationContext()); |
| 181 | // 设置定位和打包周期 | 175 | // 设置定位和打包周期 |
| 182 | - mClient.setInterval(gatherInterval, packInterval); | 176 | + mClient.setInterval(Constant.GATHER_INTERVAL, Constant.PACK_INTERVAL); |
| 183 | //设置定位模式 | 177 | //设置定位模式 |
| 184 | mClient.setLocationMode(LocationMode.High_Accuracy); | 178 | mClient.setLocationMode(LocationMode.High_Accuracy); |
| 185 | } | 179 | } |
| 186 | if (mTrace == null) { | 180 | if (mTrace == null) { |
| 187 | - mTrace = new Trace(serviceId, entityName); | 181 | + mTrace = new Trace(Constant.SERVICE_ID, entityName); |
| 188 | } | 182 | } |
| 189 | //初始化实时轨迹监听器 | 183 | //初始化实时轨迹监听器 |
| 190 | realTimeTraceListener = new OnTrackListener() { | 184 | realTimeTraceListener = new OnTrackListener() { |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/RunningMapFragmentPresenter.java
| @@ -134,7 +134,7 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | @@ -134,7 +134,7 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | ||
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | if (historyTrackRequest == null) { | 136 | if (historyTrackRequest == null) { |
| 137 | - historyTrackRequest = new HistoryTrackRequest(tag, StepService.serviceId, entityName); | 137 | + historyTrackRequest = new HistoryTrackRequest(tag, Constant.SERVICE_ID, entityName); |
| 138 | //设置查询设备名称 | 138 | //设置查询设备名称 |
| 139 | historyTrackRequest.setEntityName(entityName); | 139 | historyTrackRequest.setEntityName(entityName); |
| 140 | //历史轨迹开始时间 | 140 | //历史轨迹开始时间 |
| @@ -170,7 +170,7 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | @@ -170,7 +170,7 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | ||
| 170 | //创建里程查询 | 170 | //创建里程查询 |
| 171 | if (distanceRequest == null) { | 171 | if (distanceRequest == null) { |
| 172 | // 创建里程查询请求实例 | 172 | // 创建里程查询请求实例 |
| 173 | - distanceRequest = new DistanceRequest(tag, StepService.serviceId, entityName); | 173 | + distanceRequest = new DistanceRequest(tag, Constant.SERVICE_ID, entityName); |
| 174 | // 设置开始时间 | 174 | // 设置开始时间 |
| 175 | distanceRequest.setStartTime(startTime); | 175 | distanceRequest.setStartTime(startTime); |
| 176 | // 设置结束时间 | 176 | // 设置结束时间 |
| @@ -317,7 +317,7 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | @@ -317,7 +317,7 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | ||
| 317 | List<String> names = new ArrayList<>(); | 317 | List<String> names = new ArrayList<>(); |
| 318 | names.add(entityName); | 318 | names.add(entityName); |
| 319 | realTimeListRequest = new LocRequest(); | 319 | realTimeListRequest = new LocRequest(); |
| 320 | - realTimeListRequest.setServiceId(StepService.serviceId); | 320 | + realTimeListRequest.setServiceId(Constant.SERVICE_ID); |
| 321 | realTimeListRequest.setTag(1); | 321 | realTimeListRequest.setTag(1); |
| 322 | } | 322 | } |
| 323 | if (realTimePoints == null) { | 323 | if (realTimePoints == null) { |
| @@ -504,7 +504,7 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | @@ -504,7 +504,7 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | ||
| 504 | // } | 504 | // } |
| 505 | // } | 505 | // } |
| 506 | 506 | ||
| 507 | - FenceListRequest request = FenceListRequest.buildServerRequest(tag, StepService.serviceId, "yangshuai", null, CoordType.gcj02); | 507 | + FenceListRequest request = FenceListRequest.buildServerRequest(tag, Constant.SERVICE_ID, "yangshuai", null, CoordType.gcj02); |
| 508 | 508 | ||
| 509 | //发起查询围栏请求 | 509 | //发起查询围栏请求 |
| 510 | if (StepService.mClient != null) { | 510 | if (StepService.mClient != null) { |
| @@ -514,7 +514,7 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | @@ -514,7 +514,7 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | ||
| 514 | List<Long> fenid = new ArrayList<>(); | 514 | List<Long> fenid = new ArrayList<>(); |
| 515 | fenid.add(1L); | 515 | fenid.add(1L); |
| 516 | MonitoredStatusRequest request1 = MonitoredStatusRequest.buildServerRequest(tag, | 516 | MonitoredStatusRequest request1 = MonitoredStatusRequest.buildServerRequest(tag, |
| 517 | - StepService.serviceId, "yangshuai", fenid); | 517 | + Constant.SERVICE_ID, "yangshuai", fenid); |
| 518 | Handler handler = new Handler(); | 518 | Handler handler = new Handler(); |
| 519 | Runnable runnable = new Runnable() { | 519 | Runnable runnable = new Runnable() { |
| 520 | @Override | 520 | @Override |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/model/Constant.java
| 1 | package com.cnlive.moudle.pedometer.model; | 1 | package com.cnlive.moudle.pedometer.model; |
| 2 | 2 | ||
| 3 | public class Constant { | 3 | public class Constant { |
| 4 | + public static final long SERVICE_ID = 213511; | ||
| 5 | + public static final int TAG = 1; | ||
| 6 | + public static final int GATHER_INTERVAL=3;//位置采集周期 | ||
| 7 | + public static final int PACK_INTERVAL =10;//位置采集周期 | ||
| 8 | + | ||
| 4 | public static final int SERVICE_STEP_COUNT_UPDATE = 0;//步数更新 | 9 | public static final int SERVICE_STEP_COUNT_UPDATE = 0;//步数更新 |
| 5 | public static final int SERVICE_STEP_COUNT_PAUSE = 1;//步数暂停 | 10 | public static final int SERVICE_STEP_COUNT_PAUSE = 1;//步数暂停 |
| 6 | public static final int SERVICE_STEP_COUNT_CONTINUE = 2;//继续计步 | 11 | public static final int SERVICE_STEP_COUNT_CONTINUE = 2;//继续计步 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/service/StepService.java
| @@ -141,13 +141,6 @@ public class StepService extends Service implements SensorEventListener { | @@ -141,13 +141,6 @@ public class StepService extends Service implements SensorEventListener { | ||
| 141 | * 轨迹监听器(用于接收纠偏后实时位置回调) | 141 | * 轨迹监听器(用于接收纠偏后实时位置回调) |
| 142 | */ | 142 | */ |
| 143 | private OnTrackListener realTimeTraceListener = null; | 143 | private OnTrackListener realTimeTraceListener = null; |
| 144 | - //位置采集周期 | ||
| 145 | - private int gatherInterval = 3; | ||
| 146 | - //打包周期 | ||
| 147 | - private int packInterval = 10; | ||
| 148 | - // 轨迹服务ID | ||
| 149 | - public static final long serviceId = 213511;//杨帅 | ||
| 150 | -// public static final long serviceId = 213553; | ||
| 151 | 144 | ||
| 152 | // 设备标识 | 145 | // 设备标识 |
| 153 | public static String entityName = ""; | 146 | public static String entityName = ""; |
| @@ -185,12 +178,12 @@ public class StepService extends Service implements SensorEventListener { | @@ -185,12 +178,12 @@ public class StepService extends Service implements SensorEventListener { | ||
| 185 | if (mClient == null) { | 178 | if (mClient == null) { |
| 186 | mClient = new LBSTraceClient(getApplicationContext()); | 179 | mClient = new LBSTraceClient(getApplicationContext()); |
| 187 | // 设置定位和打包周期 | 180 | // 设置定位和打包周期 |
| 188 | - mClient.setInterval(gatherInterval, packInterval); | 181 | + mClient.setInterval(Constant.GATHER_INTERVAL, Constant.PACK_INTERVAL); |
| 189 | //设置定位模式 | 182 | //设置定位模式 |
| 190 | mClient.setLocationMode(LocationMode.High_Accuracy); | 183 | mClient.setLocationMode(LocationMode.High_Accuracy); |
| 191 | } | 184 | } |
| 192 | if (mTrace == null) { | 185 | if (mTrace == null) { |
| 193 | - mTrace = new Trace(serviceId, entityName); | 186 | + mTrace = new Trace(Constant.SERVICE_ID, entityName); |
| 194 | } | 187 | } |
| 195 | //初始化实时轨迹监听器 | 188 | //初始化实时轨迹监听器 |
| 196 | realTimeTraceListener = new OnTrackListener() { | 189 | realTimeTraceListener = new OnTrackListener() { |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RegistrationInfoFragment.java
| @@ -5,25 +5,51 @@ import android.os.Bundle; | @@ -5,25 +5,51 @@ import android.os.Bundle; | ||
| 5 | import android.support.annotation.NonNull; | 5 | import android.support.annotation.NonNull; |
| 6 | import android.support.annotation.Nullable; | 6 | import android.support.annotation.Nullable; |
| 7 | import android.support.v4.app.Fragment; | 7 | import android.support.v4.app.Fragment; |
| 8 | +import android.util.Log; | ||
| 8 | import android.view.LayoutInflater; | 9 | import android.view.LayoutInflater; |
| 9 | import android.view.View; | 10 | import android.view.View; |
| 10 | import android.view.ViewGroup; | 11 | import android.view.ViewGroup; |
| 12 | +import android.widget.Toast; | ||
| 11 | 13 | ||
| 14 | +import com.baidu.trace.LBSTraceClient; | ||
| 15 | +import com.baidu.trace.api.fence.AddMonitoredPersonRequest; | ||
| 16 | +import com.baidu.trace.api.fence.AddMonitoredPersonResponse; | ||
| 17 | +import com.baidu.trace.api.fence.CreateFenceResponse; | ||
| 18 | +import com.baidu.trace.api.fence.DeleteFenceResponse; | ||
| 19 | +import com.baidu.trace.api.fence.DeleteMonitoredPersonResponse; | ||
| 20 | +import com.baidu.trace.api.fence.FenceListResponse; | ||
| 21 | +import com.baidu.trace.api.fence.FenceType; | ||
| 22 | +import com.baidu.trace.api.fence.HistoryAlarmResponse; | ||
| 23 | +import com.baidu.trace.api.fence.ListMonitoredPersonResponse; | ||
| 24 | +import com.baidu.trace.api.fence.MonitoredStatus; | ||
| 25 | +import com.baidu.trace.api.fence.MonitoredStatusByLocationResponse; | ||
| 26 | +import com.baidu.trace.api.fence.MonitoredStatusInfo; | ||
| 27 | +import com.baidu.trace.api.fence.MonitoredStatusResponse; | ||
| 28 | +import com.baidu.trace.api.fence.OnFenceListener; | ||
| 29 | +import com.baidu.trace.api.fence.UpdateFenceResponse; | ||
| 30 | +import com.baidu.trace.model.LocationMode; | ||
| 12 | import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; | 31 | import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; |
| 13 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | 32 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 14 | import com.cnlive.moudle.pedometer.frame.presenter.RegistrationInfoPresenter; | 33 | import com.cnlive.moudle.pedometer.frame.presenter.RegistrationInfoPresenter; |
| 15 | import com.cnlive.moudle.pedometer.frame.view.RegistrationInfoView; | 34 | import com.cnlive.moudle.pedometer.frame.view.RegistrationInfoView; |
| 35 | +import com.cnlive.moudle.pedometer.model.Constant; | ||
| 36 | +import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil; | ||
| 16 | import com.example.moudle_pedometer.R; | 37 | import com.example.moudle_pedometer.R; |
| 17 | import com.example.moudle_pedometer.databinding.FragmentRegistrationInfoBinding; | 38 | import com.example.moudle_pedometer.databinding.FragmentRegistrationInfoBinding; |
| 18 | import com.jzxiang.pickerview.TimePickerDialog; | 39 | import com.jzxiang.pickerview.TimePickerDialog; |
| 19 | 40 | ||
| 41 | +import java.util.ArrayList; | ||
| 42 | +import java.util.List; | ||
| 43 | + | ||
| 20 | /** | 44 | /** |
| 21 | * Created by hanyayun 019/05/29. | 45 | * Created by hanyayun 019/05/29. |
| 22 | */ | 46 | */ |
| 23 | -public class RegistrationInfoFragment extends MvpBindingFragment<RegistrationInfoView, RegistrationInfoPresenter,Object, FragmentRegistrationInfoBinding> { | 47 | +public class RegistrationInfoFragment extends MvpBindingFragment<RegistrationInfoView, RegistrationInfoPresenter, Object, FragmentRegistrationInfoBinding> { |
| 24 | 48 | ||
| 25 | 49 | ||
| 26 | public TimePickerDialog pickerDialog; | 50 | public TimePickerDialog pickerDialog; |
| 51 | + private final String TAG = "RegistrationInfo"; | ||
| 52 | + | ||
| 27 | public static RegistrationInfoFragment newInstance() { | 53 | public static RegistrationInfoFragment newInstance() { |
| 28 | RegistrationInfoFragment fragment = new RegistrationInfoFragment(); | 54 | RegistrationInfoFragment fragment = new RegistrationInfoFragment(); |
| 29 | return fragment; | 55 | return fragment; |
| @@ -37,12 +63,101 @@ public class RegistrationInfoFragment extends MvpBindingFragment<RegistrationInf | @@ -37,12 +63,101 @@ public class RegistrationInfoFragment extends MvpBindingFragment<RegistrationInf | ||
| 37 | @Override | 63 | @Override |
| 38 | public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | 64 | public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { |
| 39 | super.onViewCreated(view, savedInstanceState); | 65 | super.onViewCreated(view, savedInstanceState); |
| 40 | - if(getMvpView() != null) getMvpView().initView(); | 66 | + if (getMvpView() != null) getMvpView().initView(); |
| 41 | } | 67 | } |
| 42 | 68 | ||
| 43 | - public void commitInfo(){ | ||
| 44 | - getPresenter().commitInfo(getActivity(),CommonInfo.getStreetId(getActivity()),"10514343","15210479774", | ||
| 45 | - binding.sexText.getText().toString().trim().equals("未选择")?"":binding.sexText.getText().toString().trim(), | ||
| 46 | - binding.birthday.getText().toString().trim().equals("未选择")?"":binding.birthday.getText().toString().trim()); | 69 | + public void commitInfo() { |
| 70 | + | ||
| 71 | +// getPresenter().commitInfo(getActivity(), CommonInfo.getStreetId(getActivity()), "10514343", "15210479774", | ||
| 72 | +// binding.sexText.getText().toString().trim().equals("未选择") ? "" : binding.sexText.getText().toString().trim(), | ||
| 73 | +// binding.birthday.getText().toString().trim().equals("未选择") ? "" : binding.birthday.getText().toString().trim()); | ||
| 74 | + addMonitorToFence(1); | ||
| 47 | } | 75 | } |
| 76 | + | ||
| 77 | + /** | ||
| 78 | + * 将对象添加到围栏 | ||
| 79 | + * | ||
| 80 | + * @param fenceId | ||
| 81 | + */ | ||
| 82 | + public void addMonitorToFence(int fenceId) { | ||
| 83 | + QMUITipDialogUtil.loadingDialog(getContext(), "请稍后", false); | ||
| 84 | + LBSTraceClient mClient = new LBSTraceClient(getContext()); | ||
| 85 | + // 设置定位和打包周期 | ||
| 86 | + mClient.setInterval(Constant.GATHER_INTERVAL, Constant.PACK_INTERVAL); | ||
| 87 | + //设置定位模式 | ||
| 88 | + mClient.setLocationMode(LocationMode.High_Accuracy); | ||
| 89 | + //将设备添加到围栏中 | ||
| 90 | + AddMonitoredPersonRequest addMonitoredPersonRequest = AddMonitoredPersonRequest.buildServerRequest(Constant.TAG, Constant.SERVICE_ID, fenceId, CommonInfo.getUserId(getContext())); | ||
| 91 | + // 初始化围栏监听器 | ||
| 92 | + OnFenceListener onFenceListener = new OnFenceListener() { | ||
| 93 | + // 创建围栏回调 | ||
| 94 | + @Override | ||
| 95 | + public void onCreateFenceCallback(CreateFenceResponse createFenceResponse) { | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + // 更新围栏回调 | ||
| 99 | + @Override | ||
| 100 | + public void onUpdateFenceCallback(UpdateFenceResponse updateFenceResponse) { | ||
| 101 | + | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + // 删除围栏回调 | ||
| 105 | + @Override | ||
| 106 | + public void onDeleteFenceCallback(DeleteFenceResponse deleteFenceResponse) { | ||
| 107 | + | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + // 围栏列表回调 | ||
| 111 | + @Override | ||
| 112 | + public void onFenceListCallback(FenceListResponse fenceListResponse) { | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + // 监控状态回调 | ||
| 116 | + @Override | ||
| 117 | + public void onMonitoredStatusCallback(MonitoredStatusResponse monitoredStatusResponse) { | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + // 指定位置监控状态回调 | ||
| 121 | + @Override | ||
| 122 | + public void onMonitoredStatusByLocationCallback(MonitoredStatusByLocationResponse monitoredStatusByLocationResponse) { | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + // 历史报警回调 | ||
| 126 | + @Override | ||
| 127 | + public void onHistoryAlarmCallback(HistoryAlarmResponse historyAlarmResponse) { | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + @Override | ||
| 131 | + public void onAddMonitoredPersonCallback(AddMonitoredPersonResponse addMonitoredPersonResponse) { | ||
| 132 | + // 鉴权失败 | ||
| 133 | + if (addMonitoredPersonResponse.getStatus() == 14004) { | ||
| 134 | + if (mClient != null) { | ||
| 135 | + //将设备添加到围栏中 | ||
| 136 | + mClient.addFenceMonitoredPerson(addMonitoredPersonRequest, this); | ||
| 137 | + } | ||
| 138 | + } else if (addMonitoredPersonResponse.getStatus() == 0) { | ||
| 139 | + QMUITipDialogUtil.dismessDialog(); | ||
| 140 | + getPresenter().commitInfo(getActivity(), CommonInfo.getStreetId(getActivity()), "10514343", "15210479774", | ||
| 141 | + binding.sexText.getText().toString().trim().equals("未选择") ? "" : binding.sexText.getText().toString().trim(), | ||
| 142 | + binding.birthday.getText().toString().trim().equals("未选择") ? "" : binding.birthday.getText().toString().trim()); | ||
| 143 | + } else { | ||
| 144 | + QMUITipDialogUtil.dismessDialog(); | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + Log.e(TAG, "onAddMonitoredPersonCallback: " + addMonitoredPersonResponse.getMessage() + "," + addMonitoredPersonResponse.getStatus()); | ||
| 148 | + } | ||
| 149 | + | ||
| 150 | + @Override | ||
| 151 | + public void onDeleteMonitoredPersonCallback(DeleteMonitoredPersonResponse deleteMonitoredPersonResponse) { | ||
| 152 | + } | ||
| 153 | + | ||
| 154 | + @Override | ||
| 155 | + public void onListMonitoredPersonCallback(ListMonitoredPersonResponse listMonitoredPersonResponse) { | ||
| 156 | + } | ||
| 157 | + }; | ||
| 158 | + //将设备添加到围栏中 | ||
| 159 | + mClient.addFenceMonitoredPerson(addMonitoredPersonRequest, onFenceListener); | ||
| 160 | + } | ||
| 161 | + | ||
| 162 | + | ||
| 48 | } | 163 | } |