Commit 18c99e745c690cbc121c2eb11e8334cdd3de82bf
Merge branch 'master' of bj.gitlab.cnlive.com:cnlive-team/ModulePedometer
Showing
6 changed files
with
76 additions
and
22 deletions
app/build.gradle
| @@ -28,17 +28,23 @@ android { | @@ -28,17 +28,23 @@ android { | ||
| 28 | buildConfigField("String", "APP_ID", stringValue("802_jhbqccxw08")) | 28 | buildConfigField("String", "APP_ID", stringValue("802_jhbqccxw08")) |
| 29 | buildConfigField("String", "APP_KEY", stringValue("9c5619e9be747bb3b925dd215ca5923d86f12c09b9394f")) | 29 | buildConfigField("String", "APP_KEY", stringValue("9c5619e9be747bb3b925dd215ca5923d86f12c09b9394f")) |
| 30 | buildConfigField("String", "APP_SCERET", stringValue("1e6380cb347255e777f72b5aa60f41daa68443a132aaea")) | 30 | buildConfigField("String", "APP_SCERET", stringValue("1e6380cb347255e777f72b5aa60f41daa68443a132aaea")) |
| 31 | + // BAIDU_MAP_APP_KEY : "2IIsTtvX2FA88yvDrPZedc2ZvMhxyDbN" | ||
| 31 | manifestPlaceholders = [ | 32 | manifestPlaceholders = [ |
| 32 | - BAIDU_MAP_APP_KEY : "2IIsTtvX2FA88yvDrPZedc2ZvMhxyDbN" | 33 | + |
| 34 | + BAIDU_MAP_APP_KEY: "OeotXc38bbnU7WmyKGA0VMahk4v35VG2" | ||
| 35 | + | ||
| 36 | + | ||
| 33 | ] | 37 | ] |
| 34 | } | 38 | } |
| 39 | +// BAIDU_MAP_APP_KEY: "Q7y9SGcZVs0tmhbNTiaz0jHm4S1xGzE2" | ||
| 40 | + | ||
| 35 | release { | 41 | release { |
| 36 | resValue("string", "app_name", "网++") | 42 | resValue("string", "app_name", "网++") |
| 37 | buildConfigField("String", "APP_ID", stringValue("769_jetj7bq525")) | 43 | buildConfigField("String", "APP_ID", stringValue("769_jetj7bq525")) |
| 38 | buildConfigField("String", "APP_KEY", stringValue("0d57b045ec0c3988a682d94c644e66b9b8e0d2b8ef937d")) | 44 | buildConfigField("String", "APP_KEY", stringValue("0d57b045ec0c3988a682d94c644e66b9b8e0d2b8ef937d")) |
| 39 | buildConfigField("String", "APP_SCERET", stringValue("275e8dc29274a1186d82f65bc607c231d02bcb3bfd8976")) | 45 | buildConfigField("String", "APP_SCERET", stringValue("275e8dc29274a1186d82f65bc607c231d02bcb3bfd8976")) |
| 40 | manifestPlaceholders = [ | 46 | manifestPlaceholders = [ |
| 41 | - BAIDU_MAP_APP_KEY : "Q7y9SGcZVs0tmhbNTiaz0jHm4S1xGzE2" | 47 | + BAIDU_MAP_APP_KEY: "0bWeo04KKKHqTwozcqgyLZVd0oVhv3rZ" |
| 42 | ] | 48 | ] |
| 43 | } | 49 | } |
| 44 | } | 50 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/RunningMapFragmentPresenter.java
| @@ -19,6 +19,7 @@ import com.baidu.trace.api.track.LatestPointResponse; | @@ -19,6 +19,7 @@ import com.baidu.trace.api.track.LatestPointResponse; | ||
| 19 | import com.baidu.trace.api.track.OnTrackListener; | 19 | import com.baidu.trace.api.track.OnTrackListener; |
| 20 | import com.baidu.trace.api.track.SupplementMode; | 20 | import com.baidu.trace.api.track.SupplementMode; |
| 21 | import com.baidu.trace.api.track.TrackPoint; | 21 | import com.baidu.trace.api.track.TrackPoint; |
| 22 | +import com.baidu.trace.model.CoordType; | ||
| 22 | import com.baidu.trace.model.ProcessOption; | 23 | import com.baidu.trace.model.ProcessOption; |
| 23 | import com.baidu.trace.model.SortType; | 24 | import com.baidu.trace.model.SortType; |
| 24 | import com.baidu.trace.model.StatusCodes; | 25 | import com.baidu.trace.model.StatusCodes; |
| @@ -60,9 +61,10 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | @@ -60,9 +61,10 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | ||
| 60 | * @param endTime | 61 | * @param endTime |
| 61 | */ | 62 | */ |
| 62 | public void queryHistoryTrace(Context context, String entityName, long startTime, long endTime) { | 63 | public void queryHistoryTrace(Context context, String entityName, long startTime, long endTime) { |
| 63 | - Log.e(TAG, "queryHistoryTrace: "); | ||
| 64 | if (historyTrackRequest == null) { | 64 | if (historyTrackRequest == null) { |
| 65 | - historyTrackRequest = new HistoryTrackRequest(); | 65 | + Log.e(TAG, "queryHistoryTrace: StepService.serviceId" + StepService.serviceId + ",entityName:" + entityName); |
| 66 | + Log.e(TAG, "queryHistoryTrace: startTime:" + startTime + ",endTime:" + endTime); | ||
| 67 | + historyTrackRequest = new HistoryTrackRequest(1, StepService.serviceId, entityName); | ||
| 66 | //设置查询设备名称 | 68 | //设置查询设备名称 |
| 67 | historyTrackRequest.setEntityName(entityName); | 69 | historyTrackRequest.setEntityName(entityName); |
| 68 | //历史轨迹开始时间 | 70 | //历史轨迹开始时间 |
| @@ -75,6 +77,8 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | @@ -75,6 +77,8 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | ||
| 75 | historyTrackRequest.setPageSize(pageSize); | 77 | historyTrackRequest.setPageSize(pageSize); |
| 76 | //设置是否进行纠偏 | 78 | //设置是否进行纠偏 |
| 77 | historyTrackRequest.setProcessed(true); | 79 | historyTrackRequest.setProcessed(true); |
| 80 | + //设置返回坐标系 | ||
| 81 | + historyTrackRequest.setCoordTypeOutput(CoordType.gcj02); | ||
| 78 | //其他设置 | 82 | //其他设置 |
| 79 | ProcessOption processOption = new ProcessOption(); | 83 | ProcessOption processOption = new ProcessOption(); |
| 80 | //去噪:可设置是否需要去除角度、速度和方向异常的轨迹点 | 84 | //去噪:可设置是否需要去除角度、速度和方向异常的轨迹点 |
| @@ -84,9 +88,9 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | @@ -84,9 +88,9 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | ||
| 84 | //抽稀:设置是否进行抽稀处理,对冗余的轨迹点进行抽稀去除处理,如一条直线上除起终点外的多个轨迹点 | 88 | //抽稀:设置是否进行抽稀处理,对冗余的轨迹点进行抽稀去除处理,如一条直线上除起终点外的多个轨迹点 |
| 85 | processOption.setNeedVacuate(true); | 89 | processOption.setNeedVacuate(true); |
| 86 | //自动判断交通方式 | 90 | //自动判断交通方式 |
| 87 | - processOption.setTransportMode(TransportMode.auto); | 91 | + processOption.setTransportMode(TransportMode.walking); |
| 88 | // 设置精度过滤值(定位精度大于100米的过滤掉) | 92 | // 设置精度过滤值(定位精度大于100米的过滤掉) |
| 89 | - processOption.setRadiusThreshold(100); | 93 | + processOption.setRadiusThreshold(20); |
| 90 | // 设置纠偏选项 | 94 | // 设置纠偏选项 |
| 91 | historyTrackRequest.setProcessOption(processOption); | 95 | historyTrackRequest.setProcessOption(processOption); |
| 92 | // 设置里程填充方式为驾车 | 96 | // 设置里程填充方式为驾车 |
| @@ -102,7 +106,10 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | @@ -102,7 +106,10 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | ||
| 102 | public void onHistoryTrackCallback(HistoryTrackResponse response) { | 106 | public void onHistoryTrackCallback(HistoryTrackResponse response) { |
| 103 | super.onHistoryTrackCallback(response); | 107 | super.onHistoryTrackCallback(response); |
| 104 | int total = response.getTotal(); | 108 | int total = response.getTotal(); |
| 109 | + Log.e(TAG, "onHistoryTrackCallback: total" + total + "数量"); | ||
| 110 | + | ||
| 105 | if (StatusCodes.SUCCESS != response.getStatus()) { | 111 | if (StatusCodes.SUCCESS != response.getStatus()) { |
| 112 | + Toast.makeText(context, "获取轨迹失败!" + response.getStatus(), Toast.LENGTH_SHORT).show(); | ||
| 106 | } else if (0 == total) { | 113 | } else if (0 == total) { |
| 107 | Toast.makeText(context, "暂未查到您的轨迹,请稍后重试!", Toast.LENGTH_SHORT).show(); | 114 | Toast.makeText(context, "暂未查到您的轨迹,请稍后重试!", Toast.LENGTH_SHORT).show(); |
| 108 | } else { | 115 | } else { |
| @@ -123,7 +130,7 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | @@ -123,7 +130,7 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | ||
| 123 | queryHistoryTrace(context, entityName, startTime, endTime); | 130 | queryHistoryTrace(context, entityName, startTime, endTime); |
| 124 | } else { | 131 | } else { |
| 125 | if (getView() != null) { | 132 | if (getView() != null) { |
| 126 | - MyMapUtil.drawHistoryTrack(context, getView().baiduMap, trackPoints, SortType.asc, R.color.red, R.drawable.icon_start, R.drawable.run_map_icon_end); | 133 | + MyMapUtil.drawHistoryTrack(context, getView().baiduMap, trackPoints, SortType.asc, R.color.red, R.drawable.icon_start, R.drawable.icon_end); |
| 127 | } | 134 | } |
| 128 | } | 135 | } |
| 129 | } | 136 | } |
| @@ -131,15 +138,17 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | @@ -131,15 +138,17 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | ||
| 131 | @Override | 138 | @Override |
| 132 | public void onLatestPointCallback(LatestPointResponse latestPointResponse) { | 139 | public void onLatestPointCallback(LatestPointResponse latestPointResponse) { |
| 133 | super.onLatestPointCallback(latestPointResponse); | 140 | super.onLatestPointCallback(latestPointResponse); |
| 134 | - if (StatusCodes.SUCCESS != latestPointResponse.getStatus()) { | ||
| 135 | - } else { | ||
| 136 | - Bitmap startPointBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), R.drawable.run_map_icon_start), 40, 40); | ||
| 137 | - OverlayOptions startOptions = new MarkerOptions() | ||
| 138 | - .position(MyMapUtil.convertTrace2Map(latestPointResponse.getLatestPoint().getLocation())).icon(BitmapDescriptorFactory.fromBitmap(startPointBitmap)); | ||
| 139 | - if (getView() != null) { | ||
| 140 | - getView().baiduMap.addOverlay(startOptions); | ||
| 141 | - } | ||
| 142 | - } | 141 | + Log.e(TAG, "onLatestPointCallback: "); |
| 142 | + | ||
| 143 | +// if (StatusCodes.SUCCESS != latestPointResponse.getStatus()) { | ||
| 144 | +// } else { | ||
| 145 | +// Bitmap startPointBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), R.drawable.run_map_icon_start), 40, 40); | ||
| 146 | +// OverlayOptions startOptions = new MarkerOptions() | ||
| 147 | +// .position(MyMapUtil.convertTrace2Map(latestPointResponse.getLatestPoint().getLocation())).icon(BitmapDescriptorFactory.fromBitmap(startPointBitmap)); | ||
| 148 | +// if (getView() != null) { | ||
| 149 | +// getView().baiduMap.addOverlay(startOptions); | ||
| 150 | +// } | ||
| 151 | +// } | ||
| 143 | } | 152 | } |
| 144 | }; | 153 | }; |
| 145 | //开始查询历史轨迹 | 154 | //开始查询历史轨迹 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunMainFragmentView.java
| @@ -19,6 +19,7 @@ import com.cnlive.moudle.pedometer.ui.activity.RunningMapActivity; | @@ -19,6 +19,7 @@ import com.cnlive.moudle.pedometer.ui.activity.RunningMapActivity; | ||
| 19 | import com.cnlive.moudle.pedometer.ui.fragment.RunMainFragment; | 19 | import com.cnlive.moudle.pedometer.ui.fragment.RunMainFragment; |
| 20 | import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; | 20 | import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; |
| 21 | import com.cnlive.moudle.pedometer.utils.ButtonAnimUtil; | 21 | import com.cnlive.moudle.pedometer.utils.ButtonAnimUtil; |
| 22 | +import com.cnlive.moudle.pedometer.utils.MySpHelper; | ||
| 22 | import com.cnlive.moudle.pedometer.utils.StepUtil; | 23 | import com.cnlive.moudle.pedometer.utils.StepUtil; |
| 23 | import com.example.moudle_pedometer.R; | 24 | import com.example.moudle_pedometer.R; |
| 24 | import com.hannesdorfmann.mosby3.mvp.MvpView; | 25 | import com.hannesdorfmann.mosby3.mvp.MvpView; |
| @@ -172,6 +173,10 @@ public class RunMainFragmentView implements MvpView { | @@ -172,6 +173,10 @@ public class RunMainFragmentView implements MvpView { | ||
| 172 | fragment.binding.flContinue.setOnClickListener(new View.OnClickListener() { | 173 | fragment.binding.flContinue.setOnClickListener(new View.OnClickListener() { |
| 173 | @Override | 174 | @Override |
| 174 | public void onClick(View view) { | 175 | public void onClick(View view) { |
| 176 | + //继续记录轨迹 | ||
| 177 | + if (StepService.mClient != null && StepService.traceListener != null) { | ||
| 178 | + StepService.mClient.startGather(StepService.traceListener); | ||
| 179 | + } | ||
| 175 | needWriteDataFlag = true; | 180 | needWriteDataFlag = true; |
| 176 | //将当前计时器时间戳写入数据库 | 181 | //将当前计时器时间戳写入数据库 |
| 177 | setSQLPauseTime(); | 182 | setSQLPauseTime(); |
| @@ -237,14 +242,16 @@ public class RunMainFragmentView implements MvpView { | @@ -237,14 +242,16 @@ public class RunMainFragmentView implements MvpView { | ||
| 237 | public void onClick(SelectDialog dialog) { | 242 | public void onClick(SelectDialog dialog) { |
| 238 | fragment.binding.cpCurrent.setVisibility(View.GONE); | 243 | fragment.binding.cpCurrent.setVisibility(View.GONE); |
| 239 | ButtonAnimUtil.setViewDefault(fragment.binding.flStop); | 244 | ButtonAnimUtil.setViewDefault(fragment.binding.flStop); |
| 240 | - fragment.getActivity().stopService(new Intent(fragment.getActivity(), StepService.class)); | ||
| 241 | //清空数据 | 245 | //清空数据 |
| 242 | StepUtil.clearRunData(getContext(), uid); | 246 | StepUtil.clearRunData(getContext(), uid); |
| 243 | dialog.dismiss(); | 247 | dialog.dismiss(); |
| 244 | if (StepService.mClient != null) { | 248 | if (StepService.mClient != null) { |
| 245 | StepService.mClient.stopGather(StepService.traceListener); | 249 | StepService.mClient.stopGather(StepService.traceListener); |
| 246 | } | 250 | } |
| 247 | -// fragment.getActivity().finish(); | 251 | + MySpHelper.getInstance(getContext(), Context.MODE_MULTI_PROCESS).putLong("stepStartTime", 0); |
| 252 | + fragment.getActivity().stopService(new Intent(fragment.getActivity(), StepService.class)); | ||
| 253 | + | ||
| 254 | + // fragment.getActivity().finish(); | ||
| 248 | } | 255 | } |
| 249 | }, "取消", new SelectDialog.DialogInterface() { | 256 | }, "取消", new SelectDialog.DialogInterface() { |
| 250 | @Override | 257 | @Override |
| @@ -296,6 +303,10 @@ public class RunMainFragmentView implements MvpView { | @@ -296,6 +303,10 @@ public class RunMainFragmentView implements MvpView { | ||
| 296 | fragment.binding.flPause.setOnClickListener(new View.OnClickListener() { | 303 | fragment.binding.flPause.setOnClickListener(new View.OnClickListener() { |
| 297 | @Override | 304 | @Override |
| 298 | public void onClick(View view) { | 305 | public void onClick(View view) { |
| 306 | + //暂停轨迹记录 | ||
| 307 | + if (StepService.mClient != null && StepService.traceListener != null) { | ||
| 308 | + StepService.mClient.stopGather(StepService.traceListener); | ||
| 309 | + } | ||
| 299 | //将当前计时器时间戳写入数据库 | 310 | //将当前计时器时间戳写入数据库 |
| 300 | setSQLPauseTime(); | 311 | setSQLPauseTime(); |
| 301 | needWriteDataFlag = false; | 312 | needWriteDataFlag = false; |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/service/StepService.java
| @@ -47,6 +47,8 @@ import com.cnlive.moudle.pedometer.sql.dao.UserStepEntityDao; | @@ -47,6 +47,8 @@ import com.cnlive.moudle.pedometer.sql.dao.UserStepEntityDao; | ||
| 47 | import com.cnlive.moudle.pedometer.sql.db.DbCore; | 47 | import com.cnlive.moudle.pedometer.sql.db.DbCore; |
| 48 | import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; | 48 | import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; |
| 49 | import com.cnlive.moudle.pedometer.ui.activity.PedometerMainActivity; | 49 | import com.cnlive.moudle.pedometer.ui.activity.PedometerMainActivity; |
| 50 | +import com.cnlive.moudle.pedometer.utils.MySpHelper; | ||
| 51 | +import com.cnlive.moudle.pedometer.utils.TimeUtil; | ||
| 50 | import com.example.moudle_pedometer.R; | 52 | import com.example.moudle_pedometer.R; |
| 51 | import com.orhanobut.logger.Logger; | 53 | import com.orhanobut.logger.Logger; |
| 52 | 54 | ||
| @@ -144,7 +146,10 @@ public class StepService extends Service implements SensorEventListener { | @@ -144,7 +146,10 @@ public class StepService extends Service implements SensorEventListener { | ||
| 144 | //打包周期 | 146 | //打包周期 |
| 145 | private int packInterval = 30; | 147 | private int packInterval = 30; |
| 146 | // 轨迹服务ID | 148 | // 轨迹服务ID |
| 147 | - public static final long serviceId = 213511; | 149 | +// public static final long serviceId = 213511; |
| 150 | +//杨帅 | ||
| 151 | + public static final long serviceId = 213553; | ||
| 152 | + | ||
| 148 | // 设备标识 | 153 | // 设备标识 |
| 149 | public static String entityName = ""; | 154 | public static String entityName = ""; |
| 150 | /** | 155 | /** |
| @@ -174,9 +179,12 @@ public class StepService extends Service implements SensorEventListener { | @@ -174,9 +179,12 @@ public class StepService extends Service implements SensorEventListener { | ||
| 174 | private void initTrace() { | 179 | private void initTrace() { |
| 175 | if (mClient == null) { | 180 | if (mClient == null) { |
| 176 | mClient = new LBSTraceClient(getApplicationContext()); | 181 | mClient = new LBSTraceClient(getApplicationContext()); |
| 182 | + // 设置定位和打包周期 | ||
| 183 | + mClient.setInterval(gatherInterval, packInterval); | ||
| 177 | } | 184 | } |
| 178 | if (mTrace == null) { | 185 | if (mTrace == null) { |
| 179 | mTrace = new Trace(serviceId, entityName); | 186 | mTrace = new Trace(serviceId, entityName); |
| 187 | + | ||
| 180 | } | 188 | } |
| 181 | //初始化实时轨迹监听器 | 189 | //初始化实时轨迹监听器 |
| 182 | realTimeTraceListener = new OnTrackListener() { | 190 | realTimeTraceListener = new OnTrackListener() { |
| @@ -324,6 +332,10 @@ public class StepService extends Service implements SensorEventListener { | @@ -324,6 +332,10 @@ public class StepService extends Service implements SensorEventListener { | ||
| 324 | //开启轨迹服务 | 332 | //开启轨迹服务 |
| 325 | if (mClient != null) { | 333 | if (mClient != null) { |
| 326 | mClient.startTrace(mTrace, traceListener); | 334 | mClient.startTrace(mTrace, traceListener); |
| 335 | + long stepStartTime = MySpHelper.getInstance(getApplicationContext(), Context.MODE_MULTI_PROCESS).getLong("stepStartTime", 0); | ||
| 336 | + if (stepStartTime == 0) { | ||
| 337 | + MySpHelper.getInstance(getApplicationContext(), Context.MODE_MULTI_PROCESS).putLong("stepStartTime", TimeUtil.getCurrentTime()); | ||
| 338 | + } | ||
| 327 | } | 339 | } |
| 328 | 340 | ||
| 329 | } | 341 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RunningMapFragment.java
| 1 | package com.cnlive.moudle.pedometer.ui.fragment; | 1 | package com.cnlive.moudle.pedometer.ui.fragment; |
| 2 | 2 | ||
| 3 | +import android.content.Context; | ||
| 3 | import android.hardware.Sensor; | 4 | import android.hardware.Sensor; |
| 4 | import android.hardware.SensorManager; | 5 | import android.hardware.SensorManager; |
| 5 | import android.os.Bundle; | 6 | import android.os.Bundle; |
| 7 | +import android.os.SystemClock; | ||
| 6 | import android.support.annotation.Nullable; | 8 | import android.support.annotation.Nullable; |
| 7 | import android.text.TextUtils; | 9 | import android.text.TextUtils; |
| 8 | import android.util.Log; | 10 | import android.util.Log; |
| @@ -16,6 +18,7 @@ import com.cnlive.moudle.pedometer.model.RunningMapBean; | @@ -16,6 +18,7 @@ import com.cnlive.moudle.pedometer.model.RunningMapBean; | ||
| 16 | import com.cnlive.moudle.pedometer.model.Constant; | 18 | import com.cnlive.moudle.pedometer.model.Constant; |
| 17 | import com.cnlive.moudle.pedometer.model.MessageEvent; | 19 | import com.cnlive.moudle.pedometer.model.MessageEvent; |
| 18 | import com.cnlive.moudle.pedometer.service.StepService; | 20 | import com.cnlive.moudle.pedometer.service.StepService; |
| 21 | +import com.cnlive.moudle.pedometer.utils.MySpHelper; | ||
| 19 | import com.cnlive.moudle.pedometer.utils.TimeUtil; | 22 | import com.cnlive.moudle.pedometer.utils.TimeUtil; |
| 20 | import com.example.moudle_pedometer.R; | 23 | import com.example.moudle_pedometer.R; |
| 21 | import com.example.moudle_pedometer.databinding.FragmentRunningMapBinding; | 24 | import com.example.moudle_pedometer.databinding.FragmentRunningMapBinding; |
| @@ -83,8 +86,21 @@ public class RunningMapFragment extends QMUIFragment<RunningMapFragmentView, Run | @@ -83,8 +86,21 @@ public class RunningMapFragment extends QMUIFragment<RunningMapFragmentView, Run | ||
| 83 | } | 86 | } |
| 84 | //开始进行历史轨迹查询 | 87 | //开始进行历史轨迹查询 |
| 85 | if (getPresenter() != null && !TextUtils.isEmpty(StepService.entityName)) { | 88 | if (getPresenter() != null && !TextUtils.isEmpty(StepService.entityName)) { |
| 86 | - long startTime = runningMapBean.getTimeBase(); | ||
| 87 | - long endTime = TimeUtil.getCurrentTime(); | 89 | + long stepStartTime = MySpHelper.getInstance(getActivity(), Context.MODE_MULTI_PROCESS).getLong("stepStartTime", 0); |
| 90 | + long startTime = 0; | ||
| 91 | + if (stepStartTime != 0) { | ||
| 92 | + startTime = stepStartTime; | ||
| 93 | + } else { | ||
| 94 | + startTime = (int) (System.currentTimeMillis() / 1000 - 12 * 60 * 60); | ||
| 95 | + } | ||
| 96 | +// long base = runningMapBean.getTimeBase() + (SystemClock.elapsedRealtime() - runningMapBean.getRecordTime()); | ||
| 97 | +// int hour = (int) ((SystemClock.elapsedRealtime() - base) / 1000 / 60 / 60); | ||
| 98 | +// int minute = (int) ((SystemClock.elapsedRealtime() - base) / 1000 / 60) % 60; | ||
| 99 | +// int second = (int) ((SystemClock.elapsedRealtime() - base) / 1000) % 60; | ||
| 100 | + long current = TimeUtil.getCurrentTime(); | ||
| 101 | +// long startTime = current - hour * 3600 * 1000 - minute * 60 * 1000 - second * 1000; | ||
| 102 | + long endTime = current; | ||
| 103 | +// Log.e(TAG, "onViewCreated: " + "hour:" + hour + ",minute" + minute + ",second:" + second); | ||
| 88 | getPresenter().queryHistoryTrace(getActivity(), StepService.entityName, startTime, endTime); | 104 | getPresenter().queryHistoryTrace(getActivity(), StepService.entityName, startTime, endTime); |
| 89 | } | 105 | } |
| 90 | } | 106 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/MyMapUtil.java
| @@ -75,7 +75,7 @@ public class MyMapUtil { | @@ -75,7 +75,7 @@ public class MyMapUtil { | ||
| 75 | .color(context.getResources().getColor(lineColor)).points(points); | 75 | .color(context.getResources().getColor(lineColor)).points(points); |
| 76 | 76 | ||
| 77 | baiduMap.addOverlay(startOptions); | 77 | baiduMap.addOverlay(startOptions); |
| 78 | -// baiduMap.addOverlay(endOptions); | 78 | + baiduMap.addOverlay(endOptions); |
| 79 | return baiduMap.addOverlay(polylineOptions); | 79 | return baiduMap.addOverlay(polylineOptions); |
| 80 | } | 80 | } |
| 81 | } | 81 | } |