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 | 146 | //先校验 |
| 147 | 147 | fragment.getPresenter().checkShoeLine(fragment.getActivity(), eventShoeLinesBean.getId(), eventShoeLinesBean.getEventId(), new RaceNameListPresenter.CallBack() { |
| 148 | 148 | @Override |
| 149 | - public void onSuccess(String fenceId, String entityName,String isDelete) { | |
| 149 | + public void onSuccess(String fenceId, String entityName, String isDelete) { | |
| 150 | 150 | if (null == fragment.getActivity()) { |
| 151 | 151 | return; |
| 152 | 152 | } |
| 153 | - if(isDelete != null && isDelete.equals("1")){ | |
| 153 | + if (isDelete != null && isDelete.equals("1")) { | |
| 154 | 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 | 156 | fragment.getActivity().finish(); |
| 157 | 157 | return; |
| 158 | 158 | } |
| ... | ... | @@ -206,19 +206,7 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener |
| 206 | 206 | } else { |
| 207 | 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 | 212 | if (!TextUtils.isEmpty(eventShoeLinesBean.getUserMsg().getNickName())) { |
| ... | ... | @@ -248,6 +236,7 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener |
| 248 | 236 | String entityNameTrace = eventShoeLinesBean.getDarenId(); |
| 249 | 237 | |
| 250 | 238 | //开始查询 |
| 239 | + List<CollectPoint> finalResultCollectPoints = resultCollectPoints; | |
| 251 | 240 | MyMapUtil.queryHistoryTrace(getContext(), mClient, entityNameTrace, startTime, endTime, new MyMapUtil.CallBack() { |
| 252 | 241 | @Override |
| 253 | 242 | public void success(List<LatLng> resultPoints) { |
| ... | ... | @@ -258,10 +247,30 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener |
| 258 | 247 | if (resultPoints.size() > 1) { |
| 259 | 248 | MyMapUtil.drawHistoryTrack(getContext(), baiduMap, resultPoints, SortType.asc, R.color.green_round, R.drawable.icon_start, R.drawable.icon_end); |
| 260 | 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 | 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 | 7 | import android.view.View; |
| 8 | 8 | |
| 9 | 9 | import com.baidu.trace.LBSTraceClient; |
| 10 | +import com.baidu.trace.Trace; | |
| 10 | 11 | import com.baidu.trace.api.fence.AddMonitoredPersonRequest; |
| 11 | 12 | import com.baidu.trace.api.fence.AddMonitoredPersonResponse; |
| 12 | 13 | import com.baidu.trace.api.fence.CreateFenceResponse; |
| ... | ... | @@ -20,6 +21,8 @@ import com.baidu.trace.api.fence.MonitoredStatusResponse; |
| 20 | 21 | import com.baidu.trace.api.fence.OnFenceListener; |
| 21 | 22 | import com.baidu.trace.api.fence.UpdateFenceResponse; |
| 22 | 23 | import com.baidu.trace.model.LocationMode; |
| 24 | +import com.baidu.trace.model.OnTraceListener; | |
| 25 | +import com.baidu.trace.model.PushMessage; | |
| 23 | 26 | import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; |
| 24 | 27 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 25 | 28 | import com.cnlive.moudle.pedometer.frame.presenter.RegistrationInfoPresenter; |
| ... | ... | @@ -71,8 +74,10 @@ public class RegistrationInfoFragment extends MvpBindingFragment<RegistrationInf |
| 71 | 74 | mClient.setInterval(Constant.GATHER_INTERVAL, Constant.PACK_INTERVAL); |
| 72 | 75 | //设置定位模式 |
| 73 | 76 | mClient.setLocationMode(LocationMode.High_Accuracy); |
| 77 | + Trace mTrace = new Trace(Constant.SERVICE_ID, CommonInfo.getUserId(getContext())); | |
| 74 | 78 | //将设备添加到围栏中 |
| 75 | 79 | AddMonitoredPersonRequest addMonitoredPersonRequest = AddMonitoredPersonRequest.buildServerRequest(Constant.TAG, Constant.SERVICE_ID, fenceId, CommonInfo.getUserId(getContext())); |
| 80 | + | |
| 76 | 81 | // 初始化围栏监听器 |
| 77 | 82 | OnFenceListener onFenceListener = new OnFenceListener() { |
| 78 | 83 | // 创建围栏回调 |
| ... | ... | @@ -127,7 +132,7 @@ public class RegistrationInfoFragment extends MvpBindingFragment<RegistrationInf |
| 127 | 132 | binding.birthday.getText().toString().trim().equals("未选择") ? "" : binding.birthday.getText().toString().trim()); |
| 128 | 133 | } else { |
| 129 | 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 | 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 | ... | ... |