Commit 23acb4a2157146f5192121b1a75fb378fc777d0d
1 parent
79c0bb8e
1 修复报名失败问题
Showing
2 changed files
with
87 additions
and
18 deletions
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollTraceListDetailFragmentView.java
| @@ -146,13 +146,13 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | @@ -146,13 +146,13 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | ||
| 146 | //先校验 | 146 | //先校验 |
| 147 | fragment.getPresenter().checkShoeLine(fragment.getActivity(), eventShoeLinesBean.getId(), eventShoeLinesBean.getEventId(), new RaceNameListPresenter.CallBack() { | 147 | fragment.getPresenter().checkShoeLine(fragment.getActivity(), eventShoeLinesBean.getId(), eventShoeLinesBean.getEventId(), new RaceNameListPresenter.CallBack() { |
| 148 | @Override | 148 | @Override |
| 149 | - public void onSuccess(String fenceId, String entityName,String isDelete) { | 149 | + public void onSuccess(String fenceId, String entityName, String isDelete) { |
| 150 | if (null == fragment.getActivity()) { | 150 | if (null == fragment.getActivity()) { |
| 151 | return; | 151 | return; |
| 152 | } | 152 | } |
| 153 | - if(isDelete != null && isDelete.equals("1")){ | 153 | + if (isDelete != null && isDelete.equals("1")) { |
| 154 | EventBus.getDefault().post(new MessageEvent(Constant.DELECT_COLL_BIND_TRACE_LIST, position)); | 154 | EventBus.getDefault().post(new MessageEvent(Constant.DELECT_COLL_BIND_TRACE_LIST, position)); |
| 155 | - AlertUtil.showLongToast(fragment.getActivity(),"该轨迹已被删除,不能进行绑定",2000); | 155 | + AlertUtil.showLongToast(fragment.getActivity(), "该轨迹已被删除,不能进行绑定", 2000); |
| 156 | fragment.getActivity().finish(); | 156 | fragment.getActivity().finish(); |
| 157 | return; | 157 | return; |
| 158 | } | 158 | } |
| @@ -206,19 +206,7 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | @@ -206,19 +206,7 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | ||
| 206 | } else { | 206 | } else { |
| 207 | fragment.binding.includeFinishUserInfo.rvList.setVisibility(View.GONE); | 207 | fragment.binding.includeFinishUserInfo.rvList.setVisibility(View.GONE); |
| 208 | } | 208 | } |
| 209 | - //获取打点不为空 | ||
| 210 | - if (null != resultCollectPoints && resultCollectPoints.size() > 1) { | ||
| 211 | - //移除起点 | ||
| 212 | - resultCollectPoints.remove(0); | ||
| 213 | - //移除终点 | ||
| 214 | - resultCollectPoints.remove(resultCollectPoints.size() - 1); | ||
| 215 | - //开始在地图上绘制打点信息 | ||
| 216 | - for (int i = 0; i < resultCollectPoints.size(); i++) { | ||
| 217 | - LatLng latLng = new LatLng(resultCollectPoints.get(i).getLatitude(), resultCollectPoints.get(i).getLongitude()); | ||
| 218 | - MyMapUtil.setMapMarker(getContext(), baiduMap, latLng, R.drawable.icon_map_import); | ||
| 219 | - } | ||
| 220 | 209 | ||
| 221 | - } | ||
| 222 | 210 | ||
| 223 | //设置用户头像 | 211 | //设置用户头像 |
| 224 | if (!TextUtils.isEmpty(eventShoeLinesBean.getUserMsg().getNickName())) { | 212 | if (!TextUtils.isEmpty(eventShoeLinesBean.getUserMsg().getNickName())) { |
| @@ -248,6 +236,7 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | @@ -248,6 +236,7 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | ||
| 248 | String entityNameTrace = eventShoeLinesBean.getDarenId(); | 236 | String entityNameTrace = eventShoeLinesBean.getDarenId(); |
| 249 | 237 | ||
| 250 | //开始查询 | 238 | //开始查询 |
| 239 | + List<CollectPoint> finalResultCollectPoints = resultCollectPoints; | ||
| 251 | MyMapUtil.queryHistoryTrace(getContext(), mClient, entityNameTrace, startTime, endTime, new MyMapUtil.CallBack() { | 240 | MyMapUtil.queryHistoryTrace(getContext(), mClient, entityNameTrace, startTime, endTime, new MyMapUtil.CallBack() { |
| 252 | @Override | 241 | @Override |
| 253 | public void success(List<LatLng> resultPoints) { | 242 | public void success(List<LatLng> resultPoints) { |
| @@ -258,10 +247,30 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | @@ -258,10 +247,30 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | ||
| 258 | if (resultPoints.size() > 1) { | 247 | if (resultPoints.size() > 1) { |
| 259 | MyMapUtil.drawHistoryTrack(getContext(), baiduMap, resultPoints, SortType.asc, R.color.green_round, R.drawable.icon_start, R.drawable.icon_end); | 248 | MyMapUtil.drawHistoryTrack(getContext(), baiduMap, resultPoints, SortType.asc, R.color.green_round, R.drawable.icon_start, R.drawable.icon_end); |
| 260 | MyMapUtil.setMapAutoZoom(baiduMap, resultPoints, -1.5f); | 249 | MyMapUtil.setMapAutoZoom(baiduMap, resultPoints, -1.5f); |
| 250 | + | ||
| 251 | + | ||
| 252 | + //获取打点不为空 | ||
| 253 | + if (null != finalResultCollectPoints && finalResultCollectPoints.size() > 1) { | ||
| 254 | + //移除起点 | ||
| 255 | + finalResultCollectPoints.remove(0); | ||
| 256 | + //移除终点 | ||
| 257 | + finalResultCollectPoints.remove(finalResultCollectPoints.size() - 1); | ||
| 258 | + //开始在地图上绘制打点信息 | ||
| 259 | + for (int i = 0; i < finalResultCollectPoints.size(); i++) { | ||
| 260 | + LatLng latLng = new LatLng(finalResultCollectPoints.get(i).getLatitude(), finalResultCollectPoints.get(i).getLongitude()); | ||
| 261 | + MyMapUtil.setMapMarker(getContext(), baiduMap, latLng, R.drawable.icon_map_import); | ||
| 262 | + } | ||
| 263 | + | ||
| 264 | + } | ||
| 265 | + // | ||
| 261 | } | 266 | } |
| 262 | } | 267 | } |
| 268 | + | ||
| 269 | + | ||
| 263 | } | 270 | } |
| 264 | }); | 271 | }); |
| 272 | + | ||
| 273 | + | ||
| 265 | } | 274 | } |
| 266 | //返回按钮点击 | 275 | //返回按钮点击 |
| 267 | fragment.binding.flBack.setOnClickListener(new View.OnClickListener() { | 276 | fragment.binding.flBack.setOnClickListener(new View.OnClickListener() { |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RegistrationInfoFragment.java
| @@ -7,6 +7,7 @@ import android.support.annotation.Nullable; | @@ -7,6 +7,7 @@ import android.support.annotation.Nullable; | ||
| 7 | import android.view.View; | 7 | import android.view.View; |
| 8 | 8 | ||
| 9 | import com.baidu.trace.LBSTraceClient; | 9 | import com.baidu.trace.LBSTraceClient; |
| 10 | +import com.baidu.trace.Trace; | ||
| 10 | import com.baidu.trace.api.fence.AddMonitoredPersonRequest; | 11 | import com.baidu.trace.api.fence.AddMonitoredPersonRequest; |
| 11 | import com.baidu.trace.api.fence.AddMonitoredPersonResponse; | 12 | import com.baidu.trace.api.fence.AddMonitoredPersonResponse; |
| 12 | import com.baidu.trace.api.fence.CreateFenceResponse; | 13 | import com.baidu.trace.api.fence.CreateFenceResponse; |
| @@ -20,6 +21,8 @@ import com.baidu.trace.api.fence.MonitoredStatusResponse; | @@ -20,6 +21,8 @@ import com.baidu.trace.api.fence.MonitoredStatusResponse; | ||
| 20 | import com.baidu.trace.api.fence.OnFenceListener; | 21 | import com.baidu.trace.api.fence.OnFenceListener; |
| 21 | import com.baidu.trace.api.fence.UpdateFenceResponse; | 22 | import com.baidu.trace.api.fence.UpdateFenceResponse; |
| 22 | import com.baidu.trace.model.LocationMode; | 23 | import com.baidu.trace.model.LocationMode; |
| 24 | +import com.baidu.trace.model.OnTraceListener; | ||
| 25 | +import com.baidu.trace.model.PushMessage; | ||
| 23 | import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; | 26 | import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; |
| 24 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | 27 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 25 | import com.cnlive.moudle.pedometer.frame.presenter.RegistrationInfoPresenter; | 28 | import com.cnlive.moudle.pedometer.frame.presenter.RegistrationInfoPresenter; |
| @@ -71,8 +74,10 @@ public class RegistrationInfoFragment extends MvpBindingFragment<RegistrationInf | @@ -71,8 +74,10 @@ public class RegistrationInfoFragment extends MvpBindingFragment<RegistrationInf | ||
| 71 | mClient.setInterval(Constant.GATHER_INTERVAL, Constant.PACK_INTERVAL); | 74 | mClient.setInterval(Constant.GATHER_INTERVAL, Constant.PACK_INTERVAL); |
| 72 | //设置定位模式 | 75 | //设置定位模式 |
| 73 | mClient.setLocationMode(LocationMode.High_Accuracy); | 76 | mClient.setLocationMode(LocationMode.High_Accuracy); |
| 77 | + Trace mTrace = new Trace(Constant.SERVICE_ID, CommonInfo.getUserId(getContext())); | ||
| 74 | //将设备添加到围栏中 | 78 | //将设备添加到围栏中 |
| 75 | AddMonitoredPersonRequest addMonitoredPersonRequest = AddMonitoredPersonRequest.buildServerRequest(Constant.TAG, Constant.SERVICE_ID, fenceId, CommonInfo.getUserId(getContext())); | 79 | AddMonitoredPersonRequest addMonitoredPersonRequest = AddMonitoredPersonRequest.buildServerRequest(Constant.TAG, Constant.SERVICE_ID, fenceId, CommonInfo.getUserId(getContext())); |
| 80 | + | ||
| 76 | // 初始化围栏监听器 | 81 | // 初始化围栏监听器 |
| 77 | OnFenceListener onFenceListener = new OnFenceListener() { | 82 | OnFenceListener onFenceListener = new OnFenceListener() { |
| 78 | // 创建围栏回调 | 83 | // 创建围栏回调 |
| @@ -127,7 +132,7 @@ public class RegistrationInfoFragment extends MvpBindingFragment<RegistrationInf | @@ -127,7 +132,7 @@ public class RegistrationInfoFragment extends MvpBindingFragment<RegistrationInf | ||
| 127 | binding.birthday.getText().toString().trim().equals("未选择") ? "" : binding.birthday.getText().toString().trim()); | 132 | binding.birthday.getText().toString().trim().equals("未选择") ? "" : binding.birthday.getText().toString().trim()); |
| 128 | } else { | 133 | } else { |
| 129 | QMUITipDialogUtil.dismessDialog(); | 134 | QMUITipDialogUtil.dismessDialog(); |
| 130 | - QMUITipDialogUtil.messageDialog(getContext(),"报名失败,请稍后重试!",2); | 135 | + QMUITipDialogUtil.messageDialog(getContext(), addMonitoredPersonResponse.getMessage(), 2); |
| 131 | } | 136 | } |
| 132 | } | 137 | } |
| 133 | 138 | ||
| @@ -139,8 +144,63 @@ public class RegistrationInfoFragment extends MvpBindingFragment<RegistrationInf | @@ -139,8 +144,63 @@ public class RegistrationInfoFragment extends MvpBindingFragment<RegistrationInf | ||
| 139 | public void onListMonitoredPersonCallback(ListMonitoredPersonResponse listMonitoredPersonResponse) { | 144 | public void onListMonitoredPersonCallback(ListMonitoredPersonResponse listMonitoredPersonResponse) { |
| 140 | } | 145 | } |
| 141 | }; | 146 | }; |
| 142 | - //将设备添加到围栏中 | ||
| 143 | - mClient.addFenceMonitoredPerson(addMonitoredPersonRequest, onFenceListener); | 147 | + |
| 148 | + | ||
| 149 | + //启动鹰眼服务 | ||
| 150 | + OnTraceListener traceListener = new OnTraceListener() { | ||
| 151 | + @Override | ||
| 152 | + public void onBindServiceCallback(int i, String s) { | ||
| 153 | + | ||
| 154 | + } | ||
| 155 | + | ||
| 156 | + @Override | ||
| 157 | + public void onStartTraceCallback(int i, String s) { | ||
| 158 | + if (0 == i) { | ||
| 159 | + //开启采集 | ||
| 160 | + mClient.startGather(this); | ||
| 161 | + } else { | ||
| 162 | + QMUITipDialogUtil.dismessDialog(); | ||
| 163 | + } | ||
| 164 | + } | ||
| 165 | + | ||
| 166 | + @Override | ||
| 167 | + public void onStopTraceCallback(int i, String s) { | ||
| 168 | + | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + @Override | ||
| 172 | + public void onStartGatherCallback(int i, String s) { | ||
| 173 | + if (0 == i) { | ||
| 174 | + mClient.stopGather(this); | ||
| 175 | + //将设备添加到围栏中 | ||
| 176 | + mClient.addFenceMonitoredPerson(addMonitoredPersonRequest, onFenceListener); | ||
| 177 | + } else { | ||
| 178 | + QMUITipDialogUtil.dismessDialog(); | ||
| 179 | + } | ||
| 180 | + } | ||
| 181 | + | ||
| 182 | + @Override | ||
| 183 | + public void onStopGatherCallback(int i, String s) { | ||
| 184 | + if (0 == i) { | ||
| 185 | + mClient.stopTrace(mTrace, this); | ||
| 186 | + } else { | ||
| 187 | + QMUITipDialogUtil.dismessDialog(); | ||
| 188 | + } | ||
| 189 | + } | ||
| 190 | + | ||
| 191 | + @Override | ||
| 192 | + public void onPushCallback(byte b, PushMessage pushMessage) { | ||
| 193 | + | ||
| 194 | + } | ||
| 195 | + | ||
| 196 | + @Override | ||
| 197 | + public void onInitBOSCallback(int i, String s) { | ||
| 198 | + | ||
| 199 | + } | ||
| 200 | + }; | ||
| 201 | + //启动鹰眼服务 | ||
| 202 | + mClient.startTrace(mTrace, traceListener); | ||
| 203 | + | ||
| 144 | } | 204 | } |
| 145 | 205 | ||
| 146 | 206 |