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