Commit 6c66014a902260abb9bc9eced3d530e568e0dca5
1 parent
ecf90819
1 优化打点功能逻辑
Showing
3 changed files
with
25 additions
and
13 deletions
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollRunningMapFragmentView.java
| ... | ... | @@ -347,6 +347,9 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener |
| 347 | 347 | } |
| 348 | 348 | //更新可打点数量 |
| 349 | 349 | updataCanTakePointCount(); |
| 350 | + //重置相关信息 | |
| 351 | + followMyLocation = null; | |
| 352 | + currentAddress = null; | |
| 350 | 353 | } |
| 351 | 354 | }); |
| 352 | 355 | selectDialog.setCancelable(false); |
| ... | ... | @@ -510,6 +513,8 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener |
| 510 | 513 | option.setIsNeedAddress(true); |
| 511 | 514 | //可选,设置是否需要地址描述 |
| 512 | 515 | option.setIsNeedLocationDescribe(true); |
| 516 | + //需要POI信息 | |
| 517 | + option.setIsNeedLocationPoiList(true); | |
| 513 | 518 | //可选,设置是否需要设备方向结果 |
| 514 | 519 | option.setNeedDeviceDirect(false); |
| 515 | 520 | //设置打开自动回调位置模式,该开关打开后,期间只要定位SDK检测到位置变化就会主动回调给开发者 |
| ... | ... | @@ -610,8 +615,9 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener |
| 610 | 615 | currentLine = MyMapUtil.drawMapLine(getContext(), baiduMap, currentWalkPoints, R.color.green_round); |
| 611 | 616 | } |
| 612 | 617 | } |
| 613 | - Log.e(TAG, "onReceiveLocation: 运行"); | |
| 614 | - currentAddress = location.getLocationDescribe(); | |
| 618 | + if (null != location.getPoiList() && null != location.getPoiList().get(0)) { | |
| 619 | + currentAddress = location.getPoiList().get(0).getName(); | |
| 620 | + } | |
| 615 | 621 | if (TextUtils.isEmpty(currentAddress)) { |
| 616 | 622 | if (null != location.getAddress()) { |
| 617 | 623 | currentAddress = location.getAddress().address; | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/StartTraceFragmentView.java
| ... | ... | @@ -52,6 +52,7 @@ import com.example.moudle_pedometer.R; |
| 52 | 52 | import com.hannesdorfmann.mosby3.mvp.MvpView; |
| 53 | 53 | |
| 54 | 54 | public class StartTraceFragmentView implements MvpView, SensorEventListener { |
| 55 | + private final String TAG = "StartTraceFragmentView"; | |
| 55 | 56 | private StartTraceFragment fragment; |
| 56 | 57 | private BaiduMap baiduMap; |
| 57 | 58 | private MapView mMapView; |
| ... | ... | @@ -119,15 +120,15 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { |
| 119 | 120 | // if (!NetUtil.isNetworkConnected(getContext())) { |
| 120 | 121 | // AlertUtil.showDeftToast(getContext(), "无法连接网络,请稍后重试"); |
| 121 | 122 | // } else { |
| 122 | - //获取当前地点 | |
| 123 | - if (!TextUtils.isEmpty(currentAddress)) { | |
| 124 | - selectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设置开始地点?"); | |
| 125 | - selectDialog.show(); | |
| 126 | - } else { | |
| 127 | - isShowFollowAddress = true; | |
| 128 | - Toast.makeText(getContext(), "正在获取当前地点信息,请稍后", Toast.LENGTH_SHORT).show(); | |
| 129 | - } | |
| 123 | + //获取当前地点 | |
| 124 | + if (!TextUtils.isEmpty(currentAddress)) { | |
| 125 | + selectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设置开始地点?"); | |
| 126 | + selectDialog.show(); | |
| 127 | + } else { | |
| 128 | + isShowFollowAddress = true; | |
| 129 | + Toast.makeText(getContext(), "正在获取当前地点信息,请稍后", Toast.LENGTH_SHORT).show(); | |
| 130 | 130 | } |
| 131 | + } | |
| 131 | 132 | // } |
| 132 | 133 | }); |
| 133 | 134 | |
| ... | ... | @@ -209,7 +210,7 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { |
| 209 | 210 | //清除数据 |
| 210 | 211 | CollCommonInfo.reset(getContext()); |
| 211 | 212 | dialog.dismiss(); |
| 212 | - Log.e("取消", "onClick: " ); | |
| 213 | + Log.e("取消", "onClick: "); | |
| 213 | 214 | } |
| 214 | 215 | }, "上传", new SelectDialog.DialogInterface() { |
| 215 | 216 | @Override |
| ... | ... | @@ -330,6 +331,8 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { |
| 330 | 331 | option.setIsNeedAddress(true); |
| 331 | 332 | //可选,设置是否需要地址描述 |
| 332 | 333 | option.setIsNeedLocationDescribe(true); |
| 334 | + //需要POI信息 | |
| 335 | + option.setIsNeedLocationPoiList(true); | |
| 333 | 336 | //可选,设置是否需要设备方向结果 |
| 334 | 337 | option.setNeedDeviceDirect(false); |
| 335 | 338 | //设置打开自动回调位置模式,该开关打开后,期间只要定位SDK检测到位置变化就会主动回调给开发者 |
| ... | ... | @@ -418,8 +421,9 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { |
| 418 | 421 | // 此处设置开发者获取到的方向信息,顺时针0-360 |
| 419 | 422 | .direction(location.getDirection()).latitude(location.getLatitude()) |
| 420 | 423 | .longitude(location.getLongitude()).build(); |
| 421 | -// currentAddress = location.getAddrStr(); | |
| 422 | - currentAddress = location.getLocationDescribe(); | |
| 424 | + if (null != location.getPoiList() && null != location.getPoiList().get(0)) { | |
| 425 | + currentAddress = location.getPoiList().get(0).getName(); | |
| 426 | + } | |
| 423 | 427 | if (isShowFollowAddress && selectDialog != null && !selectDialog.isShowing()) { |
| 424 | 428 | if (!TextUtils.isEmpty(currentAddress)) { |
| 425 | 429 | selectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设置开始地点?"); | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/StartCollectTraceActivity.java
| ... | ... | @@ -14,6 +14,7 @@ import com.cnlive.libs.base.ui.QMUIFragment; |
| 14 | 14 | import com.cnlive.libs.base.ui.QMUIFragmentActivity; |
| 15 | 15 | import com.cnlive.libs.base.util.StatusBarUtil; |
| 16 | 16 | import com.cnlive.libs.base.util.StatusBarUtil2; |
| 17 | +import com.cnlive.moudle.collectionTrace.commonInfo.CollCommonInfo; | |
| 17 | 18 | import com.cnlive.moudle.collectionTrace.ui.fragment.StartTraceFragment; |
| 18 | 19 | import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; |
| 19 | 20 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; |
| ... | ... | @@ -27,6 +28,7 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity { |
| 27 | 28 | private RunRaceDetailInfo runRaceDetailInfo; |
| 28 | 29 | |
| 29 | 30 | public static void newInstance(Context context, String eventId,RunRaceDetailInfo runRaceDetailInfo) { |
| 31 | + CollCommonInfo.setStreetId(context, eventId); | |
| 30 | 32 | Intent intent = new Intent(context, StartCollectTraceActivity.class); |
| 31 | 33 | intent.putExtra("eventId", eventId); |
| 32 | 34 | intent.putExtra("runRaceDetailInfo", runRaceDetailInfo); | ... | ... |