Commit 97f82ce4202c21dfe7597fee1b06cce44d341b44
1 parent
fabe2525
1 路径工具,打点页面逻辑
Showing
18 changed files
with
524 additions
and
79 deletions
app/build.gradle
| ... | ... | @@ -28,15 +28,16 @@ android { |
| 28 | 28 | buildConfigField("String", "APP_ID", stringValue("802_jhbqccxw08")) |
| 29 | 29 | buildConfigField("String", "APP_KEY", stringValue("9c5619e9be747bb3b925dd215ca5923d86f12c09b9394f")) |
| 30 | 30 | buildConfigField("String", "APP_SCERET", stringValue("1e6380cb347255e777f72b5aa60f41daa68443a132aaea")) |
| 31 | -// BAIDU_MAP_APP_KEY: "OeotXc38bbnU7WmyKGA0VMahk4v35VG2" | |
| 32 | - manifestPlaceholders = [ | |
| 31 | +// BAIDU_MAP_APP_KEY: "OeotXc38bbnU7WmyKGA0VMahk4v35VG2" //测试 | |
| 33 | 32 | |
| 34 | - BAIDU_MAP_APP_KEY: "2IIsTtvX2FA88yvDrPZedc2ZvMhxyDbN" | |
| 33 | + manifestPlaceholders = [ | |
| 35 | 34 | |
| 35 | +// BAIDU_MAP_APP_KEY: "2IIsTtvX2FA88yvDrPZedc2ZvMhxyDbN" | |
| 36 | + BAIDU_MAP_APP_KEY: "OeotXc38bbnU7WmyKGA0VMahk4v35VG2" | |
| 36 | 37 | |
| 37 | 38 | ] |
| 38 | 39 | } |
| 39 | -// BAIDU_MAP_APP_KEY: "Q7y9SGcZVs0tmhbNTiaz0jHm4S1xGzE2" | |
| 40 | +// BAIDU_MAP_APP_KEY: "Q7y9SGcZVs0tmhbNTiaz0jHm4S1xGzE2"//正式 | |
| 40 | 41 | // BAIDU_MAP_APP_KEY: "0bWeo04KKKHqTwozcqgyLZVd0oVhv3rZ" |
| 41 | 42 | |
| 42 | 43 | release { |
| ... | ... | @@ -45,7 +46,8 @@ android { |
| 45 | 46 | buildConfigField("String", "APP_KEY", stringValue("0d57b045ec0c3988a682d94c644e66b9b8e0d2b8ef937d")) |
| 46 | 47 | buildConfigField("String", "APP_SCERET", stringValue("275e8dc29274a1186d82f65bc607c231d02bcb3bfd8976")) |
| 47 | 48 | manifestPlaceholders = [ |
| 48 | - BAIDU_MAP_APP_KEY: "Q7y9SGcZVs0tmhbNTiaz0jHm4S1xGzE2" | |
| 49 | +// BAIDU_MAP_APP_KEY: "Q7y9SGcZVs0tmhbNTiaz0jHm4S1xGzE2" | |
| 50 | + BAIDU_MAP_APP_KEY: "0bWeo04KKKHqTwozcqgyLZVd0oVhv3rZ" | |
| 49 | 51 | ] |
| 50 | 52 | } |
| 51 | 53 | } | ... | ... |
app/src/main/java/com/example/modulepedometer/MainActivity.java
| ... | ... | @@ -6,6 +6,7 @@ import android.support.v7.app.AppCompatActivity; |
| 6 | 6 | import android.view.View; |
| 7 | 7 | |
| 8 | 8 | import com.cnlive.moudle.collectionTrace.ui.activity.CollRunRaceDetailActivity; |
| 9 | +import com.cnlive.moudle.collectionTrace.ui.activity.CollRunningFinishActivity; | |
| 9 | 10 | import com.cnlive.moudle.collectionTrace.ui.activity.RaceListActivity; |
| 10 | 11 | import com.cnlive.moudle.collectionTrace.ui.activity.RaceNameListActivity; |
| 11 | 12 | import com.cnlive.moudle.pedometer.ui.activity.MyRecordActivity; |
| ... | ... | @@ -32,13 +33,14 @@ public class MainActivity extends AppCompatActivity { |
| 32 | 33 | public void onClick(View v) { |
| 33 | 34 | Intent intent = new Intent(MainActivity.this, RaceListActivity.class); |
| 34 | 35 | startActivity(intent); |
| 36 | + //跳转界面 | |
| 37 | +// CollRunningFinishActivity.startActivity(MainActivity.this); | |
| 35 | 38 | } |
| 36 | 39 | }); |
| 37 | 40 | findViewById(R.id.tool2).setOnClickListener(new View.OnClickListener() { |
| 38 | 41 | @Override |
| 39 | 42 | public void onClick(View v) { |
| 40 | 43 | SelfRecordActivity.newInstance(MainActivity.this, "10513196",null,null,null); |
| 41 | -// startActivity(intent); | |
| 42 | 44 | } |
| 43 | 45 | }); |
| 44 | 46 | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/commonInfo/CollCommonInfo.java
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/presenter/CollTraceListDetailFragmentPresenter.java
0 → 100644
| 1 | +package com.cnlive.moudle.collectionTrace.frame.presenter; | |
| 2 | + | |
| 3 | +import com.cnlive.moudle.collectionTrace.frame.view.CollTraceListDetailFragmentView; | |
| 4 | +import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; | |
| 5 | + | |
| 6 | +public class CollTraceListDetailFragmentPresenter extends MvpBasePresenter<CollTraceListDetailFragmentView> { | |
| 7 | +} | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollRunRaceDetailFragmentView.java
| ... | ... | @@ -93,7 +93,7 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen |
| 93 | 93 | private LinkedList<LatLng> importLatLngs;//关键点 |
| 94 | 94 | private LatLng startLatLng = new LatLng(39.934733, 116.308646);//起始点 |
| 95 | 95 | private List<LatLng> trackPoints; |
| 96 | - private RunRaceDetailInfo runRaceDetailInfo; | |
| 96 | + public RunRaceDetailInfo runRaceDetailInfo; | |
| 97 | 97 | |
| 98 | 98 | public CollRunRaceDetailFragmentView(CollRunRaceDetailFragment fragment) { |
| 99 | 99 | this.fragment = fragment; |
| ... | ... | @@ -132,22 +132,48 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen |
| 132 | 132 | if (!TextUtils.isEmpty(runRaceDetailInfo.getTitle())) { |
| 133 | 133 | fragment.binding.includeStreet.tvRaceTitle.setText(runRaceDetailInfo.getTitle()); |
| 134 | 134 | } |
| 135 | - fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 140)); | |
| 135 | + | |
| 136 | + //判断是否显示绑定轨迹按钮 | |
| 137 | + if (runRaceDetailInfo.isTrackButton()) { | |
| 138 | + //显示 | |
| 139 | + fragment.binding.rlScrollViewAddTrace.setVisibility(View.VISIBLE); | |
| 140 | + fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 140)); | |
| 136 | 141 | // //根据标题行数,自动调整卡片大小 |
| 137 | - fragment.binding.includeStreet.tvRaceTitle.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { | |
| 138 | - @Override | |
| 139 | - public boolean onPreDraw() { | |
| 140 | - int line = fragment.binding.includeStreet.tvRaceTitle.getLineCount(); | |
| 141 | - int height = fragment.binding.includeStreet.tvRaceTitle.getHeight(); | |
| 142 | - if (line > 1) { | |
| 143 | - int avgHeight = height / line;//平局高度 | |
| 144 | - fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 140) + avgHeight * (line - 1)); | |
| 142 | + fragment.binding.includeStreet.tvRaceTitle.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { | |
| 143 | + @Override | |
| 144 | + public boolean onPreDraw() { | |
| 145 | + int line = fragment.binding.includeStreet.tvRaceTitle.getLineCount(); | |
| 146 | + int height = fragment.binding.includeStreet.tvRaceTitle.getHeight(); | |
| 147 | + if (line > 1) { | |
| 148 | + int avgHeight = height / line;//平局高度 | |
| 149 | + fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 140) + avgHeight * (line - 1)); | |
| 145 | 150 | |
| 151 | + } | |
| 152 | + fragment.binding.includeStreet.tvRaceTitle.getViewTreeObserver().removeOnPreDrawListener(this); | |
| 153 | + return false; | |
| 146 | 154 | } |
| 147 | - fragment.binding.includeStreet.tvRaceTitle.getViewTreeObserver().removeOnPreDrawListener(this); | |
| 148 | - return false; | |
| 149 | - } | |
| 150 | - }); | |
| 155 | + }); | |
| 156 | + } else { | |
| 157 | + //不显示 | |
| 158 | + fragment.binding.rlScrollViewAddTrace.setVisibility(View.GONE); | |
| 159 | + fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 100)); | |
| 160 | +// //根据标题行数,自动调整卡片大小 | |
| 161 | + fragment.binding.includeStreet.tvRaceTitle.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { | |
| 162 | + @Override | |
| 163 | + public boolean onPreDraw() { | |
| 164 | + int line = fragment.binding.includeStreet.tvRaceTitle.getLineCount(); | |
| 165 | + int height = fragment.binding.includeStreet.tvRaceTitle.getHeight(); | |
| 166 | + if (line > 1) { | |
| 167 | + int avgHeight = height / line;//平局高度 | |
| 168 | + fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 100) + avgHeight * (line - 1)); | |
| 169 | + | |
| 170 | + } | |
| 171 | + fragment.binding.includeStreet.tvRaceTitle.getViewTreeObserver().removeOnPreDrawListener(this); | |
| 172 | + return false; | |
| 173 | + } | |
| 174 | + }); | |
| 175 | + | |
| 176 | + } | |
| 151 | 177 | //设置活动地点 |
| 152 | 178 | if (!TextUtils.isEmpty(runRaceDetailInfo.getAddress())) { |
| 153 | 179 | fragment.binding.includeStreet.tvAddress.setText(runRaceDetailInfo.getAddress()); |
| ... | ... | @@ -190,6 +216,7 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen |
| 190 | 216 | GlideApp.with(getContext()).load(runRaceDetailInfo.getRoadmap()).into(fragment.binding.includeStreetIntroduce.ivRoadMao); |
| 191 | 217 | |
| 192 | 218 | } |
| 219 | + | |
| 193 | 220 | //添加轨迹按钮点击事件 |
| 194 | 221 | fragment.binding.rlScrollViewAddTrace.setOnClickListener(new View.OnClickListener() { |
| 195 | 222 | @Override | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollRunningFinishFragmentView.java
| ... | ... | @@ -215,7 +215,8 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { |
| 215 | 215 | @Override |
| 216 | 216 | public void run() { |
| 217 | 217 | if (null != collectLatLngs && collectLatLngs.size() > 1) { |
| 218 | - getBaiDuSnap(); | |
| 218 | +// getBaiDuSnap(); | |
| 219 | + addFence(); | |
| 219 | 220 | } |
| 220 | 221 | } |
| 221 | 222 | }, 1000); |
| ... | ... | @@ -311,7 +312,7 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { |
| 311 | 312 | if (null != resultPoints) { |
| 312 | 313 | //绘制轨迹 |
| 313 | 314 | MyMapUtil.drawHistoryTrack(getContext(), baiduMap, resultPoints, SortType.asc, R.color.green_round, R.drawable.icon_start, R.drawable.icon_end); |
| 314 | - }else { | |
| 315 | + } else { | |
| 315 | 316 | SelectDialog selectDialog = new SelectDialog(getContext(), "轨迹获取失败,是否重试?", "取消", new SelectDialog.DialogInterface() { |
| 316 | 317 | @Override |
| 317 | 318 | public void onClick(SelectDialog dialog) { |
| ... | ... | @@ -321,7 +322,7 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { |
| 321 | 322 | @Override |
| 322 | 323 | public void onClick(SelectDialog dialog) { |
| 323 | 324 | dialog.dismiss(); |
| 324 | - queryWalkTrace(startTime,endTime); | |
| 325 | + queryWalkTrace(startTime, endTime); | |
| 325 | 326 | } |
| 326 | 327 | }); |
| 327 | 328 | selectDialog.setCancelable(false); |
| ... | ... | @@ -415,6 +416,22 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { |
| 415 | 416 | } |
| 416 | 417 | } |
| 417 | 418 | |
| 419 | + private void addFence() { | |
| 420 | + QMUITipDialogUtil.dismessDialog(); | |
| 421 | + QMUITipDialogUtil.loadingDialog(getContext(), "正在创建地理围栏", false); | |
| 422 | + CreateFenceRequest createFenceRequest = null; | |
| 423 | + int offset = Constant.FENCE_OFFSET;// 偏离距离 | |
| 424 | + int denoise = Constant.FENCE_DENOISE; //围栏去噪精度 | |
| 425 | + if (null != collUserStepEntity) { | |
| 426 | + //赛事标题作为围栏名称 | |
| 427 | + String eventId = collUserStepEntity.getStreetId(); | |
| 428 | + if (mClient != null && !TextUtils.isEmpty(eventId) && null != collectLatLngs) { | |
| 429 | + createFenceRequest = CreateFenceRequest.buildServerPolylineRequest(Constant.TAG, Constant.SERVICE_ID, eventId, "cc", collectLatLngs, offset, denoise, CoordType.gcj02); | |
| 430 | + mClient.createFence(createFenceRequest, CollRunningFinishFragmentView.this); | |
| 431 | + } | |
| 432 | + } | |
| 433 | + } | |
| 434 | + | |
| 418 | 435 | // //判断地理围栏是否创建成功 |
| 419 | 436 | // if (null != collUserStepEntity) { |
| 420 | 437 | // if (TextUtils.isEmpty(collUserStepEntity.getFenceId())) { | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollTraceListDetailFragmentView.java
0 → 100644
| 1 | +package com.cnlive.moudle.collectionTrace.frame.view; | |
| 2 | + | |
| 3 | +import android.os.Handler; | |
| 4 | +import android.support.v7.widget.LinearLayoutManager; | |
| 5 | +import android.text.TextUtils; | |
| 6 | +import android.view.MotionEvent; | |
| 7 | +import android.view.View; | |
| 8 | + | |
| 9 | +import com.baidu.mapapi.map.BaiduMap; | |
| 10 | +import com.baidu.mapapi.map.MapView; | |
| 11 | +import com.baidu.mapapi.map.Overlay; | |
| 12 | +import com.baidu.mapapi.map.UiSettings; | |
| 13 | +import com.baidu.mapapi.model.LatLng; | |
| 14 | +import com.baidu.trace.LBSTraceClient; | |
| 15 | +import com.cnlive.moudle.collectionTrace.model.CollectPoint; | |
| 16 | +import com.cnlive.moudle.collectionTrace.model.RaceNameListInfo; | |
| 17 | +import com.cnlive.moudle.collectionTrace.ui.adapter.CollFinishDetaiAdapter; | |
| 18 | +import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunRaceDetailFragment; | |
| 19 | +import com.cnlive.moudle.collectionTrace.ui.fragment.CollTraceListDetailFragment; | |
| 20 | +import com.cnlive.moudle.collectionTrace.utils.CollStepUtil; | |
| 21 | +import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | |
| 22 | +import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; | |
| 23 | +import com.cnlive.moudle.pedometer.utils.GsonUtil; | |
| 24 | +import com.cnlive.moudle.pedometer.utils.MyMapUtil; | |
| 25 | +import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil; | |
| 26 | +import com.cnlive.moudle.pedometer.utils.ScreenUtil; | |
| 27 | +import com.cnlive.moudle.pedometer.utils.TimeUtil; | |
| 28 | +import com.cnlive.strike.application.GlideApp; | |
| 29 | +import com.example.moudle_pedometer.R; | |
| 30 | +import com.hannesdorfmann.mosby3.mvp.MvpView; | |
| 31 | +import com.sothree.slidinguppanel.SlidingUpPanelLayout; | |
| 32 | + | |
| 33 | +import java.util.ArrayList; | |
| 34 | +import java.util.List; | |
| 35 | + | |
| 36 | +public class CollTraceListDetailFragmentView implements MvpView { | |
| 37 | + private CollTraceListDetailFragment fragment; | |
| 38 | + private RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean; | |
| 39 | + private CollFinishDetaiAdapter adapter; | |
| 40 | + public BaiduMap baiduMap; | |
| 41 | + private MapView mMapView; | |
| 42 | + private UiSettings mUiSettings; | |
| 43 | + private LBSTraceClient mClient = null; | |
| 44 | + private List<Overlay> allMapOverlays; | |
| 45 | + | |
| 46 | + public CollTraceListDetailFragmentView(CollTraceListDetailFragment fragment) { | |
| 47 | + this.fragment = fragment; | |
| 48 | + } | |
| 49 | + | |
| 50 | + | |
| 51 | + public void initView(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean) { | |
| 52 | + if (mClient == null) { | |
| 53 | + mClient = new LBSTraceClient(fragment.getActivity()); | |
| 54 | + } | |
| 55 | + this.eventShoeLinesBean = eventShoeLinesBean; | |
| 56 | + allMapOverlays = new ArrayList<>(); | |
| 57 | + //设置滑动卡片 | |
| 58 | +// fragment.binding.slidingLayout.set | |
| 59 | + //添加起点 | |
| 60 | + CollectPoint startPoint = null; | |
| 61 | + List<CollectPoint> resultCollectPoints = null; | |
| 62 | + if (!TextUtils.isEmpty(eventShoeLinesBean.getLatLongitude())) { | |
| 63 | + resultCollectPoints = GsonUtil.jsonToList(eventShoeLinesBean.getLatLongitude(), CollectPoint.class); | |
| 64 | + } | |
| 65 | + //获取打点不为空 | |
| 66 | + if (null != resultCollectPoints && resultCollectPoints.size() > 1) { | |
| 67 | + //移除起点 | |
| 68 | + resultCollectPoints.remove(0); | |
| 69 | + //移除终点 | |
| 70 | + resultCollectPoints.remove(resultCollectPoints.size() - 1); | |
| 71 | + } | |
| 72 | + | |
| 73 | +// //查询用户历史轨迹 | |
| 74 | +// if (0 != collUserStepEntity.getStartTimeStamp() && 0 != collUserStepEntity.getFinishTimeStamp()) { | |
| 75 | +// long startTime = collUserStepEntity.getStartTimeStamp(); | |
| 76 | +// long endTime = collUserStepEntity.getFinishTimeStamp(); | |
| 77 | +// //开始查询 | |
| 78 | +// queryWalkTrace(startTime, endTime); | |
| 79 | +// if (!TextUtils.isEmpty(collUserStepEntity.getImportPoint())) { | |
| 80 | +// List<CollectPoint> collectPoints = GsonUtil.jsonToList(collUserStepEntity.getImportPoint(), CollectPoint.class); | |
| 81 | +// //绘制运营打的点 | |
| 82 | +// if (null != collectPoints) { | |
| 83 | +// //根据打点集合,自适应缩放 | |
| 84 | +// MyMapUtil.setCollMapAutoZoom(baiduMap, collectPoints, -1.5f); | |
| 85 | +// for (CollectPoint point : collectPoints) { | |
| 86 | +// LatLng markLatLng = new LatLng(point.getLatitude(), point.getLongitude()); | |
| 87 | +// if (null != markLatLng) { | |
| 88 | +// //将点位显示到地图上 | |
| 89 | +// Overlay overlay = MyMapUtil.setMapMarker(getContext(), baiduMap, markLatLng, R.drawable.icon_map_import); | |
| 90 | +// if (null != overlay) { | |
| 91 | +// allMapOverlays.add(overlay); | |
| 92 | +// } | |
| 93 | +// } | |
| 94 | +// } | |
| 95 | +// } | |
| 96 | +// } | |
| 97 | +// } | |
| 98 | +// //设置用户昵称 | |
| 99 | +// String nickName = CommonInfo.getUserNickName(getContext()); | |
| 100 | +// fragment.binding.includeFinishUserInfo.tvUserNickName.setText(nickName); | |
| 101 | +// //设置用户头像 | |
| 102 | +// String faceUrl = CommonInfo.getUserIcon(getContext()); | |
| 103 | +// if (!TextUtils.isEmpty(faceUrl)) { | |
| 104 | +// GlideApp.with(getContext()).load(faceUrl).into(fragment.binding.includeFinishUserInfo.qmIvIcon); | |
| 105 | +// } | |
| 106 | +// //设置标题 | |
| 107 | +// if (!TextUtils.isEmpty(collUserStepEntity.getStreetTitle())) { | |
| 108 | +// fragment.binding.includeFinishUserInfo.tvStreetName.setText(collUserStepEntity.getStreetTitle()); | |
| 109 | +// } | |
| 110 | +// //设置距离 | |
| 111 | +// if (!TextUtils.isEmpty(collUserStepEntity.getStepCount())) { | |
| 112 | +// fragment.binding.includeFinishUserInfo.tvDistance.setText(CollStepUtil.getWalkDistanceKM(Long.parseLong(collUserStepEntity.getStepCount())) + ""); | |
| 113 | +// } else { | |
| 114 | +// fragment.binding.includeFinishUserInfo.tvDistance.setText("0"); | |
| 115 | +// } | |
| 116 | +// if (0 != collUserStepEntity.getFinishTimeStamp()) { | |
| 117 | +// //设置日期 | |
| 118 | +// fragment.binding.includeFinishUserInfo.tvDate.setText(TimeUtil.getStampToTime(collUserStepEntity.getFinishTimeStamp() * 1000, "yyyy-MM-dd HH:mm")); | |
| 119 | +// } | |
| 120 | +// //设置适配器 | |
| 121 | +// if (!TextUtils.isEmpty(collUserStepEntity.getImportPoint())) { | |
| 122 | +// List<CollectPoint> collectPoints = GsonUtil.jsonToList(collUserStepEntity.getImportPoint(), CollectPoint.class); | |
| 123 | +// if (null == collectPoints) { | |
| 124 | +// collectPoints = new ArrayList<>(); | |
| 125 | +// } | |
| 126 | +// if (null != startPoint) { | |
| 127 | +// collectPoints.add(0, startPoint); | |
| 128 | +// } | |
| 129 | +// if (null != endPoint) { | |
| 130 | +// collectPoints.add(endPoint); | |
| 131 | +// } | |
| 132 | +// //格式化打的点 | |
| 133 | +// collectLatLngs = new ArrayList<>(); | |
| 134 | +// for (CollectPoint collectPoint : collectPoints) { | |
| 135 | +// collectLatLngs.add(new com.baidu.trace.model.LatLng(collectPoint.getLatitude(), collectPoint.getLongitude())); | |
| 136 | +// } | |
| 137 | +// adapter = new CollFinishDetaiAdapter(fragment.getActivity(), collectPoints); | |
| 138 | +// //设置 | |
| 139 | +// fragment.binding.includeFinishUserInfo.rvList.setLayoutManager(new LinearLayoutManager(fragment.getActivity())); | |
| 140 | +// fragment.binding.includeFinishUserInfo.rvList.setAdapter(adapter); | |
| 141 | +// } | |
| 142 | + //返回按钮点击 | |
| 143 | + fragment.binding.flBack.setOnClickListener(new View.OnClickListener() { | |
| 144 | + @Override | |
| 145 | + public void onClick(View view) { | |
| 146 | + if (fragment.getActivity() == null) { | |
| 147 | + return; | |
| 148 | + } | |
| 149 | + fragment.getActivity().finish(); | |
| 150 | + } | |
| 151 | + }); | |
| 152 | + fragment.binding.rlScrollViewStartBtn.setVisibility(View.GONE); | |
| 153 | + } | |
| 154 | + | |
| 155 | + | |
| 156 | +} | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/RaceNameListView.java
| 1 | 1 | package com.cnlive.moudle.collectionTrace.frame.view; |
| 2 | 2 | |
| 3 | 3 | import android.support.v7.widget.LinearLayoutManager; |
| 4 | +import android.util.Log; | |
| 4 | 5 | import android.view.View; |
| 5 | 6 | |
| 7 | +import com.baidu.trace.LBSTraceClient; | |
| 8 | +import com.baidu.trace.api.fence.AddMonitoredPersonResponse; | |
| 9 | +import com.baidu.trace.api.fence.CreateFenceResponse; | |
| 10 | +import com.baidu.trace.api.fence.DeleteFenceResponse; | |
| 11 | +import com.baidu.trace.api.fence.DeleteMonitoredPersonResponse; | |
| 12 | +import com.baidu.trace.api.fence.FenceListRequest; | |
| 13 | +import com.baidu.trace.api.fence.FenceListResponse; | |
| 14 | +import com.baidu.trace.api.fence.HistoryAlarmResponse; | |
| 15 | +import com.baidu.trace.api.fence.ListMonitoredPersonResponse; | |
| 16 | +import com.baidu.trace.api.fence.MonitoredStatusByLocationResponse; | |
| 17 | +import com.baidu.trace.api.fence.MonitoredStatusResponse; | |
| 18 | +import com.baidu.trace.api.fence.OnFenceListener; | |
| 19 | +import com.baidu.trace.api.fence.UpdateFenceResponse; | |
| 20 | +import com.baidu.trace.model.CoordType; | |
| 6 | 21 | import com.cnlive.libs.base.util.AlertUtil; |
| 22 | +import com.cnlive.moudle.collectionTrace.commonInfo.CollCommonInfo; | |
| 7 | 23 | import com.cnlive.moudle.collectionTrace.model.RaceNameListInfo; |
| 8 | 24 | import com.cnlive.moudle.collectionTrace.ui.activity.StartCollectTraceActivity; |
| 9 | 25 | import com.cnlive.moudle.collectionTrace.ui.adapter.RaceNameListAdapter; |
| 10 | 26 | import com.cnlive.moudle.collectionTrace.ui.fragment.RaceNameListFragment; |
| 11 | 27 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 28 | +import com.cnlive.moudle.pedometer.model.Constant; | |
| 12 | 29 | import com.cnlive.moudle.pedometer.net.bean.BaseInfo; |
| 30 | +import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; | |
| 13 | 31 | import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; |
| 14 | 32 | import com.example.moudle_pedometer.R; |
| 15 | 33 | import com.hannesdorfmann.mosby3.mvp.MvpView; |
| ... | ... | @@ -23,11 +41,13 @@ import java.util.List; |
| 23 | 41 | /** |
| 24 | 42 | * Created by hanyayun 019/06/25. |
| 25 | 43 | */ |
| 26 | -public class RaceNameListView implements MvpView { | |
| 44 | +public class RaceNameListView implements MvpView, OnFenceListener { | |
| 45 | + private final String TAG = "RaceNameListView"; | |
| 27 | 46 | RaceNameListFragment fragment; |
| 28 | 47 | public QMUITipDialog loadingDiaog; |
| 29 | 48 | List<RaceNameListInfo.EventShoeLinesBean> list = new ArrayList<>(); |
| 30 | 49 | private RaceNameListAdapter adapter; |
| 50 | + private LBSTraceClient mClient = null; | |
| 31 | 51 | |
| 32 | 52 | public RaceNameListView(RaceNameListFragment fragment) { |
| 33 | 53 | this.fragment = fragment; |
| ... | ... | @@ -38,9 +58,21 @@ public class RaceNameListView implements MvpView { |
| 38 | 58 | } |
| 39 | 59 | |
| 40 | 60 | |
| 41 | - public void initView(){ | |
| 61 | + public void initView(RunRaceDetailInfo runRaceDetailInfo) { | |
| 62 | + if (mClient == null) { | |
| 63 | + mClient = new LBSTraceClient(fragment.getActivity()); | |
| 64 | + } | |
| 42 | 65 | fragment.binding.raceBack.setOnClickListener(v -> fragment.getActivity().finish()); |
| 43 | - fragment.binding.intoPath.setOnClickListener(v -> StartCollectTraceActivity.newInstance(fragment.getActivity(),fragment.eventId)); | |
| 66 | + | |
| 67 | + fragment.binding.intoPath.setOnClickListener(new View.OnClickListener() { | |
| 68 | + @Override | |
| 69 | + public void onClick(View view) { | |
| 70 | + if (null != runRaceDetailInfo) { | |
| 71 | + StartCollectTraceActivity.newInstance(fragment.getActivity(), fragment.eventId, runRaceDetailInfo); | |
| 72 | + } | |
| 73 | + } | |
| 74 | + }); | |
| 75 | + | |
| 44 | 76 | fragment.binding.raceTittle.setText("轨迹列表"); |
| 45 | 77 | fragment.binding.refreshLayout.setRefreshHeader(new ClassicsHeader(fragment.getActivity())); |
| 46 | 78 | fragment.binding.refreshLayout.setRefreshFooter(new ClassicsFooter(fragment.getActivity())); |
| ... | ... | @@ -48,10 +80,10 @@ public class RaceNameListView implements MvpView { |
| 48 | 80 | } |
| 49 | 81 | |
| 50 | 82 | |
| 51 | - public void bindingShoeLine(int position){ | |
| 83 | + public void bindingShoeLine(int position) { | |
| 52 | 84 | list.get(position).setIsEnable(0); |
| 53 | - for(int i = 0;i <list.size();i++){ | |
| 54 | - if(i != position && list.get(i).getIsEnable() == 0){ | |
| 85 | + for (int i = 0; i < list.size(); i++) { | |
| 86 | + if (i != position && list.get(i).getIsEnable() == 0) { | |
| 55 | 87 | list.get(i).setIsEnable(1); |
| 56 | 88 | } |
| 57 | 89 | } |
| ... | ... | @@ -59,18 +91,18 @@ public class RaceNameListView implements MvpView { |
| 59 | 91 | } |
| 60 | 92 | |
| 61 | 93 | |
| 62 | - public void delectShoeLine(int position){ | |
| 94 | + public void delectShoeLine(int position) { | |
| 63 | 95 | list.remove(position); |
| 64 | 96 | adapter.notifyDataSetChanged(); |
| 65 | 97 | } |
| 66 | 98 | |
| 67 | - public void onSuccess(BaseInfo<RaceNameListInfo> raceNameListInfoBaseInfo){ | |
| 99 | + public void onSuccess(BaseInfo<RaceNameListInfo> raceNameListInfoBaseInfo) { | |
| 68 | 100 | hideLoading(); |
| 69 | - if(fragment.currentPage == 1){ | |
| 101 | + if (fragment.currentPage == 1) { | |
| 70 | 102 | list.clear(); |
| 71 | 103 | list.addAll(raceNameListInfoBaseInfo.getData().getEventShoeLines()); |
| 72 | - if(adapter == null){ | |
| 73 | - adapter = new RaceNameListAdapter(list,fragment.getActivity()); | |
| 104 | + if (adapter == null) { | |
| 105 | + adapter = new RaceNameListAdapter(list, fragment.getActivity()); | |
| 74 | 106 | fragment.binding.raceRecy.setAdapter(adapter); |
| 75 | 107 | adapter.setOnItemClick(new RaceNameListAdapter.OnItemClick() { |
| 76 | 108 | @Override |
| ... | ... | @@ -81,7 +113,7 @@ public class RaceNameListView implements MvpView { |
| 81 | 113 | adapter.setOnAddShoeLineClick(new RaceNameListAdapter.OnAddShoeLineClick() { |
| 82 | 114 | @Override |
| 83 | 115 | public void onAddSholeLineClickListener(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, int position) { |
| 84 | - if(list.get(position).getIsEnable() == 0)return; | |
| 116 | + if (list.get(position).getIsEnable() == 0) return; | |
| 85 | 117 | SelectDialog selectDialog = new SelectDialog(fragment.getActivity(), "确定绑定该轨迹?", "否", new SelectDialog.DialogInterface() { |
| 86 | 118 | @Override |
| 87 | 119 | public void onClick(SelectDialog dialog) { |
| ... | ... | @@ -91,7 +123,9 @@ public class RaceNameListView implements MvpView { |
| 91 | 123 | @Override |
| 92 | 124 | public void onClick(SelectDialog dialog) { |
| 93 | 125 | dialog.cancel(); |
| 94 | - fragment.addShoeLine(eventShoeLinesBean,position); | |
| 126 | + //查询当前赛事对应的轨迹列表 | |
| 127 | + queryFenceList(eventShoeLinesBean.getEventId()); | |
| 128 | +// fragment.addShoeLine(eventShoeLinesBean, position); | |
| 95 | 129 | } |
| 96 | 130 | }); |
| 97 | 131 | selectDialog.setCancelable(false); |
| ... | ... | @@ -103,17 +137,17 @@ public class RaceNameListView implements MvpView { |
| 103 | 137 | adapter.setOnDelectShoeLineClick(new RaceNameListAdapter.OnDelectShoeLineClick() { |
| 104 | 138 | @Override |
| 105 | 139 | public void onDelectShoeLineClickListener(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, int position) { |
| 106 | - if(list.get(position).getIsEnable() == 0)return; | |
| 140 | + if (list.get(position).getIsEnable() == 0) return; | |
| 107 | 141 | SelectDialog selectDialog = new SelectDialog(fragment.getActivity(), "确定删除该轨迹?", "否", new SelectDialog.DialogInterface() { |
| 108 | 142 | @Override |
| 109 | 143 | public void onClick(SelectDialog dialog) { |
| 110 | - dialog.cancel(); | |
| 144 | + dialog.cancel(); | |
| 111 | 145 | } |
| 112 | 146 | }, "是", new SelectDialog.DialogInterface() { |
| 113 | 147 | @Override |
| 114 | 148 | public void onClick(SelectDialog dialog) { |
| 115 | 149 | dialog.cancel(); |
| 116 | - fragment.delectShoeLine(eventShoeLinesBean,position); | |
| 150 | + fragment.delectShoeLine(eventShoeLinesBean, position); | |
| 117 | 151 | } |
| 118 | 152 | }); |
| 119 | 153 | selectDialog.setCancelable(false); |
| ... | ... | @@ -121,24 +155,24 @@ public class RaceNameListView implements MvpView { |
| 121 | 155 | selectDialog.show(); |
| 122 | 156 | } |
| 123 | 157 | }); |
| 124 | - }else { | |
| 158 | + } else { | |
| 125 | 159 | adapter.notifyDataSetChanged(); |
| 126 | 160 | } |
| 127 | 161 | } |
| 128 | 162 | |
| 129 | - if(list.size() != 0){ | |
| 163 | + if (list.size() != 0) { | |
| 130 | 164 | fragment.binding.empty.setVisibility(View.GONE); |
| 131 | 165 | fragment.binding.refreshLayout.setVisibility(View.VISIBLE); |
| 132 | - }else { | |
| 166 | + } else { | |
| 133 | 167 | showEmpty(); |
| 134 | 168 | } |
| 135 | 169 | |
| 136 | - if(raceNameListInfoBaseInfo.getData().getEventShoeLines().size() < fragment.pageSize){ | |
| 170 | + if (raceNameListInfoBaseInfo.getData().getEventShoeLines().size() < fragment.pageSize) { | |
| 137 | 171 | fragment.binding.refreshLayout.setEnableLoadMore(false); |
| 138 | - }else { | |
| 172 | + } else { | |
| 139 | 173 | fragment.binding.refreshLayout.setEnableLoadMore(true); |
| 140 | 174 | } |
| 141 | - if(fragment.currentPage > 1){ | |
| 175 | + if (fragment.currentPage > 1) { | |
| 142 | 176 | list.addAll(raceNameListInfoBaseInfo.getData().getEventShoeLines()); |
| 143 | 177 | adapter.notifyDataSetChanged(); |
| 144 | 178 | } |
| ... | ... | @@ -146,7 +180,7 @@ public class RaceNameListView implements MvpView { |
| 146 | 180 | fragment.binding.refreshLayout.finishLoadMore(); |
| 147 | 181 | } |
| 148 | 182 | |
| 149 | - public void showErr(String msg){ | |
| 183 | + public void showErr(String msg) { | |
| 150 | 184 | fragment.binding.refreshLayout.finishRefresh(); |
| 151 | 185 | fragment.binding.refreshLayout.finishLoadMore(); |
| 152 | 186 | if (list.size() == 0) { |
| ... | ... | @@ -158,7 +192,7 @@ public class RaceNameListView implements MvpView { |
| 158 | 192 | @Override |
| 159 | 193 | public void onClick(View v) { |
| 160 | 194 | fragment.currentPage = 1; |
| 161 | - fragment.getPresenter().setData(fragment.getActivity(), CommonInfo.getUserId(fragment.getActivity()),fragment.currentPage,fragment.pageSize); | |
| 195 | + fragment.getPresenter().setData(fragment.getActivity(), CommonInfo.getUserId(fragment.getActivity()), fragment.currentPage, fragment.pageSize); | |
| 162 | 196 | } |
| 163 | 197 | }); |
| 164 | 198 | fragment.binding.empty.setLoadingShowing(false); |
| ... | ... | @@ -174,7 +208,7 @@ public class RaceNameListView implements MvpView { |
| 174 | 208 | AlertUtil.showDeftToast(fragment.getActivity(), message); |
| 175 | 209 | } |
| 176 | 210 | |
| 177 | - public void showEmpty(){ | |
| 211 | + public void showEmpty() { | |
| 178 | 212 | fragment.binding.empty.setVisibility(View.VISIBLE); |
| 179 | 213 | fragment.binding.refreshLayout.setVisibility(View.GONE); |
| 180 | 214 | fragment.binding.empty.show("没有相关数据", "", R.drawable.zhuangtai_kong); |
| ... | ... | @@ -188,4 +222,74 @@ public class RaceNameListView implements MvpView { |
| 188 | 222 | public void hideLoading() { |
| 189 | 223 | if (loadingDiaog != null) loadingDiaog.dismiss(); |
| 190 | 224 | } |
| 225 | + | |
| 226 | + | |
| 227 | + /** | |
| 228 | + * 查询地理围栏 | |
| 229 | + */ | |
| 230 | + private void queryFenceList(String eventId) { | |
| 231 | + FenceListRequest fenceListRequest = FenceListRequest.buildServerRequest(Constant.TAG, Constant.SERVICE_ID, eventId, null, CoordType.gcj02, 1, 5000); | |
| 232 | + if (null != mClient || null != fenceListRequest) { | |
| 233 | + mClient.queryFenceList(fenceListRequest, RaceNameListView.this); | |
| 234 | + } | |
| 235 | + } | |
| 236 | + | |
| 237 | + @Override | |
| 238 | + public void onCreateFenceCallback(CreateFenceResponse createFenceResponse) { | |
| 239 | + | |
| 240 | + } | |
| 241 | + | |
| 242 | + @Override | |
| 243 | + public void onUpdateFenceCallback(UpdateFenceResponse updateFenceResponse) { | |
| 244 | + | |
| 245 | + } | |
| 246 | + | |
| 247 | + @Override | |
| 248 | + public void onDeleteFenceCallback(DeleteFenceResponse deleteFenceResponse) { | |
| 249 | + | |
| 250 | + } | |
| 251 | + | |
| 252 | + /** | |
| 253 | + * 查询围栏列表回调接口 | |
| 254 | + * | |
| 255 | + * @param fenceListResponse | |
| 256 | + */ | |
| 257 | + @Override | |
| 258 | + public void onFenceListCallback(FenceListResponse fenceListResponse) { | |
| 259 | + if (null == fenceListResponse) { | |
| 260 | + return; | |
| 261 | + } | |
| 262 | + Log.e(TAG, "onFenceListCallback:围栏数量 " + fenceListResponse.getFenceInfos().size() + ",fenceListResponse:" + fenceListResponse.getTotalSize()); | |
| 263 | + | |
| 264 | + } | |
| 265 | + | |
| 266 | + @Override | |
| 267 | + public void onMonitoredStatusCallback(MonitoredStatusResponse monitoredStatusResponse) { | |
| 268 | + | |
| 269 | + } | |
| 270 | + | |
| 271 | + @Override | |
| 272 | + public void onMonitoredStatusByLocationCallback(MonitoredStatusByLocationResponse monitoredStatusByLocationResponse) { | |
| 273 | + | |
| 274 | + } | |
| 275 | + | |
| 276 | + @Override | |
| 277 | + public void onHistoryAlarmCallback(HistoryAlarmResponse historyAlarmResponse) { | |
| 278 | + | |
| 279 | + } | |
| 280 | + | |
| 281 | + @Override | |
| 282 | + public void onAddMonitoredPersonCallback(AddMonitoredPersonResponse addMonitoredPersonResponse) { | |
| 283 | + | |
| 284 | + } | |
| 285 | + | |
| 286 | + @Override | |
| 287 | + public void onDeleteMonitoredPersonCallback(DeleteMonitoredPersonResponse deleteMonitoredPersonResponse) { | |
| 288 | + | |
| 289 | + } | |
| 290 | + | |
| 291 | + @Override | |
| 292 | + public void onListMonitoredPersonCallback(ListMonitoredPersonResponse listMonitoredPersonResponse) { | |
| 293 | + | |
| 294 | + } | |
| 191 | 295 | } | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/StartTraceFragmentView.java
| ... | ... | @@ -155,6 +155,7 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { |
| 155 | 155 | dialog.dismiss(); |
| 156 | 156 | //检查百度是否正在运行 |
| 157 | 157 | checkBaiduServiceState(); |
| 158 | + | |
| 158 | 159 | } |
| 159 | 160 | }); |
| 160 | 161 | selectDialog.setCancelable(false); |
| ... | ... | @@ -194,8 +195,8 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { |
| 194 | 195 | * 启动计步服务 |
| 195 | 196 | */ |
| 196 | 197 | public void startStepService(Context context) { |
| 197 | - CollCommonInfo.setIsFirstStepSendTraceTip(getContext(), true); | |
| 198 | - QMUITipDialogUtil.loadingDialog(getContext(), "请稍后", false); | |
| 198 | + CollCommonInfo.setIsFirstStepSendTraceTip(context, true); | |
| 199 | + QMUITipDialogUtil.loadingDialog(context, "请稍后", false); | |
| 199 | 200 | if (CollCommonInfo.getStepStartTime(context) == 0) { |
| 200 | 201 | CollCommonInfo.setStepStartTime(context, TimeUtil.getNowTimeStamp()); |
| 201 | 202 | } |
| ... | ... | @@ -218,9 +219,11 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { |
| 218 | 219 | startStepService(getContext()); |
| 219 | 220 | } else { |
| 220 | 221 | CollRunningMapActivity.startActivity(fragment.getActivity(), runRaceDetailInfo); |
| 222 | + fragment.getActivity().finish(); | |
| 221 | 223 | } |
| 222 | 224 | } else { |
| 223 | 225 | CollRunningMapActivity.startActivity(fragment.getActivity(), runRaceDetailInfo); |
| 226 | + fragment.getActivity().finish(); | |
| 224 | 227 | } |
| 225 | 228 | } |
| 226 | 229 | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/model/RaceNameListInfo.java
| 1 | 1 | package com.cnlive.moudle.collectionTrace.model; |
| 2 | 2 | |
| 3 | +import java.io.Serializable; | |
| 3 | 4 | import java.util.List; |
| 4 | 5 | |
| 5 | 6 | /** |
| 6 | 7 | * Created by hanyayun 019/06/25. |
| 7 | 8 | */ |
| 8 | -public class RaceNameListInfo { | |
| 9 | +public class RaceNameListInfo implements Serializable { | |
| 9 | 10 | |
| 10 | 11 | /** |
| 11 | 12 | * eventShoeLines : [{"createTime":1560498861000,"darenId":"daren_10513196","endLocation":"首都师范大学操场西门","eventId":"116","id":120,"isEnable":0,"latLongitude":"[{\"latitude\":39.933942415657,\"latitudeE6\":3.9933942415657E7,\"longitude\":116.30897883196,\"longitudeE6\":1.1630897883196001E8},{\"latitude\":39.933967093082,\"latitudeE6\":3.9933967093082E7,\"longitude\":116.30890884739,\"longitudeE6\":1.1630890884739E8},{\"latitude\":39.93396191311,\"latitudeE6\":3.9933961913109995E7,\"longitude\":116.30868153328,\"longitudeE6\":1.1630868153328E8},{\"latitude\":39.934018604395,\"latitudeE6\":3.9934018604395E7,\"longitude\":116.30864816843,\"longitudeE6\":1.1630864816843E8},{\"latitude\":39.934091845914,\"latitudeE6\":3.9934091845914E7,\"longitude\":116.30864003053,\"longitudeE6\":1.1630864003053E8},{\"latitude\":39.934360142831,\"latitudeE6\":3.9934360142831E7,\"longitude\":116.30875016067,\"longitudeE6\":1.1630875016067E8},{\"latitude\":39.934744000269,\"latitudeE6\":3.9934744000268996E7,\"longitude\":116.30886056182,\"longitudeE6\":1.1630886056182E8},{\"latitude\":39.934760553353,\"latitudeE6\":3.9934760553353004E7,\"longitude\":116.30891047327,\"longitudeE6\":1.1630891047327E8},{\"latitude\":39.934696015943,\"latitudeE6\":3.9934696015943E7,\"longitude\":116.30912422473,\"longitudeE6\":1.1630912422473E8},{\"latitude\":39.934698216461,\"latitudeE6\":3.9934698216461E7,\"longitude\":116.30938815875,\"longitudeE6\":1.1630938815875E8},{\"latitude\":39.934731879794,\"latitudeE6\":3.9934731879794E7,\"longitude\":116.30961357404,\"longitudeE6\":1.1630961357404E8},{\"latitude\":39.934696892741,\"latitudeE6\":3.9934696892741E7,\"longitude\":116.30967053826,\"longitudeE6\":1.1630967053826E8},{\"latitude\":39.934370279617,\"latitudeE6\":3.9934370279617E7,\"longitude\":116.30962008478,\"longitudeE6\":1.1630962008478E8},{\"latitude\":39.934132111504,\"latitudeE6\":3.9934132111503996E7,\"longitude\":116.309668369,\"longitudeE6\":1.1630966836899999E8},{\"latitude\":39.933978571682,\"latitudeE6\":3.9933978571682E7,\"longitude\":116.30965182248,\"longitudeE6\":1.1630965182248001E8},{\"latitude\":39.933964707162,\"latitudeE6\":3.9933964707162E7,\"longitude\":116.3093930426,\"longitudeE6\":1.1630939304259999E8},{\"latitude\":39.933996146467,\"latitudeE6\":3.9933996146467E7,\"longitude\":116.30915080933,\"longitudeE6\":1.1630915080933E8}]","mileage":"5","roadmap":"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1560748589378&di=bb8468bcde8fbebe49e62c49e1a4312c&imgtype=0&src=http%3A%2F%2F05imgmini.eastday.com%2Fmobile%2F20190309%2F20190309100119_57a582d9807694bc008c102f91d01d13_3.jpeg","startLocation":"首都师范大学操场东门","updateTime":1560498861000}] |
| ... | ... | @@ -31,7 +32,7 @@ public class RaceNameListInfo { |
| 31 | 32 | this.eventShoeLines = eventShoeLines; |
| 32 | 33 | } |
| 33 | 34 | |
| 34 | - public static class EventShoeLinesBean { | |
| 35 | + public static class EventShoeLinesBean implements Serializable { | |
| 35 | 36 | /** |
| 36 | 37 | * createTime : 1560498861000 |
| 37 | 38 | * darenId : daren_10513196 | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/CollTraceListDetailActivity.java
0 → 100644
| 1 | +package com.cnlive.moudle.collectionTrace.ui.activity; | |
| 2 | + | |
| 3 | +import android.os.Bundle; | |
| 4 | + | |
| 5 | +import com.cnlive.libs.base.ui.QMUIFragmentActivity; | |
| 6 | +import com.cnlive.moudle.collectionTrace.model.RaceNameListInfo; | |
| 7 | +import com.example.moudle_pedometer.R; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * 轨迹列表详情页 | |
| 11 | + * | |
| 12 | + * @author ShinnyYang | |
| 13 | + */ | |
| 14 | +public class CollTraceListDetailActivity extends QMUIFragmentActivity { | |
| 15 | + private RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean; | |
| 16 | + | |
| 17 | + @Override | |
| 18 | + protected int getContextViewId() { | |
| 19 | + return R.id.fragment_coll_trace_list_detail; | |
| 20 | + } | |
| 21 | + | |
| 22 | + @Override | |
| 23 | + protected void onCreate(Bundle savedInstanceState) { | |
| 24 | + super.onCreate(savedInstanceState); | |
| 25 | + eventShoeLinesBean = (RaceNameListInfo.EventShoeLinesBean) getIntent().getExtras().get("eventShoeLinesBean"); | |
| 26 | + } | |
| 27 | +} | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/RaceNameListActivity.java
| ... | ... | @@ -8,6 +8,7 @@ import android.os.Bundle; |
| 8 | 8 | import com.cnlive.libs.base.util.StatusBarUtil; |
| 9 | 9 | import com.cnlive.libs.base.util.StatusBarUtil2; |
| 10 | 10 | import com.cnlive.moudle.collectionTrace.ui.fragment.RaceNameListFragment; |
| 11 | +import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; | |
| 11 | 12 | import com.example.moudle_pedometer.R; |
| 12 | 13 | |
| 13 | 14 | |
| ... | ... | @@ -17,9 +18,10 @@ import com.example.moudle_pedometer.R; |
| 17 | 18 | */ |
| 18 | 19 | public class RaceNameListActivity extends AppCompatActivity { |
| 19 | 20 | |
| 20 | - public static void newInstance(Context context,String eventId){ | |
| 21 | - Intent intent = new Intent(context,RaceNameListActivity.class); | |
| 22 | - intent.putExtra("eventId",eventId); | |
| 21 | + public static void newInstance(Context context, String eventId, RunRaceDetailInfo runRaceDetailInfo) { | |
| 22 | + Intent intent = new Intent(context, RaceNameListActivity.class); | |
| 23 | + intent.putExtra("eventId", eventId); | |
| 24 | + intent.putExtra("runRaceDetailInfo", runRaceDetailInfo); | |
| 23 | 25 | context.startActivity(intent); |
| 24 | 26 | } |
| 25 | 27 | |
| ... | ... | @@ -29,6 +31,9 @@ public class RaceNameListActivity extends AppCompatActivity { |
| 29 | 31 | StatusBarUtil.setStatusBarWrite(this); |
| 30 | 32 | StatusBarUtil2.setColor(this, getResources().getColor(R.color.white), 0); |
| 31 | 33 | setContentView(R.layout.activity_race_name_list); |
| 32 | - getSupportFragmentManager().beginTransaction().replace(R.id.race_container,RaceNameListFragment.newInstance(getIntent().getStringExtra("eventId"))).commit(); | |
| 34 | + RunRaceDetailInfo runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().getSerializable("runRaceDetailInfo"); | |
| 35 | + if (null != runRaceDetailInfo) { | |
| 36 | + getSupportFragmentManager().beginTransaction().replace(R.id.race_container, RaceNameListFragment.newInstance(getIntent().getStringExtra("eventId"), runRaceDetailInfo)).commit(); | |
| 37 | + } | |
| 33 | 38 | } |
| 34 | 39 | } | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/StartCollectTraceActivity.java
| ... | ... | @@ -26,9 +26,10 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity { |
| 26 | 26 | private PermissionsUtils mPermissionsUtils;//权限申请 |
| 27 | 27 | private RunRaceDetailInfo runRaceDetailInfo; |
| 28 | 28 | |
| 29 | - public static void newInstance(Context context, String eventId) { | |
| 29 | + public static void newInstance(Context context, String eventId,RunRaceDetailInfo runRaceDetailInfo) { | |
| 30 | 30 | Intent intent = new Intent(context, StartCollectTraceActivity.class); |
| 31 | 31 | intent.putExtra("eventId", eventId); |
| 32 | + intent.putExtra("runRaceDetailInfo", runRaceDetailInfo); | |
| 32 | 33 | context.startActivity(intent); |
| 33 | 34 | } |
| 34 | 35 | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/adapter/RunListAdapter.java
| ... | ... | @@ -13,6 +13,7 @@ import com.cnlive.moudle.collectionTrace.ui.activity.CollRunRaceDetailActivity; |
| 13 | 13 | import com.cnlive.moudle.collectionTrace.ui.activity.RaceNameListActivity; |
| 14 | 14 | import com.cnlive.moudle.collectionTrace.ui.activity.StartCollectTraceActivity; |
| 15 | 15 | import com.cnlive.moudle.pedometer.net.bean.RunLineInfo; |
| 16 | +import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; | |
| 16 | 17 | import com.cnlive.moudle.pedometer.utils.TimeUtil; |
| 17 | 18 | import com.example.moudle_pedometer.R; |
| 18 | 19 | |
| ... | ... | @@ -45,9 +46,25 @@ public class RunListAdapter extends RecyclerView.Adapter<RunListAdapter.MyViewHo |
| 45 | 46 | myViewHolder.activity_time.setText(TimeUtil.getStampToTime(list.get(i).getStart_time(), "yyyy.MM.dd") + "——" + TimeUtil.getStampToTime(list.get(i).getEnd_time(), "yyyy.MM.dd")); |
| 46 | 47 | myViewHolder.line_address.setText(list.get(i).getAddress() + " " + list.get(i).getMileage()); |
| 47 | 48 | //添加轨迹 |
| 48 | - myViewHolder.add_path.setOnClickListener(v -> StartCollectTraceActivity.newInstance(context,list.get(i).getId()+"")); | |
| 49 | - myViewHolder.path_list.setOnClickListener(v -> RaceNameListActivity.newInstance(context,list.get(i).getId()+"")); | |
| 50 | - myViewHolder.item_ly.setOnClickListener(v -> CollRunRaceDetailActivity.newInstance(context,list.get(i).getId()+"")); | |
| 49 | + myViewHolder.add_path.setOnClickListener(new View.OnClickListener() { | |
| 50 | + @Override | |
| 51 | + public void onClick(View view) { | |
| 52 | + RunRaceDetailInfo runRaceDetailInfo = new RunRaceDetailInfo(); | |
| 53 | + runRaceDetailInfo.setTitle(list.get(i).getTitle()); | |
| 54 | + StartCollectTraceActivity.newInstance(context, list.get(i).getId() + "", runRaceDetailInfo); | |
| 55 | + } | |
| 56 | + }); | |
| 57 | + myViewHolder.path_list.setOnClickListener(new View.OnClickListener() { | |
| 58 | + @Override | |
| 59 | + public void onClick(View view) { | |
| 60 | + RunRaceDetailInfo runRaceDetailInfo = new RunRaceDetailInfo(); | |
| 61 | + runRaceDetailInfo.setTitle(list.get(i).getTitle()); | |
| 62 | + RaceNameListActivity.newInstance(context, list.get(i).getId() + "",runRaceDetailInfo); | |
| 63 | + | |
| 64 | + } | |
| 65 | + }); | |
| 66 | + | |
| 67 | + myViewHolder.item_ly.setOnClickListener(v -> CollRunRaceDetailActivity.newInstance(context, list.get(i).getId() + "")); | |
| 51 | 68 | } |
| 52 | 69 | |
| 53 | 70 | @Override |
| ... | ... | @@ -55,7 +72,7 @@ public class RunListAdapter extends RecyclerView.Adapter<RunListAdapter.MyViewHo |
| 55 | 72 | return list.size(); |
| 56 | 73 | } |
| 57 | 74 | |
| 58 | - class MyViewHolder extends RecyclerView.ViewHolder{ | |
| 75 | + class MyViewHolder extends RecyclerView.ViewHolder { | |
| 59 | 76 | |
| 60 | 77 | TextView line_name; |
| 61 | 78 | TextView activity_time; | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/fragment/CollRunRaceDetailFragment.java
| ... | ... | @@ -61,8 +61,13 @@ public class CollRunRaceDetailFragment extends QMUIFragment<CollRunRaceDetailFra |
| 61 | 61 | addTraceBtn.setOnClickListener(new View.OnClickListener() { |
| 62 | 62 | @Override |
| 63 | 63 | public void onClick(View view) { |
| 64 | - //todo 自己测试用 | |
| 65 | - RaceNameListActivity.newInstance(getActivity(), CollCommonInfo.getStreetId(getActivity())); | |
| 64 | + if (null != getMvpView()) { | |
| 65 | + if (null != getMvpView().runRaceDetailInfo) { | |
| 66 | + RaceNameListActivity.newInstance(getActivity(), CollCommonInfo.getStreetId(getActivity()), getMvpView().runRaceDetailInfo); | |
| 67 | + } else { | |
| 68 | + QMUITipDialogUtil.failedDialog(getActivity(), "正在获取数据,请稍后", 1); | |
| 69 | + } | |
| 70 | + } | |
| 66 | 71 | } |
| 67 | 72 | }); |
| 68 | 73 | } |
| ... | ... | @@ -75,7 +80,9 @@ public class CollRunRaceDetailFragment extends QMUIFragment<CollRunRaceDetailFra |
| 75 | 80 | getMvpView().initMap(); |
| 76 | 81 | } |
| 77 | 82 | if (getPresenter() != null) { |
| 78 | - getPresenter().getRunRaceDetailInfo(getActivity(), "116", CommonInfo.getUserId(getActivity()), "1"); | |
| 83 | +// getPresenter().getRunRaceDetailInfo(getActivity(), "116", CommonInfo.getUserId(getActivity()), "1"); | |
| 84 | + getPresenter().getRunRaceDetailInfo(getActivity(), CollCommonInfo.getStreetId(getActivity()), CommonInfo.getUserId(getActivity()), "1"); | |
| 85 | + | |
| 79 | 86 | } |
| 80 | 87 | |
| 81 | 88 | } | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/fragment/CollTraceListDetailFragment.java
0 → 100644
| 1 | +package com.cnlive.moudle.collectionTrace.ui.fragment; | |
| 2 | + | |
| 3 | +import android.os.Bundle; | |
| 4 | +import android.support.annotation.Nullable; | |
| 5 | +import android.view.View; | |
| 6 | + | |
| 7 | +import com.cnlive.libs.base.ui.QMUIFragment; | |
| 8 | +import com.cnlive.moudle.collectionTrace.frame.presenter.CollTraceListDetailFragmentPresenter; | |
| 9 | +import com.cnlive.moudle.collectionTrace.frame.view.CollTraceListDetailFragmentView; | |
| 10 | +import com.cnlive.moudle.collectionTrace.model.RaceNameListInfo; | |
| 11 | +import com.example.moudle_pedometer.R; | |
| 12 | +import com.example.moudle_pedometer.databinding.FragmentCollFinishRunMapBinding; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * 轨迹列表详情页 | |
| 16 | + * | |
| 17 | + * @author ShinnyYang | |
| 18 | + */ | |
| 19 | +public class CollTraceListDetailFragment extends QMUIFragment<CollTraceListDetailFragmentView, CollTraceListDetailFragmentPresenter, FragmentCollFinishRunMapBinding> { | |
| 20 | + private RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean; | |
| 21 | + | |
| 22 | + public static CollTraceListDetailFragment newInstance(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean) { | |
| 23 | + CollTraceListDetailFragment fragment = new CollTraceListDetailFragment(); | |
| 24 | + Bundle bundle = new Bundle(); | |
| 25 | + bundle.putSerializable("eventShoeLinesBean", eventShoeLinesBean); | |
| 26 | + fragment.setArguments(bundle); | |
| 27 | + return fragment; | |
| 28 | + } | |
| 29 | + | |
| 30 | + @Override | |
| 31 | + protected int getToolbarId() { | |
| 32 | + return 0; | |
| 33 | + } | |
| 34 | + | |
| 35 | + @Override | |
| 36 | + public String getTitle() { | |
| 37 | + return null; | |
| 38 | + } | |
| 39 | + | |
| 40 | + @Override | |
| 41 | + protected int getLayoutId() { | |
| 42 | + return R.layout.fragment_coll_finish_run_map; | |
| 43 | + } | |
| 44 | + | |
| 45 | + @Override | |
| 46 | + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | |
| 47 | + super.onViewCreated(view, savedInstanceState); | |
| 48 | + if (null != getArguments()) { | |
| 49 | + eventShoeLinesBean = (RaceNameListInfo.EventShoeLinesBean) getArguments().get("eventShoeLinesBean"); | |
| 50 | + if (null != eventShoeLinesBean) { | |
| 51 | + | |
| 52 | + } | |
| 53 | + } | |
| 54 | + } | |
| 55 | +} | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/fragment/RaceNameListFragment.java
| ... | ... | @@ -9,25 +9,29 @@ import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; |
| 9 | 9 | import com.cnlive.moudle.collectionTrace.frame.presenter.RaceNameListPresenter; |
| 10 | 10 | import com.cnlive.moudle.collectionTrace.frame.view.RaceNameListView; |
| 11 | 11 | import com.cnlive.moudle.collectionTrace.model.RaceNameListInfo; |
| 12 | +import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; | |
| 12 | 13 | import com.example.moudle_pedometer.R; |
| 13 | 14 | import com.example.moudle_pedometer.databinding.FragmentRaceNameListBinding; |
| 14 | 15 | |
| 15 | 16 | /** |
| 16 | 17 | * Created by hanyayun 019/06/25. |
| 17 | 18 | */ |
| 18 | -public class RaceNameListFragment extends MvpBindingFragment<RaceNameListView, RaceNameListPresenter,Object, FragmentRaceNameListBinding> { | |
| 19 | +public class RaceNameListFragment extends MvpBindingFragment<RaceNameListView, RaceNameListPresenter, Object, FragmentRaceNameListBinding> { | |
| 19 | 20 | |
| 20 | 21 | public int currentPage = 1; |
| 21 | 22 | public int pageSize = 10; |
| 22 | 23 | public String eventId; |
| 24 | + private RunRaceDetailInfo runRaceDetailInfo; | |
| 23 | 25 | |
| 24 | - public static RaceNameListFragment newInstance(String eventId){ | |
| 26 | + public static RaceNameListFragment newInstance(String eventId, RunRaceDetailInfo runRaceDetailInfo) { | |
| 25 | 27 | RaceNameListFragment fragment = new RaceNameListFragment(); |
| 26 | 28 | Bundle bundle = new Bundle(); |
| 27 | - bundle.putString("eventId",eventId); | |
| 29 | + bundle.putString("eventId", eventId); | |
| 30 | + bundle.putSerializable("runRaceDetailInfo", runRaceDetailInfo); | |
| 28 | 31 | fragment.setArguments(bundle); |
| 29 | 32 | return fragment; |
| 30 | 33 | } |
| 34 | + | |
| 31 | 35 | public RaceNameListFragment() { |
| 32 | 36 | // Required empty public constructor |
| 33 | 37 | } |
| ... | ... | @@ -36,16 +40,25 @@ public class RaceNameListFragment extends MvpBindingFragment<RaceNameListView, R |
| 36 | 40 | @Override |
| 37 | 41 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 38 | 42 | super.onViewCreated(view, savedInstanceState); |
| 39 | - if(getMvpView() != null) getMvpView().initView(); | |
| 40 | - eventId = getArguments().getString("eventId"); | |
| 41 | - getPresenter().setData(getActivity(),eventId,currentPage,pageSize); | |
| 42 | - binding.refreshLayout.setOnRefreshListener(v ->{ | |
| 43 | + | |
| 44 | + if (null != getArguments()) { | |
| 45 | + eventId = getArguments().getString("eventId"); | |
| 46 | + runRaceDetailInfo = (RunRaceDetailInfo) getArguments().getSerializable("runRaceDetailInfo"); | |
| 47 | + if (null != runRaceDetailInfo) { | |
| 48 | + if (getMvpView() != null) { | |
| 49 | + getMvpView().initView(runRaceDetailInfo); | |
| 50 | + } | |
| 51 | + } | |
| 52 | + | |
| 53 | + } | |
| 54 | + getPresenter().setData(getActivity(), eventId, currentPage, pageSize); | |
| 55 | + binding.refreshLayout.setOnRefreshListener(v -> { | |
| 43 | 56 | currentPage = 1; |
| 44 | - getPresenter().setData(getActivity(),eventId,currentPage,pageSize); | |
| 57 | + getPresenter().setData(getActivity(), eventId, currentPage, pageSize); | |
| 45 | 58 | }); |
| 46 | - binding.refreshLayout.setOnLoadMoreListener(v ->{ | |
| 59 | + binding.refreshLayout.setOnLoadMoreListener(v -> { | |
| 47 | 60 | currentPage++; |
| 48 | - getPresenter().setData(getActivity(),eventId,currentPage,pageSize); | |
| 61 | + getPresenter().setData(getActivity(), eventId, currentPage, pageSize); | |
| 49 | 62 | }); |
| 50 | 63 | } |
| 51 | 64 | |
| ... | ... | @@ -55,11 +68,11 @@ public class RaceNameListFragment extends MvpBindingFragment<RaceNameListView, R |
| 55 | 68 | } |
| 56 | 69 | |
| 57 | 70 | |
| 58 | - public void addShoeLine(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean,int position){ | |
| 59 | - getPresenter().bindingShoeLine(getActivity(),eventShoeLinesBean.getId(),eventShoeLinesBean.getEventId(),position); | |
| 71 | + public void addShoeLine(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, int position) { | |
| 72 | + getPresenter().bindingShoeLine(getActivity(), eventShoeLinesBean.getId(), eventShoeLinesBean.getEventId(), position); | |
| 60 | 73 | } |
| 61 | 74 | |
| 62 | - public void delectShoeLine(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean,int position){ | |
| 63 | - getPresenter().delectShoeLine(getActivity(),eventShoeLinesBean.getId(),position); | |
| 75 | + public void delectShoeLine(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, int position) { | |
| 76 | + getPresenter().delectShoeLine(getActivity(), eventShoeLinesBean.getId(), position); | |
| 64 | 77 | } |
| 65 | 78 | } | ... | ... |
moudle_pedometer/src/main/res/values/ids.xml