Commit 96df952f49caafe79449f0a2b000c144ce5a0864

Authored by 杨帅
1 parent 3cceb336

1 增加运营绑定轨迹对当前网络的判断

moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/presenter/CollTraceListDetailFragmentPresenter.java
1 1 package com.cnlive.moudle.collectionTrace.frame.presenter;
2 2  
  3 +import android.content.Context;
  4 +import android.text.TextUtils;
  5 +
  6 +import com.cnlive.libs.base.logic.Logic;
  7 +import com.cnlive.libs.base.logic.callback.DataCallback;
  8 +import com.cnlive.libs.base.logic.callback.FailureCallback;
  9 +import com.cnlive.libs.base.logic.callback.SuccessCallback;
3 10 import com.cnlive.moudle.collectionTrace.frame.view.CollTraceListDetailFragmentView;
  11 +import com.cnlive.moudle.collectionTrace.model.BindingShoeInfo;
  12 +import com.cnlive.moudle.pedometer.model.Constant;
  13 +import com.cnlive.moudle.pedometer.model.MessageEvent;
  14 +import com.cnlive.moudle.pedometer.net.ApiServiceRunLin;
  15 +import com.cnlive.moudle.pedometer.net.SubscriptionRequest;
  16 +import com.cnlive.moudle.pedometer.net.bean.BaseInfo;
  17 +import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil;
4 18 import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter;
5 19  
  20 +import org.greenrobot.eventbus.EventBus;
  21 +
  22 +import java.util.HashMap;
  23 +import java.util.Map;
  24 +
  25 +import io.reactivex.disposables.Disposable;
  26 +
6 27 public class CollTraceListDetailFragmentPresenter extends MvpBasePresenter<CollTraceListDetailFragmentView> {
  28 + /**
  29 + * 踩点轨迹与赛事绑定
  30 + *
  31 + * @param context
  32 + * @param id 轨迹id
  33 + * @param eventId 赛事id
  34 + */
  35 +
  36 + public void bindingShoeLine(Context context, int id, String eventId, String fenceId, String fenceName, String position) {
  37 + QMUITipDialogUtil.loadingDialog(context, "正在绑定轨迹...", false);
  38 + Map<String, String> map = new HashMap<>();
  39 + map.put("id", id + "");
  40 + map.put("eventId", eventId);
  41 + map.put("fenceId", fenceId);
  42 + map.put("fenceName", fenceName);
  43 +
  44 + Logic.create(map).action(new Logic.Action<Map<String, String>, BaseInfo<BindingShoeInfo>>() {
  45 + @Override
  46 + public Disposable action(Map<String, String> stringStringMap, DataCallback<BaseInfo<BindingShoeInfo>> dataCallback) {
  47 + return SubscriptionRequest.service(ApiServiceRunLin.class, api -> api.bindingShoeLineInfo(stringStringMap)).subscribe(context, dataCallback);
  48 + }
  49 + }).<BaseInfo<BindingShoeInfo>>event().setFailureCallback(new FailureCallback() {
  50 + @Override
  51 + public void onFailure(int code, String message) {
  52 + if (getView() != null) {
  53 + QMUITipDialogUtil.dismessDialog();
  54 + QMUITipDialogUtil.failedDialog(context, message, 1);
  55 + }
  56 + }
  57 + }).setSuccessCallback(new SuccessCallback<BaseInfo<BindingShoeInfo>>() {
  58 + @Override
  59 + public void onSuccess(BaseInfo<BindingShoeInfo> baseInfo) {
  60 + if (getView() != null) {
  61 + QMUITipDialogUtil.dismessDialog();
  62 + getView().updataBindBtnState(true);
  63 + if (!TextUtils.isEmpty(position)) {
  64 + EventBus.getDefault().post(new MessageEvent(Constant.UPDATA_COLL_BIND_TRACE_LIST, position));
  65 + }
  66 + }
  67 + }
  68 + }).start();
  69 + }
7 70 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollTraceListDetailFragmentView.java
... ... @@ -5,6 +5,7 @@ import android.content.Context;
5 5 import android.os.Handler;
6 6 import android.support.v7.widget.LinearLayoutManager;
7 7 import android.text.TextUtils;
  8 +import android.util.Log;
8 9 import android.view.MotionEvent;
9 10 import android.view.View;
10 11  
... ... @@ -14,8 +15,26 @@ import com.baidu.mapapi.map.Overlay;
14 15 import com.baidu.mapapi.map.UiSettings;
15 16 import com.baidu.mapapi.model.LatLng;
16 17 import com.baidu.trace.LBSTraceClient;
  18 +import com.baidu.trace.api.fence.AddMonitoredPersonResponse;
  19 +import com.baidu.trace.api.fence.CreateFenceRequest;
  20 +import com.baidu.trace.api.fence.CreateFenceResponse;
  21 +import com.baidu.trace.api.fence.DeleteFenceRequest;
  22 +import com.baidu.trace.api.fence.DeleteFenceResponse;
  23 +import com.baidu.trace.api.fence.DeleteMonitoredPersonResponse;
  24 +import com.baidu.trace.api.fence.FenceInfo;
  25 +import com.baidu.trace.api.fence.FenceListRequest;
  26 +import com.baidu.trace.api.fence.FenceListResponse;
  27 +import com.baidu.trace.api.fence.FenceShape;
  28 +import com.baidu.trace.api.fence.HistoryAlarmResponse;
  29 +import com.baidu.trace.api.fence.ListMonitoredPersonResponse;
  30 +import com.baidu.trace.api.fence.MonitoredStatusByLocationResponse;
  31 +import com.baidu.trace.api.fence.MonitoredStatusResponse;
  32 +import com.baidu.trace.api.fence.OnFenceListener;
  33 +import com.baidu.trace.api.fence.UpdateFenceResponse;
  34 +import com.baidu.trace.model.CoordType;
17 35 import com.baidu.trace.model.SortType;
18 36 import com.bumptech.glide.Glide;
  37 +import com.cnlive.libs.base.util.AlertUtil;
19 38 import com.cnlive.moudle.collectionTrace.model.CollectPoint;
20 39 import com.cnlive.moudle.collectionTrace.model.RaceNameListInfo;
21 40 import com.cnlive.moudle.collectionTrace.ui.adapter.CollFinishDetaiAdapter;
... ... @@ -23,9 +42,11 @@ import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunRaceDetailFragment;
23 42 import com.cnlive.moudle.collectionTrace.ui.fragment.CollTraceListDetailFragment;
24 43 import com.cnlive.moudle.collectionTrace.utils.CollStepUtil;
25 44 import com.cnlive.moudle.pedometer.commonInfo.CommonInfo;
  45 +import com.cnlive.moudle.pedometer.model.Constant;
26 46 import com.cnlive.moudle.pedometer.ui.widget.SelectDialog;
27 47 import com.cnlive.moudle.pedometer.utils.GsonUtil;
28 48 import com.cnlive.moudle.pedometer.utils.MyMapUtil;
  49 +import com.cnlive.moudle.pedometer.utils.NetUtil;
29 50 import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil;
30 51 import com.cnlive.moudle.pedometer.utils.ScreenUtil;
31 52 import com.cnlive.moudle.pedometer.utils.TimeUtil;
... ... @@ -37,7 +58,8 @@ import com.sothree.slidinguppanel.SlidingUpPanelLayout;
37 58 import java.util.ArrayList;
38 59 import java.util.List;
39 60  
40   -public class CollTraceListDetailFragmentView implements MvpView {
  61 +public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener {
  62 + private final String TAG = "CollTraceListDetailView";
41 63 private CollTraceListDetailFragment fragment;
42 64 private RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean;
43 65 private CollFinishDetaiAdapter adapter;
... ... @@ -46,6 +68,9 @@ public class CollTraceListDetailFragmentView implements MvpView {
46 68 private UiSettings mUiSettings;
47 69 private LBSTraceClient mClient = null;
48 70 private List<Overlay> allMapOverlays;
  71 + private List<com.baidu.trace.model.LatLng> importPoints;
  72 + private String fenceEntityName;
  73 + private String position;
49 74  
50 75 public CollTraceListDetailFragmentView(CollTraceListDetailFragment fragment) {
51 76 this.fragment = fragment;
... ... @@ -55,10 +80,12 @@ public class CollTraceListDetailFragmentView implements MvpView {
55 80 return fragment == null ? null : fragment.getActivity();
56 81 }
57 82  
58   - public void initView(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean) {
  83 + public void initView(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, String fenceEntityName, String position) {
59 84 if (mClient == null) {
60 85 mClient = new LBSTraceClient(fragment.getActivity());
61 86 }
  87 + this.position = position;
  88 + this.fenceEntityName = fenceEntityName;
62 89 this.eventShoeLinesBean = eventShoeLinesBean;
63 90 allMapOverlays = new ArrayList<>();
64 91 //设置滑动卡片
... ... @@ -67,6 +94,75 @@ public class CollTraceListDetailFragmentView implements MvpView {
67 94 CollectPoint startPoint = null;
68 95 List<CollectPoint> resultCollectPoints = null;
69 96 List<CollectPoint> allCollectPoints = null;
  97 + //判断是否可以绑定
  98 + if (0 == eventShoeLinesBean.getIsEnable()) {
  99 + fragment.binding.rlScrollViewStartBtn.setTag("0");
  100 + fragment.binding.tvRunNow.setText("已绑定轨迹");
  101 + fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.gray_round));
  102 + }
  103 + //没有绑定
  104 + else {
  105 + fragment.binding.rlScrollViewStartBtn.setTag("1");
  106 + fragment.binding.tvRunNow.setText("绑定轨迹");
  107 + fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.green_round));
  108 +
  109 + }
  110 + fragment.binding.rlScrollViewStartBtn.setOnTouchListener(new View.OnTouchListener() {
  111 + @Override
  112 + public boolean onTouch(View view, MotionEvent motionEvent) {
  113 + if (motionEvent.getAction()==MotionEvent.ACTION_DOWN){
  114 + if ("0".equals(fragment.binding.rlScrollViewStartBtn.getTag().toString())) {
  115 + return false;
  116 + }
  117 + if (!NetUtil.isNetworkConnected(fragment.getActivity())) {
  118 + AlertUtil.showDeftToast(fragment.getActivity(), "无法连接网络");
  119 + return false;
  120 + }
  121 + importPoints = null;
  122 + //设置打的重要点
  123 + if (!TextUtils.isEmpty(eventShoeLinesBean.getLatLongitude())) {
  124 + List<CollectPoint> collectPoints = GsonUtil.jsonToList(eventShoeLinesBean.getLatLongitude(), CollectPoint.class);
  125 + if (null != collectPoints) {
  126 + importPoints = new ArrayList<>();
  127 + for (CollectPoint collectPoint : collectPoints) {
  128 + com.baidu.trace.model.LatLng latLng = new com.baidu.trace.model.LatLng(collectPoint.getLatitude(), collectPoint.getLongitude());
  129 + importPoints.add(latLng);
  130 + }
  131 + }
  132 + }
  133 + SelectDialog selectDialog = new SelectDialog(fragment.getActivity(), "确定绑定该轨迹?", "否", new SelectDialog.DialogInterface() {
  134 + @Override
  135 + public void onClick(SelectDialog dialog) {
  136 + dialog.cancel();
  137 + }
  138 + }, "是", new SelectDialog.DialogInterface() {
  139 + @Override
  140 + public void onClick(SelectDialog dialog) {
  141 + dialog.cancel();
  142 + //先判断当前是否已经绑定轨迹
  143 + if (TextUtils.isEmpty(fenceEntityName)) {
  144 + Log.e(TAG, "onClick: 未绑定轨迹");
  145 + //开始绑定轨迹
  146 + //判断是否有打的点
  147 + if (null != importPoints && !TextUtils.isEmpty(eventShoeLinesBean.getDarenId()) && !TextUtils.isEmpty(eventShoeLinesBean.getEventName())) {
  148 + addFence(eventShoeLinesBean.getDarenId(), eventShoeLinesBean.getEventName(), importPoints);
  149 + }
  150 + } else {
  151 + Log.e(TAG, "onClick: 已绑定轨迹");
  152 + //开始查询
  153 + queryFenceList(fenceEntityName);
  154 + }
  155 +
  156 + }
  157 + });
  158 + selectDialog.setCancelable(false);
  159 + selectDialog.setCanceledOnTouchOutside(false);
  160 + selectDialog.show();
  161 + //
  162 + }
  163 + return false;
  164 + }
  165 + });
70 166 if (!TextUtils.isEmpty(eventShoeLinesBean.getLatLongitude())) {
71 167 resultCollectPoints = GsonUtil.jsonToList(eventShoeLinesBean.getLatLongitude(), CollectPoint.class);
72 168 allCollectPoints = GsonUtil.jsonToList(eventShoeLinesBean.getLatLongitude(), CollectPoint.class);
... ... @@ -120,14 +216,14 @@ public class CollTraceListDetailFragmentView implements MvpView {
120 216 if (!TextUtils.isEmpty(eventShoeLinesBean.getStartTime()) && !TextUtils.isEmpty(eventShoeLinesBean.getEndTime()) && !TextUtils.isEmpty(eventShoeLinesBean.getEntityName())) {
121 217 long startTime = Long.parseLong(eventShoeLinesBean.getStartTime());
122 218 long endTime = Long.parseLong(eventShoeLinesBean.getEndTime());
123   - String entityName = eventShoeLinesBean.getEntityName();
  219 + String entityNameTrace = eventShoeLinesBean.getDarenId();
124 220  
125 221 //开始查询
126   - MyMapUtil.queryHistoryTrace(getContext(), mClient, entityName, startTime, endTime, new MyMapUtil.CallBack() {
  222 + MyMapUtil.queryHistoryTrace(getContext(), mClient, entityNameTrace, startTime, endTime, new MyMapUtil.CallBack() {
127 223 @Override
128 224 public void success(List<LatLng> resultPoints) {
129 225 if (null != resultPoints) {
130   - MyMapUtil.drawHistoryTrack(getContext(),baiduMap,resultPoints, SortType.asc,R.color.green_round,R.drawable.icon_start,R.drawable.icon_end);
  226 + MyMapUtil.drawHistoryTrack(getContext(), baiduMap, resultPoints, SortType.asc, R.color.green_round, R.drawable.icon_start, R.drawable.icon_end);
131 227 }
132 228 }
133 229 });
... ... @@ -142,8 +238,189 @@ public class CollTraceListDetailFragmentView implements MvpView {
142 238 fragment.getActivity().finish();
143 239 }
144 240 });
145   - fragment.binding.rlScrollViewStartBtn.setVisibility(View.GONE);
  241 + fragment.binding.rlScrollViewStartBtn.setOnClickListener(new View.OnClickListener() {
  242 + @Override
  243 + public void onClick(View view) {
  244 +
  245 + }
  246 + });
  247 + }
  248 +
  249 + private void addFence(String entityName, String fenceName, List<com.baidu.trace.model.LatLng> latLngs) {
  250 + if (null == fragment.getActivity()) {
  251 + return;
  252 + }
  253 + QMUITipDialogUtil.loadingDialog(fragment.getActivity(), "正在创建地理围栏", false);
  254 + int offset = Constant.FENCE_OFFSET;// 偏离距离
  255 + int denoise = Constant.FENCE_DENOISE; //围栏去噪精度
  256 + if (mClient != null && !TextUtils.isEmpty(entityName)) {
  257 + new Handler().postDelayed(new Runnable() {
  258 + @Override
  259 + public void run() {
  260 + CreateFenceRequest createFenceRequest = null;
  261 + createFenceRequest = CreateFenceRequest.buildServerPolylineRequest(Constant.TAG, Constant.SERVICE_ID, fenceName, entityName, latLngs, offset, denoise, CoordType.gcj02);
  262 + mClient.createFence(createFenceRequest, CollTraceListDetailFragmentView.this);
  263 + }
  264 + }, 1000);
  265 + }
  266 + }
  267 +
  268 + /**
  269 + * 查询地理围栏
  270 + */
  271 + private void queryFenceList(String entityName) {
  272 + QMUITipDialogUtil.loadingDialog(fragment.getActivity(), "正在查询围栏信息...", false);
  273 + List<Long> fenceId = new ArrayList<>();
  274 + fenceId.add(0L);
  275 + FenceListRequest fenceListRequest = FenceListRequest.buildServerRequest(Constant.TAG, Constant.SERVICE_ID, entityName, null, CoordType.gcj02, 1, 5000);
  276 + if (null != mClient || null != fenceListRequest) {
  277 + mClient.queryFenceList(fenceListRequest, CollTraceListDetailFragmentView.this);
  278 + }
  279 + }
  280 +
  281 +
  282 + public void updataBindBtnState(boolean isBind) {
  283 + if (isBind) {
  284 + fragment.binding.rlScrollViewStartBtn.setTag("0");
  285 + fragment.binding.tvRunNow.setText("已绑定轨迹");
  286 + fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.gray_round));
  287 + }
  288 + //没有绑定
  289 + else {
  290 + fragment.binding.rlScrollViewStartBtn.setTag("1");
  291 + fragment.binding.tvRunNow.setText("绑定轨迹");
  292 + fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.green_round));
  293 +
  294 + }
  295 + }
  296 +
  297 + @Override
  298 + public void onCreateFenceCallback(CreateFenceResponse createFenceResponse) {
  299 + //创建围栏成功
  300 + if (null == createFenceResponse) {
  301 + QMUITipDialogUtil.dismessDialog();
  302 + return;
  303 + }
  304 + Log.e(TAG, "onCreateFenceCallback: " + createFenceResponse.getMessage() + "状态:" + createFenceResponse.getStatus());
  305 + Log.e(TAG, "创建的围栏ID: " + createFenceResponse.getFenceId() + "围栏名称:" + createFenceResponse.getFenceName());
  306 + //围栏创建失败
  307 + if (5102 == createFenceResponse.getStatus()) {
  308 + QMUITipDialogUtil.dismessDialog();
  309 + QMUITipDialogUtil.failedDialog(fragment.getActivity(), createFenceResponse.getMessage(), 1);
  310 + } else {
  311 + if (null != eventShoeLinesBean) {
  312 + QMUITipDialogUtil.dismessDialog();
  313 + if (null == fragment.getPresenter() || null == getContext()) {
  314 + return;
  315 + }
  316 + fragment.getPresenter().bindingShoeLine(getContext(), eventShoeLinesBean.getId(), eventShoeLinesBean.getEventId(), createFenceResponse.getFenceId() + "", eventShoeLinesBean.getEventName(), position);
  317 + }
  318 + }
146 319 }
147 320  
  321 + @Override
  322 + public void onUpdateFenceCallback(UpdateFenceResponse updateFenceResponse) {
148 323  
  324 + }
  325 +
  326 + @Override
  327 + public void onDeleteFenceCallback(DeleteFenceResponse deleteFenceResponse) {
  328 + //删除围栏
  329 + if (null == deleteFenceResponse) {
  330 + return;
  331 + }
  332 + Log.e(TAG, "onDeleteFenceCallback: " + deleteFenceResponse.getMessage() + ",状态:" + deleteFenceResponse.getStatus());
  333 + //删除成功
  334 + if (0 == deleteFenceResponse.getStatus()) {
  335 + QMUITipDialogUtil.dismessDialog();
  336 + addFence(eventShoeLinesBean.getDarenId(), eventShoeLinesBean.getEventName(), importPoints);
  337 + } else {
  338 + QMUITipDialogUtil.dismessDialog();
  339 + }
  340 + }
  341 +
  342 + /**
  343 + * 查询围栏列表回调接口
  344 + *
  345 + * @param fenceListResponse
  346 + */
  347 + @Override
  348 + public void onFenceListCallback(FenceListResponse fenceListResponse) {
  349 + if (null == fenceListResponse) {
  350 + return;
  351 + }
  352 + List<Long> fenceIdList = null;
  353 + if (null != fenceListResponse.getFenceInfos()) {
  354 + fenceIdList = new ArrayList<>();
  355 + for (FenceInfo fenceInfo : fenceListResponse.getFenceInfos()) {
  356 + //如果是线性围栏
  357 + if (fenceInfo.getFenceShape() == FenceShape.polyline) {
  358 + //判断是否是当前围栏名称
  359 + if (null != eventShoeLinesBean) {
  360 + if (!TextUtils.isEmpty(eventShoeLinesBean.getEventName())) {
  361 + String serverFenceName = fenceInfo.getPolylineFence().getFenceName();
  362 + String currentFenceName = eventShoeLinesBean.getEventName();
  363 + if (serverFenceName.equals(currentFenceName)) {
  364 + //添加围栏id
  365 + fenceIdList.add(fenceInfo.getPolylineFence().getFenceId());
  366 + }
  367 + }
  368 + }
  369 +
  370 + }
  371 + }
  372 + //判断围栏是否查询到
  373 + if (null != fenceIdList && fenceIdList.size() > 0) {
  374 + Log.e(TAG, "onFenceListCallback: 获取到围栏数量" + fenceIdList.size());
  375 + List<Long> finalFenceIdList = fenceIdList;
  376 + new Handler().postDelayed(new Runnable() {
  377 + @Override
  378 + public void run() {
  379 + QMUITipDialogUtil.dismessDialog();
  380 + //开始删除围栏
  381 + DeleteFenceRequest deleteFenceRequest = DeleteFenceRequest.buildServerRequest(Constant.TAG, Constant.SERVICE_ID, fenceEntityName, finalFenceIdList);
  382 + if (null != mClient) {
  383 + QMUITipDialogUtil.loadingDialog(fragment.getActivity(), "正在删除围栏", false);
  384 + mClient.deleteFence(deleteFenceRequest, CollTraceListDetailFragmentView.this);
  385 + }
  386 + }
  387 + }, 1000);
  388 + } else {
  389 + //没有查询到围栏,直接添加
  390 + addFence(eventShoeLinesBean.getDarenId(), eventShoeLinesBean.getEventName(), importPoints);
  391 + }
  392 + } else {
  393 + QMUITipDialogUtil.dismessDialog();
  394 + }
  395 + }
  396 +
  397 + @Override
  398 + public void onMonitoredStatusCallback(MonitoredStatusResponse monitoredStatusResponse) {
  399 +
  400 + }
  401 +
  402 + @Override
  403 + public void onMonitoredStatusByLocationCallback(MonitoredStatusByLocationResponse monitoredStatusByLocationResponse) {
  404 +
  405 + }
  406 +
  407 + @Override
  408 + public void onHistoryAlarmCallback(HistoryAlarmResponse historyAlarmResponse) {
  409 +
  410 + }
  411 +
  412 + @Override
  413 + public void onAddMonitoredPersonCallback(AddMonitoredPersonResponse addMonitoredPersonResponse) {
  414 +
  415 + }
  416 +
  417 + @Override
  418 + public void onDeleteMonitoredPersonCallback(DeleteMonitoredPersonResponse deleteMonitoredPersonResponse) {
  419 +
  420 + }
  421 +
  422 + @Override
  423 + public void onListMonitoredPersonCallback(ListMonitoredPersonResponse listMonitoredPersonResponse) {
  424 +
  425 + }
149 426 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/RaceNameListView.java
... ... @@ -129,7 +129,7 @@ public class RaceNameListView implements MvpView, OnFenceListener {
129 129 adapter.setOnItemClick(new RaceNameListAdapter.OnItemClick() {
130 130 @Override
131 131 public void onItemClickListener(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, int position) {
132   - CollTraceListDetailActivity.startActivity(fragment.getActivity(), eventShoeLinesBean);
  132 + CollTraceListDetailActivity.startActivity(fragment.getActivity(), eventShoeLinesBean, fragment.entityName, position + "");
133 133 }
134 134 });
135 135 adapter.setOnAddShoeLineClick(new RaceNameListAdapter.OnAddShoeLineClick() {
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/CollTraceListDetailActivity.java
... ... @@ -27,8 +27,10 @@ public class CollTraceListDetailActivity extends QMUIFragmentActivity {
27 27 protected void onCreate(Bundle savedInstanceState) {
28 28 super.onCreate(savedInstanceState);
29 29 eventShoeLinesBean = (RaceNameListInfo.EventShoeLinesBean) getIntent().getExtras().get("eventShoeLinesBean");
  30 + String fenceEntityName = getIntent().getExtras().getString("fenceEntityName");
  31 + String position= getIntent().getExtras().getString("position");
30 32 if (null != eventShoeLinesBean) {
31   - addFragment(CollTraceListDetailFragment.newInstance(eventShoeLinesBean));
  33 + addFragment(CollTraceListDetailFragment.newInstance(eventShoeLinesBean,fenceEntityName,position));
32 34 }
33 35 }
34 36  
... ... @@ -39,9 +41,11 @@ public class CollTraceListDetailActivity extends QMUIFragmentActivity {
39 41 .commit();
40 42 }
41 43  
42   - public static void startActivity(Activity activity, RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean) {
  44 + public static void startActivity(Activity activity, RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, String fenceEntityName,String position) {
43 45 Intent intent = new Intent(activity, CollTraceListDetailActivity.class);
44 46 intent.putExtra("eventShoeLinesBean", eventShoeLinesBean);
  47 + intent.putExtra("fenceEntityName", fenceEntityName);
  48 + intent.putExtra("position", position);
45 49 activity.startActivity(intent);
46 50 }
47 51 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/fragment/CollTraceListDetailFragment.java
... ... @@ -20,11 +20,14 @@ import com.example.moudle_pedometer.databinding.FragmentCollRaceDetailBinding;
20 20 */
21 21 public class CollTraceListDetailFragment extends QMUIFragment<CollTraceListDetailFragmentView, CollTraceListDetailFragmentPresenter, FragmentCollRaceDetailBinding> {
22 22 private RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean;
  23 + private String position;
23 24  
24   - public static CollTraceListDetailFragment newInstance(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean) {
  25 + public static CollTraceListDetailFragment newInstance(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, String fenceEntityName, String position) {
25 26 CollTraceListDetailFragment fragment = new CollTraceListDetailFragment();
26 27 Bundle bundle = new Bundle();
27 28 bundle.putSerializable("eventShoeLinesBean", eventShoeLinesBean);
  29 + bundle.putString("fenceEntityName", fenceEntityName);
  30 + bundle.putString("position", position);
28 31 fragment.setArguments(bundle);
29 32 return fragment;
30 33 }
... ... @@ -51,9 +54,11 @@ public class CollTraceListDetailFragment extends QMUIFragment&lt;CollTraceListDetai
51 54  
52 55 if (null != getArguments()) {
53 56 eventShoeLinesBean = (RaceNameListInfo.EventShoeLinesBean) getArguments().get("eventShoeLinesBean");
  57 + String fenceEntityName = getArguments().getString("fenceEntityName");
  58 + position = getArguments().getString("position");
54 59 if (null != eventShoeLinesBean) {
55 60 if (null != getMvpView()) {
56   - getMvpView().initView(eventShoeLinesBean);
  61 + getMvpView().initView(eventShoeLinesBean, fenceEntityName,position);
57 62 }
58 63 }
59 64 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/model/Constant.java
... ... @@ -25,12 +25,13 @@ public class Constant {
25 25 public static final int START_TRACE_GATHER_SUCCESS = 9;//启动轨迹服务成功(用户)
26 26 public static final int START_TRACE_GATHER_FAIL = 10;//启动轨迹服务失败(用户)
27 27 public static final int REGISTRATION_SUCCESS = 11;//用户报名成功
  28 + public static final int UPDATA_COLL_BIND_TRACE_LIST = 12;//更新已绑定列表
  29 +
28 30 public static final double PASS_RATE = 0.7;//通过率70%
29 31 public static final int CHECK_ACCURACY = 50;//判断用户是否完成的精度范围
30 32 public static final int LOCA_ACCURACY = 20;//定位过滤精度
31 33 public static final int LOCA_END_POINT_ACCURACY = 20;//终点位置比较精度
32 34 public static final int LOCA_START_POINT_ACCURACY = 200;//起点位置比较精度
33   - public static final int FENCE_OFFSET=70;//围栏偏离距离
34   - public static final int FENCE_DENOISE=70;//围栏去噪精度
35   -
  35 + public static final int FENCE_OFFSET = 70;//围栏偏离距离
  36 + public static final int FENCE_DENOISE = 70;//围栏去噪精度
36 37 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/QMUITipDialogUtil.java
... ... @@ -25,21 +25,26 @@ public class QMUITipDialogUtil {
25 25 * @param tipStr
26 26 */
27 27 public static void loadingDialog(Context context, String tipStr, boolean isCancel) {
28   - if (context == null) {
29   - return;
30   - }
31   - if (tipDialog!=null&&tipDialog.isShowing()){
32   - tipDialog.dismiss();
33   - }
34   - tipDialog = new QMUITipDialog.Builder(context)
35   - .setIconType(QMUITipDialog.Builder.ICON_TYPE_LOADING)
36   - .setTipWord(tipStr)
37   - .create();
38   - tipDialog.setCanceledOnTouchOutside(isCancel);//屏蔽返回键
39   - tipDialog.setCancelable(isCancel);
40   - if (!tipDialog.isShowing()) {
41   - tipDialog.show();
  28 + try {
  29 + if (context == null) {
  30 + return;
  31 + }
  32 + if (tipDialog != null && tipDialog.isShowing()) {
  33 + tipDialog.dismiss();
  34 + }
  35 + tipDialog = new QMUITipDialog.Builder(context)
  36 + .setIconType(QMUITipDialog.Builder.ICON_TYPE_LOADING)
  37 + .setTipWord(tipStr)
  38 + .create();
  39 + tipDialog.setCanceledOnTouchOutside(isCancel);//屏蔽返回键
  40 + tipDialog.setCancelable(isCancel);
  41 + if (!tipDialog.isShowing()) {
  42 + tipDialog.show();
  43 + }
  44 + } catch (Exception e) {
  45 +
42 46 }
  47 +
43 48 }
44 49  
45 50 /**
... ... @@ -48,34 +53,40 @@ public class QMUITipDialogUtil {
48 53 * @param context
49 54 */
50 55 public static void successDialog(Context context, String tipStr, int second) {
51   - if (context == null) {
52   - return;
53   - }
54   - if (tipDialog!=null&&tipDialog.isShowing()){
55   - tipDialog.dismiss();
56   - }
57   - tipDialog = new QMUITipDialog.Builder(context)
58   - .setIconType(QMUITipDialog.Builder.ICON_TYPE_SUCCESS)
59   - .setTipWord(tipStr)
60   - .create();
61   - tipDialog.setCanceledOnTouchOutside(false);//屏蔽返回键
62   - if (!tipDialog.isShowing()) {
63   - tipDialog.show();
64   - new Handler().postDelayed(new Runnable() {
65   - @Override
66   - public void run() {
67   - if (context == null) {
68   - return;
69   - }
70   - /**
71   - * 延时执行的代码
72   - */
73   - if (tipDialog != null && tipDialog.isShowing()) {
74   - tipDialog.dismiss();
  56 + try {
  57 + if (context == null) {
  58 + return;
  59 + }
  60 +
  61 + if (tipDialog != null && tipDialog.isShowing()) {
  62 + tipDialog.dismiss();
  63 + }
  64 + tipDialog = new QMUITipDialog.Builder(context)
  65 + .setIconType(QMUITipDialog.Builder.ICON_TYPE_SUCCESS)
  66 + .setTipWord(tipStr)
  67 + .create();
  68 + tipDialog.setCanceledOnTouchOutside(false);//屏蔽返回键
  69 + if (!tipDialog.isShowing()) {
  70 + tipDialog.show();
  71 + new Handler().postDelayed(new Runnable() {
  72 + @Override
  73 + public void run() {
  74 + if (context == null) {
  75 + return;
  76 + }
  77 + /**
  78 + * 延时执行的代码
  79 + */
  80 + if (tipDialog != null && tipDialog.isShowing()) {
  81 + tipDialog.dismiss();
  82 + }
75 83 }
76   - }
77   - }, second * 1000); // 延时2秒
  84 + }, second * 1000); // 延时2秒
  85 + }
  86 + } catch (Exception e) {
  87 +
78 88 }
  89 +
79 90 }
80 91  
81 92 /**
... ... @@ -84,34 +95,39 @@ public class QMUITipDialogUtil {
84 95 * @param context
85 96 */
86 97 public static void failedDialog(Context context, String tipStr, int second) {
  98 + try {
  99 + if (tipDialog != null && tipDialog.isShowing()) {
  100 + tipDialog.dismiss();
  101 + }
  102 + tipDialog = new QMUITipDialog.Builder(context)
  103 + .setIconType(QMUITipDialog.Builder.ICON_TYPE_FAIL)
  104 + .setTipWord(tipStr)
  105 + .create();
  106 + tipDialog.setCanceledOnTouchOutside(false);//屏蔽返回键
  107 + if (!tipDialog.isShowing()) {
  108 + tipDialog.show();
  109 + new Handler().postDelayed(new Runnable() {
  110 + @Override
  111 + public void run() {
  112 + if (context == null) {
  113 + return;
  114 + }
  115 + /**
  116 + * 延时执行的代码
  117 + */
  118 + if (tipDialog != null && tipDialog.isShowing()) {
  119 + tipDialog.dismiss();
  120 + }
  121 + }
  122 + }, second * 1000); // 延时2秒
  123 + }
  124 + } catch (Exception e) {
  125 +
  126 + }
87 127 if (context == null) {
88 128 return;
89 129 }
90   - if (tipDialog!=null&&tipDialog.isShowing()){
91   - tipDialog.dismiss();
92   - }
93   - tipDialog = new QMUITipDialog.Builder(context)
94   - .setIconType(QMUITipDialog.Builder.ICON_TYPE_FAIL)
95   - .setTipWord(tipStr)
96   - .create();
97   - tipDialog.setCanceledOnTouchOutside(false);//屏蔽返回键
98   - if (!tipDialog.isShowing()) {
99   - tipDialog.show();
100   - new Handler().postDelayed(new Runnable() {
101   - @Override
102   - public void run() {
103   - if (context == null) {
104   - return;
105   - }
106   - /**
107   - * 延时执行的代码
108   - */
109   - if (tipDialog != null && tipDialog.isShowing()) {
110   - tipDialog.dismiss();
111   - }
112   - }
113   - }, second * 1000); // 延时2秒
114   - }
  130 +
115 131  
116 132 }
117 133  
... ... @@ -121,32 +137,37 @@ public class QMUITipDialogUtil {
121 137 * @param context
122 138 */
123 139 public static void messageDialog(Context context, String tipStr, int second) {
  140 + try {
  141 + if (tipDialog != null && tipDialog.isShowing()) {
  142 + tipDialog.dismiss();
  143 + }
  144 + tipDialog = new QMUITipDialog.Builder(context)
  145 + .setIconType(QMUITipDialog.Builder.ICON_TYPE_INFO)
  146 + .setTipWord(tipStr)
  147 + .create();
  148 + tipDialog.setCanceledOnTouchOutside(false);//屏蔽返回键
  149 + if (!tipDialog.isShowing()) {
  150 + tipDialog.show();
  151 + new Handler().postDelayed(new Runnable() {
  152 + @Override
  153 + public void run() {
  154 + if (context == null) {
  155 + return;
  156 + }
  157 + /**
  158 + * 延时执行的代码
  159 + */
  160 + tipDialog.dismiss();
  161 + }
  162 + }, second * 1000); // 延时2秒
  163 + }
  164 + } catch (Exception e) {
  165 +
  166 + }
124 167 if (context == null) {
125 168 return;
126 169 }
127   - if (tipDialog!=null&&tipDialog.isShowing()){
128   - tipDialog.dismiss();
129   - }
130   - tipDialog = new QMUITipDialog.Builder(context)
131   - .setIconType(QMUITipDialog.Builder.ICON_TYPE_INFO)
132   - .setTipWord(tipStr)
133   - .create();
134   - tipDialog.setCanceledOnTouchOutside(false);//屏蔽返回键
135   - if (!tipDialog.isShowing()) {
136   - tipDialog.show();
137   - new Handler().postDelayed(new Runnable() {
138   - @Override
139   - public void run() {
140   - if (context == null) {
141   - return;
142   - }
143   - /**
144   - * 延时执行的代码
145   - */
146   - tipDialog.dismiss();
147   - }
148   - }, second * 1000); // 延时2秒
149   - }
  170 +
150 171 }
151 172  
152 173  
... ... @@ -156,36 +177,46 @@ public class QMUITipDialogUtil {
156 177 * @param context
157 178 */
158 179 public static void textDialog(Context context, String tipStr, int second) {
159   - if (context == null) {
160   - return;
161   - }
162   - if (tipDialog!=null&&tipDialog.isShowing()){
163   - tipDialog.dismiss();
164   - }
165   - tipDialog = new QMUITipDialog.Builder(context)
166   - .setTipWord(tipStr)
167   - .create();
168   - tipDialog.setCanceledOnTouchOutside(false);//屏蔽返回键
169   - if (!tipDialog.isShowing()) {
170   - tipDialog.show();
171   - new Handler().postDelayed(new Runnable() {
172   - @Override
173   - public void run() {
174   - if (context == null) {
175   - return;
  180 + try {
  181 + if (context == null) {
  182 + return;
  183 + }
  184 + if (tipDialog != null && tipDialog.isShowing()) {
  185 + tipDialog.dismiss();
  186 + }
  187 + tipDialog = new QMUITipDialog.Builder(context)
  188 + .setTipWord(tipStr)
  189 + .create();
  190 + tipDialog.setCanceledOnTouchOutside(false);//屏蔽返回键
  191 + if (!tipDialog.isShowing()) {
  192 + tipDialog.show();
  193 + new Handler().postDelayed(new Runnable() {
  194 + @Override
  195 + public void run() {
  196 + if (context == null) {
  197 + return;
  198 + }
  199 + /**
  200 + * 延时执行的代码
  201 + */
  202 + tipDialog.dismiss();
176 203 }
177   - /**
178   - * 延时执行的代码
179   - */
180   - tipDialog.dismiss();
181   - }
182   - }, second * 1000); // 延时2秒
  204 + }, second * 1000); // 延时2秒
  205 + }
  206 + } catch (Exception e) {
  207 +
183 208 }
  209 +
184 210 }
185 211  
186 212 public static void dismessDialog() {
187   - if (tipDialog != null && tipDialog.isShowing()) {
188   - tipDialog.dismiss();
  213 + try {
  214 + if (tipDialog != null && tipDialog.isShowing()) {
  215 + tipDialog.dismiss();
  216 + }
  217 + } catch (Exception e) {
  218 +
189 219 }
  220 +
190 221 }
191 222 }
... ...
moudle_pedometer/src/main/res/layout/fragment_coll_race_detail.xml
... ... @@ -86,7 +86,7 @@
86 86 android:id="@+id/ll_root"
87 87 android:layout_width="match_parent"
88 88 android:layout_height="wrap_content"
89   - android:layout_marginBottom="0dp"
  89 + android:layout_marginBottom="40dp"
90 90 android:orientation="vertical">
91 91  
92 92  
... ... @@ -105,10 +105,10 @@
105 105 android:layout_width="match_parent"
106 106 android:layout_height="40sp"
107 107 android:layout_gravity="bottom"
108   - android:focusable="true"
  108 + android:background="@color/green_round"
109 109 android:clickable="true"
  110 + android:focusable="true"
110 111 android:focusableInTouchMode="true"
111   - android:background="@color/green_round"
112 112 android:gravity="center"
113 113 android:tag="0">
114 114  
... ... @@ -123,7 +123,7 @@
123 123 android:focusable="false"
124 124 android:focusableInTouchMode="false"
125 125 android:tag="0"
126   - android:text="定轨迹"
  126 + android:text="定轨迹"
127 127 android:textColor="@color/white"
128 128 android:textSize="18sp" />
129 129 </LinearLayout>
... ...