Commit de1136ae4db1c69fe6db9de49f573e1c9db54c6c
1 parent
eadcb01f
1.修改计步服务启动逻辑
Showing
28 changed files
with
566 additions
and
161 deletions
moudle_pedometer/src/main/AndroidManifest.xml
| @@ -170,7 +170,6 @@ | @@ -170,7 +170,6 @@ | ||
| 170 | </receiver> | 170 | </receiver> |
| 171 | <activity | 171 | <activity |
| 172 | android:name="com.cnlive.moudle.collectionTrace.ui.activity.CollPedometerMainActivity" | 172 | android:name="com.cnlive.moudle.collectionTrace.ui.activity.CollPedometerMainActivity" |
| 173 | - android:launchMode="singleTask" | ||
| 174 | android:process=":step" /> | 173 | android:process=":step" /> |
| 175 | <activity | 174 | <activity |
| 176 | android:name="com.cnlive.moudle.collectionTrace.ui.activity.CollRunningFinishActivity" | 175 | android:name="com.cnlive.moudle.collectionTrace.ui.activity.CollRunningFinishActivity" |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/presenter/CollRunRaceDetailFragmentPresenter.java
| @@ -25,7 +25,7 @@ import static com.cnlive.libs.base.logic.Config.STATE_LOAD; | @@ -25,7 +25,7 @@ import static com.cnlive.libs.base.logic.Config.STATE_LOAD; | ||
| 25 | 25 | ||
| 26 | public class CollRunRaceDetailFragmentPresenter extends MvpBasePresenter<CollRunRaceDetailFragmentView> { | 26 | public class CollRunRaceDetailFragmentPresenter extends MvpBasePresenter<CollRunRaceDetailFragmentView> { |
| 27 | 27 | ||
| 28 | - public void getRunRaceDetailInfo(Context context, String id, String userId,String state) { | 28 | + public void getRunRaceDetailInfo(Context context, String id, String userId, String state) { |
| 29 | //设置请求参数 | 29 | //设置请求参数 |
| 30 | Map<String, String> paramsMap = new HashMap<>(); | 30 | Map<String, String> paramsMap = new HashMap<>(); |
| 31 | //赛事id | 31 | //赛事id |
| @@ -97,7 +97,7 @@ public class CollRunRaceDetailFragmentPresenter extends MvpBasePresenter<CollRun | @@ -97,7 +97,7 @@ public class CollRunRaceDetailFragmentPresenter extends MvpBasePresenter<CollRun | ||
| 97 | getView().showRetryView(code, new View.OnClickListener() { | 97 | getView().showRetryView(code, new View.OnClickListener() { |
| 98 | @Override | 98 | @Override |
| 99 | public void onClick(View view) { | 99 | public void onClick(View view) { |
| 100 | - getRunRaceDetailInfo(context, id, userId,state); | 100 | + getRunRaceDetailInfo(context, id, userId, state); |
| 101 | } | 101 | } |
| 102 | }); | 102 | }); |
| 103 | } | 103 | } |
| @@ -108,7 +108,7 @@ public class CollRunRaceDetailFragmentPresenter extends MvpBasePresenter<CollRun | @@ -108,7 +108,7 @@ public class CollRunRaceDetailFragmentPresenter extends MvpBasePresenter<CollRun | ||
| 108 | return; | 108 | return; |
| 109 | } | 109 | } |
| 110 | if (baseInfo.getData() != null) { | 110 | if (baseInfo.getData() != null) { |
| 111 | - getView().initView(baseInfo.getData()); | 111 | + getView().initView(baseInfo.getData(), userId); |
| 112 | } | 112 | } |
| 113 | } | 113 | } |
| 114 | }).start(); | 114 | }).start(); |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollRunMainFragmentView.java
| @@ -107,7 +107,6 @@ public class CollRunMainFragmentView implements MvpView { | @@ -107,7 +107,6 @@ public class CollRunMainFragmentView implements MvpView { | ||
| 107 | */ | 107 | */ |
| 108 | public void initView() { | 108 | public void initView() { |
| 109 | uid = "yangshuai"; | 109 | uid = "yangshuai"; |
| 110 | - CollCommonInfo.setUserId(getContext(), uid); | ||
| 111 | initLocationClient(); | 110 | initLocationClient(); |
| 112 | CollUserStepEntity userStepEntity = CollStepUtil.getCollUserStepData(getContext(), uid); | 111 | CollUserStepEntity userStepEntity = CollStepUtil.getCollUserStepData(getContext(), uid); |
| 113 | if (userStepEntity != null) { | 112 | if (userStepEntity != null) { |
| @@ -147,8 +146,7 @@ public class CollRunMainFragmentView implements MvpView { | @@ -147,8 +146,7 @@ public class CollRunMainFragmentView implements MvpView { | ||
| 147 | } | 146 | } |
| 148 | } | 147 | } |
| 149 | }, 10); | 148 | }, 10); |
| 150 | - //开启计步服务 | ||
| 151 | - startStepService(getContext(), uid); | 149 | + |
| 152 | } | 150 | } |
| 153 | } | 151 | } |
| 154 | }; | 152 | }; |
| @@ -453,23 +451,7 @@ public class CollRunMainFragmentView implements MvpView { | @@ -453,23 +451,7 @@ public class CollRunMainFragmentView implements MvpView { | ||
| 453 | } | 451 | } |
| 454 | } | 452 | } |
| 455 | 453 | ||
| 456 | - /** | ||
| 457 | - * 启动计步服务 | ||
| 458 | - * | ||
| 459 | - * @param userId | ||
| 460 | - */ | ||
| 461 | - public void startStepService(Context context, String userId) { | ||
| 462 | - if (CollCommonInfo.getStepStartTime(context) == 0) { | ||
| 463 | - CollCommonInfo.setStepStartTime(context, TimeUtil.getNowTimeStamp()); | ||
| 464 | - } | ||
| 465 | - CollCommonInfo.setIsRunKeepAliveService(context, true); | ||
| 466 | - CollCommonInfo.setIsRunStepService(context, true); | ||
| 467 | - CollCommonInfo.setTsRunBaiduTraceService(context, true); | ||
| 468 | - CollCommonInfo.setIsWriteUserStep(context, true); | ||
| 469 | - Intent intent = new Intent(fragment.getActivity(), CollKeepLiveService.class); | ||
| 470 | - ContextCompat.startForegroundService(fragment.getActivity(), intent); | ||
| 471 | 454 | ||
| 472 | - } | ||
| 473 | 455 | ||
| 474 | /** | 456 | /** |
| 475 | * 更新行走距离 | 457 | * 更新行走距离 |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollRunRaceDetailFragmentView.java
| 1 | package com.cnlive.moudle.collectionTrace.frame.view; | 1 | package com.cnlive.moudle.collectionTrace.frame.view; |
| 2 | 2 | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | +import android.content.Intent; | ||
| 4 | import android.graphics.Bitmap; | 5 | import android.graphics.Bitmap; |
| 5 | import android.graphics.BitmapFactory; | 6 | import android.graphics.BitmapFactory; |
| 6 | import android.hardware.Sensor; | 7 | import android.hardware.Sensor; |
| 7 | import android.hardware.SensorEvent; | 8 | import android.hardware.SensorEvent; |
| 8 | import android.hardware.SensorEventListener; | 9 | import android.hardware.SensorEventListener; |
| 9 | import android.hardware.SensorManager; | 10 | import android.hardware.SensorManager; |
| 11 | +import android.support.v4.content.ContextCompat; | ||
| 10 | import android.text.TextUtils; | 12 | import android.text.TextUtils; |
| 11 | import android.util.Log; | 13 | import android.util.Log; |
| 12 | import android.view.View; | 14 | import android.view.View; |
| @@ -41,12 +43,15 @@ import com.baidu.mapapi.search.route.RoutePlanSearch; | @@ -41,12 +43,15 @@ import com.baidu.mapapi.search.route.RoutePlanSearch; | ||
| 41 | import com.baidu.mapapi.search.route.TransitRouteResult; | 43 | import com.baidu.mapapi.search.route.TransitRouteResult; |
| 42 | import com.baidu.mapapi.search.route.WalkingRoutePlanOption; | 44 | import com.baidu.mapapi.search.route.WalkingRoutePlanOption; |
| 43 | import com.baidu.mapapi.search.route.WalkingRouteResult; | 45 | import com.baidu.mapapi.search.route.WalkingRouteResult; |
| 46 | +import com.cnlive.moudle.collectionTrace.service.CollKeepLiveService; | ||
| 44 | import com.cnlive.moudle.collectionTrace.ui.activity.StartCollectTraceActivity; | 47 | import com.cnlive.moudle.collectionTrace.ui.activity.StartCollectTraceActivity; |
| 45 | import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunRaceDetailFragment; | 48 | import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunRaceDetailFragment; |
| 49 | +import com.cnlive.moudle.pedometer.commonInfo.CollCommonInfo; | ||
| 46 | import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; | 50 | import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; |
| 47 | import com.cnlive.moudle.pedometer.utils.BitmapUtil; | 51 | import com.cnlive.moudle.pedometer.utils.BitmapUtil; |
| 48 | import com.cnlive.moudle.pedometer.utils.GsonUtil; | 52 | import com.cnlive.moudle.pedometer.utils.GsonUtil; |
| 49 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; | 53 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; |
| 54 | +import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil; | ||
| 50 | import com.cnlive.moudle.pedometer.utils.TimeUtil; | 55 | import com.cnlive.moudle.pedometer.utils.TimeUtil; |
| 51 | import com.cnlive.strike.application.GlideApp; | 56 | import com.cnlive.strike.application.GlideApp; |
| 52 | import com.example.moudle_pedometer.R; | 57 | import com.example.moudle_pedometer.R; |
| @@ -106,12 +111,13 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen | @@ -106,12 +111,13 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen | ||
| 106 | } | 111 | } |
| 107 | 112 | ||
| 108 | 113 | ||
| 109 | - public void initView(RunRaceDetailInfo runRaceDetailInfo) { | 114 | + public void initView(RunRaceDetailInfo runRaceDetailInfo, String uid) { |
| 110 | if (fragment.getActivity() == null) { | 115 | if (fragment.getActivity() == null) { |
| 111 | return; | 116 | return; |
| 112 | } | 117 | } |
| 118 | + CollCommonInfo.setUserId(getContext(), uid); | ||
| 113 | this.runRaceDetailInfo = runRaceDetailInfo; | 119 | this.runRaceDetailInfo = runRaceDetailInfo; |
| 114 | -// //初始化地图点位 | 120 | + //初始化地图点位 |
| 115 | if (runRaceDetailInfo.getLatLongitude() != null) { | 121 | if (runRaceDetailInfo.getLatLongitude() != null) { |
| 116 | Log.e(TAG, "initView: 长度:" + runRaceDetailInfo.getLatLongitude().length()); | 122 | Log.e(TAG, "initView: 长度:" + runRaceDetailInfo.getLatLongitude().length()); |
| 117 | trackPoints = GsonUtil.jsonToList(runRaceDetailInfo.getLatLongitude(), LatLng.class); | 123 | trackPoints = GsonUtil.jsonToList(runRaceDetailInfo.getLatLongitude(), LatLng.class); |
| @@ -205,6 +211,7 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen | @@ -205,6 +211,7 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen | ||
| 205 | 211 | ||
| 206 | } | 212 | } |
| 207 | 213 | ||
| 214 | + | ||
| 208 | public void initMap() { | 215 | public void initMap() { |
| 209 | //隐藏底部滑动卡片 | 216 | //隐藏底部滑动卡片 |
| 210 | fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN); | 217 | fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN); |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/StartTraceFragmentView.java
| 1 | package com.cnlive.moudle.collectionTrace.frame.view; | 1 | package com.cnlive.moudle.collectionTrace.frame.view; |
| 2 | 2 | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | +import android.content.Intent; | ||
| 4 | import android.graphics.Bitmap; | 5 | import android.graphics.Bitmap; |
| 5 | import android.graphics.BitmapFactory; | 6 | import android.graphics.BitmapFactory; |
| 6 | import android.hardware.Sensor; | 7 | import android.hardware.Sensor; |
| 7 | import android.hardware.SensorEvent; | 8 | import android.hardware.SensorEvent; |
| 8 | import android.hardware.SensorEventListener; | 9 | import android.hardware.SensorEventListener; |
| 9 | import android.hardware.SensorManager; | 10 | import android.hardware.SensorManager; |
| 11 | +import android.support.v4.content.ContextCompat; | ||
| 10 | import android.text.TextUtils; | 12 | import android.text.TextUtils; |
| 11 | import android.view.View; | 13 | import android.view.View; |
| 12 | import android.widget.Toast; | 14 | import android.widget.Toast; |
| @@ -26,13 +28,17 @@ import com.baidu.mapapi.map.MyLocationData; | @@ -26,13 +28,17 @@ import com.baidu.mapapi.map.MyLocationData; | ||
| 26 | import com.baidu.mapapi.map.UiSettings; | 28 | import com.baidu.mapapi.map.UiSettings; |
| 27 | import com.baidu.mapapi.model.LatLng; | 29 | import com.baidu.mapapi.model.LatLng; |
| 28 | import com.baidu.mapapi.search.route.RoutePlanSearch; | 30 | import com.baidu.mapapi.search.route.RoutePlanSearch; |
| 31 | +import com.cnlive.moudle.collectionTrace.service.CollKeepLiveService; | ||
| 29 | import com.cnlive.moudle.collectionTrace.ui.activity.CollPedometerMainActivity; | 32 | import com.cnlive.moudle.collectionTrace.ui.activity.CollPedometerMainActivity; |
| 30 | import com.cnlive.moudle.collectionTrace.ui.activity.CollRunRaceDetailActivity; | 33 | import com.cnlive.moudle.collectionTrace.ui.activity.CollRunRaceDetailActivity; |
| 31 | import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunRaceDetailFragment; | 34 | import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunRaceDetailFragment; |
| 32 | import com.cnlive.moudle.collectionTrace.ui.fragment.StartTraceFragment; | 35 | import com.cnlive.moudle.collectionTrace.ui.fragment.StartTraceFragment; |
| 36 | +import com.cnlive.moudle.pedometer.commonInfo.CollCommonInfo; | ||
| 33 | import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; | 37 | import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; |
| 34 | import com.cnlive.moudle.pedometer.ui.widget.TipDialog; | 38 | import com.cnlive.moudle.pedometer.ui.widget.TipDialog; |
| 35 | import com.cnlive.moudle.pedometer.utils.BitmapUtil; | 39 | import com.cnlive.moudle.pedometer.utils.BitmapUtil; |
| 40 | +import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil; | ||
| 41 | +import com.cnlive.moudle.pedometer.utils.TimeUtil; | ||
| 36 | import com.example.moudle_pedometer.R; | 42 | import com.example.moudle_pedometer.R; |
| 37 | import com.hannesdorfmann.mosby3.mvp.MvpView; | 43 | import com.hannesdorfmann.mosby3.mvp.MvpView; |
| 38 | 44 | ||
| @@ -83,8 +89,10 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { | @@ -83,8 +89,10 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { | ||
| 83 | public void onClick(SelectDialog dialog) { | 89 | public void onClick(SelectDialog dialog) { |
| 84 | dialog.dismiss(); | 90 | dialog.dismiss(); |
| 85 | isShowFollowAddress = false; | 91 | isShowFollowAddress = false; |
| 86 | - CollPedometerMainActivity.startActivity(fragment.getActivity()); | ||
| 87 | - fragment.getActivity().finish(); | 92 | + QMUITipDialogUtil.loadingDialog(getContext(), "请稍后", false); |
| 93 | + //开启计步服务 | ||
| 94 | + startStepService(getContext()); | ||
| 95 | + | ||
| 88 | } | 96 | } |
| 89 | }); | 97 | }); |
| 90 | selectDialog.setCancelable(false); | 98 | selectDialog.setCancelable(false); |
| @@ -107,6 +115,22 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { | @@ -107,6 +115,22 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { | ||
| 107 | } | 115 | } |
| 108 | 116 | ||
| 109 | /** | 117 | /** |
| 118 | + * 启动计步服务 | ||
| 119 | + */ | ||
| 120 | + public void startStepService(Context context) { | ||
| 121 | + if (CollCommonInfo.getStepStartTime(context) == 0) { | ||
| 122 | + CollCommonInfo.setStepStartTime(context, TimeUtil.getNowTimeStamp()); | ||
| 123 | + } | ||
| 124 | + CollCommonInfo.setIsRunKeepAliveService(context, true); | ||
| 125 | + CollCommonInfo.setIsRunStepService(context, true); | ||
| 126 | + CollCommonInfo.setTsRunBaiduTraceService(context, true); | ||
| 127 | + CollCommonInfo.setIsWriteUserStep(context, true); | ||
| 128 | + Intent intent = new Intent(fragment.getActivity(), CollKeepLiveService.class); | ||
| 129 | + ContextCompat.startForegroundService(fragment.getActivity(), intent); | ||
| 130 | + | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + /** | ||
| 110 | * 初始化地图 | 134 | * 初始化地图 |
| 111 | */ | 135 | */ |
| 112 | public void initMap() { | 136 | public void initMap() { |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/service/CollKeepLiveService.java
| @@ -146,15 +146,12 @@ public class CollKeepLiveService extends Service implements MediaPlayer.OnComple | @@ -146,15 +146,12 @@ public class CollKeepLiveService extends Service implements MediaPlayer.OnComple | ||
| 146 | this.startId = startId; | 146 | this.startId = startId; |
| 147 | //跨进程读取配置文件 | 147 | //跨进程读取配置文件 |
| 148 | boolean isRun = CollCommonInfo.getIsRunKeepAliveService(getApplicationContext()); | 148 | boolean isRun = CollCommonInfo.getIsRunKeepAliveService(getApplicationContext()); |
| 149 | - Log.e("isRun onStartCommand", "" + isRun); | ||
| 150 | 149 | ||
| 151 | if (isRun) { | 150 | if (isRun) { |
| 152 | if (runnable != null) { | 151 | if (runnable != null) { |
| 153 | handler.postDelayed(runnable, 5000); | 152 | handler.postDelayed(runnable, 5000); |
| 154 | } | 153 | } |
| 155 | showHideForegroundNotification(); | 154 | showHideForegroundNotification(); |
| 156 | -// startService(new Intent(getApplicationContext(), HideKeepTipService.class)); | ||
| 157 | - Log.e(TAG, "启动HideKeepTipService"); | ||
| 158 | startPlaySong(); | 155 | startPlaySong(); |
| 159 | } | 156 | } |
| 160 | return START_STICKY; | 157 | return START_STICKY; |
| @@ -220,7 +217,6 @@ public class CollKeepLiveService extends Service implements MediaPlayer.OnComple | @@ -220,7 +217,6 @@ public class CollKeepLiveService extends Service implements MediaPlayer.OnComple | ||
| 220 | @Override | 217 | @Override |
| 221 | public void onDestroy() { | 218 | public void onDestroy() { |
| 222 | super.onDestroy(); | 219 | super.onDestroy(); |
| 223 | - Log.e("onDestroy", "onDestroy:" + notification); | ||
| 224 | if (myReceiver != null) { | 220 | if (myReceiver != null) { |
| 225 | unregisterReceiver(myReceiver); | 221 | unregisterReceiver(myReceiver); |
| 226 | } | 222 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/service/CollStepService.java
| @@ -37,6 +37,7 @@ import com.baidu.trace.model.LocationMode; | @@ -37,6 +37,7 @@ import com.baidu.trace.model.LocationMode; | ||
| 37 | import com.baidu.trace.model.OnTraceListener; | 37 | import com.baidu.trace.model.OnTraceListener; |
| 38 | import com.baidu.trace.model.PushMessage; | 38 | import com.baidu.trace.model.PushMessage; |
| 39 | import com.baidu.trace.model.StatusCodes; | 39 | import com.baidu.trace.model.StatusCodes; |
| 40 | +import com.cnlive.moudle.pedometer.commonInfo.CollCommonInfo; | ||
| 40 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | 41 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 41 | import com.cnlive.moudle.pedometer.model.Constant; | 42 | import com.cnlive.moudle.pedometer.model.Constant; |
| 42 | import com.cnlive.moudle.pedometer.model.MessageEvent; | 43 | import com.cnlive.moudle.pedometer.model.MessageEvent; |
| @@ -158,6 +159,8 @@ public class CollStepService extends Service implements SensorEventListener { | @@ -158,6 +159,8 @@ public class CollStepService extends Service implements SensorEventListener { | ||
| 158 | */ | 159 | */ |
| 159 | public static Trace mTrace = null; | 160 | public static Trace mTrace = null; |
| 160 | 161 | ||
| 162 | + private boolean isFirstSendNotification = true; | ||
| 163 | + | ||
| 161 | public CollStepService() { | 164 | public CollStepService() { |
| 162 | 165 | ||
| 163 | } | 166 | } |
| @@ -168,17 +171,11 @@ public class CollStepService extends Service implements SensorEventListener { | @@ -168,17 +171,11 @@ public class CollStepService extends Service implements SensorEventListener { | ||
| 168 | super.onCreate(); | 171 | super.onCreate(); |
| 169 | init(); | 172 | init(); |
| 170 | initBroadcastReceiver(); | 173 | initBroadcastReceiver(); |
| 171 | - if (!ServiceUtils.isServiceRunning(getApplicationContext(), "com.cnlive.moudle.collectionTrace.service.CollKeepLiveService")) { | ||
| 172 | - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | ||
| 173 | - startForegroundService(new Intent(getApplicationContext(), CollKeepLiveService.class)); | ||
| 174 | - } else { | ||
| 175 | - startService(new Intent(getApplicationContext(), CollKeepLiveService.class)); | ||
| 176 | - } | ||
| 177 | - } | ||
| 178 | showStartForegroundNotification(); | 174 | showStartForegroundNotification(); |
| 179 | } | 175 | } |
| 180 | 176 | ||
| 181 | private void initTrace() { | 177 | private void initTrace() { |
| 178 | + | ||
| 182 | if (mClient == null) { | 179 | if (mClient == null) { |
| 183 | mClient = new LBSTraceClient(getApplicationContext()); | 180 | mClient = new LBSTraceClient(getApplicationContext()); |
| 184 | // 设置定位和打包周期 | 181 | // 设置定位和打包周期 |
| @@ -279,6 +276,17 @@ public class CollStepService extends Service implements SensorEventListener { | @@ -279,6 +276,17 @@ public class CollStepService extends Service implements SensorEventListener { | ||
| 279 | public void onStartGatherCallback(int errorNo, String message) { | 276 | public void onStartGatherCallback(int errorNo, String message) { |
| 280 | if (StatusCodes.SUCCESS == errorNo || StatusCodes.GATHER_STARTED == errorNo) { | 277 | if (StatusCodes.SUCCESS == errorNo || StatusCodes.GATHER_STARTED == errorNo) { |
| 281 | Toast.makeText(getApplicationContext(), "开始采集", Toast.LENGTH_LONG).show(); | 278 | Toast.makeText(getApplicationContext(), "开始采集", Toast.LENGTH_LONG).show(); |
| 279 | + boolean isFirstSendNotification = CollCommonInfo.getIsFirstStepSendTraceTip(getApplicationContext()); | ||
| 280 | + if (isFirstSendNotification) { | ||
| 281 | + CollCommonInfo.setIsFirstStepSendTraceTip(getApplicationContext(), false); | ||
| 282 | + EventBus.getDefault().post(new MessageEvent(Constant.COLL_START_TRACE_GATHER_SUCCESS, "")); | ||
| 283 | + } | ||
| 284 | + } else { | ||
| 285 | + boolean isFirstSendNotification = CollCommonInfo.getIsFirstStepSendTraceTip(getApplicationContext()); | ||
| 286 | + if (isFirstSendNotification) { | ||
| 287 | + CollCommonInfo.setIsFirstStepSendTraceTip(getApplicationContext(), false); | ||
| 288 | + EventBus.getDefault().post(new MessageEvent(Constant.COLL_START_TRACE_GATHER_FAIL, "")); | ||
| 289 | + } | ||
| 282 | } | 290 | } |
| 283 | } | 291 | } |
| 284 | 292 | ||
| @@ -362,7 +370,7 @@ public class CollStepService extends Service implements SensorEventListener { | @@ -362,7 +370,7 @@ public class CollStepService extends Service implements SensorEventListener { | ||
| 362 | @SuppressLint("WrongConstant") | 370 | @SuppressLint("WrongConstant") |
| 363 | @Override | 371 | @Override |
| 364 | public int onStartCommand(Intent intent, int flags, int startId) { | 372 | public int onStartCommand(Intent intent, int flags, int startId) { |
| 365 | - userId = CommonInfo.getUserId(getApplicationContext()); | 373 | + userId = CollCommonInfo.getUserId(getApplicationContext()); |
| 366 | if (userId != null && !TextUtils.isEmpty(userId)) { | 374 | if (userId != null && !TextUtils.isEmpty(userId)) { |
| 367 | if (!EventBus.getDefault().isRegistered(this)) { | 375 | if (!EventBus.getDefault().isRegistered(this)) { |
| 368 | EventBus.getDefault().register(this); | 376 | EventBus.getDefault().register(this); |
| @@ -380,6 +388,9 @@ public class CollStepService extends Service implements SensorEventListener { | @@ -380,6 +388,9 @@ public class CollStepService extends Service implements SensorEventListener { | ||
| 380 | } | 388 | } |
| 381 | }).start(); | 389 | }).start(); |
| 382 | startTimeCount(); | 390 | startTimeCount(); |
| 391 | + } else { | ||
| 392 | + EventBus.getDefault().post(new MessageEvent(Constant.COLL_START_TRACE_GATHER_FAIL, "")); | ||
| 393 | + | ||
| 383 | } | 394 | } |
| 384 | // if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { | 395 | // if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { |
| 385 | // //开始配置JobInfo | 396 | // //开始配置JobInfo |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/CollPedometerMainActivity.java
| @@ -32,7 +32,7 @@ import static android.provider.Settings.EXTRA_APP_PACKAGE; | @@ -32,7 +32,7 @@ import static android.provider.Settings.EXTRA_APP_PACKAGE; | ||
| 32 | */ | 32 | */ |
| 33 | @Route(path = "/moudle_pedometer/InterestActivity") | 33 | @Route(path = "/moudle_pedometer/InterestActivity") |
| 34 | public class CollPedometerMainActivity extends QMUIFragmentActivity { | 34 | public class CollPedometerMainActivity extends QMUIFragmentActivity { |
| 35 | - private static final String TAG = "CollPedometerMainActivity"; | 35 | + private static final String TAG = "CollPedometerMain"; |
| 36 | 36 | ||
| 37 | private NotificationManagerCompat notificationManagerCompat; | 37 | private NotificationManagerCompat notificationManagerCompat; |
| 38 | private boolean isOpen; | 38 | private boolean isOpen; |
| @@ -56,6 +56,7 @@ public class CollPedometerMainActivity extends QMUIFragmentActivity { | @@ -56,6 +56,7 @@ public class CollPedometerMainActivity extends QMUIFragmentActivity { | ||
| 56 | @Override | 56 | @Override |
| 57 | protected void onDestroy() { | 57 | protected void onDestroy() { |
| 58 | super.onDestroy(); | 58 | super.onDestroy(); |
| 59 | + Log.e(TAG, "onDestroy: "); | ||
| 59 | } | 60 | } |
| 60 | 61 | ||
| 61 | private void check() { | 62 | private void check() { |
| @@ -112,38 +113,8 @@ public class CollPedometerMainActivity extends QMUIFragmentActivity { | @@ -112,38 +113,8 @@ public class CollPedometerMainActivity extends QMUIFragmentActivity { | ||
| 112 | 113 | ||
| 113 | @Override | 114 | @Override |
| 114 | protected void onResume() { | 115 | protected void onResume() { |
| 115 | - | ||
| 116 | - boolean result = false; | ||
| 117 | - if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECEIVE_BOOT_COMPLETED) == PackageManager.PERMISSION_GRANTED) { | ||
| 118 | - result = true; | ||
| 119 | - } | ||
| 120 | - Log.e("i", "" + result + "," + getPackageName()); | ||
| 121 | - PackageManager pm = getPackageManager(); | ||
| 122 | - pm.checkPermission("android.permission.RECEIVE_BOOT_COMPLETED", getPackageName()); | ||
| 123 | - try { | ||
| 124 | - PackageInfo packageInfo = pm.getPackageInfo(getPackageName(), PackageManager.GET_PERMISSIONS); | ||
| 125 | - for (int i = 0; i < packageInfo.requestedPermissions.length; i++) { | ||
| 126 | - } | ||
| 127 | -// Log.e("i", "" + packageInfo.requestedPermissions[i]); | ||
| 128 | - } catch (PackageManager.NameNotFoundException e) { | ||
| 129 | - e.printStackTrace(); | ||
| 130 | - } | ||
| 131 | - | ||
| 132 | super.onResume(); | 116 | super.onResume(); |
| 133 | check(); | 117 | check(); |
| 134 | -// PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE); | ||
| 135 | - | ||
| 136 | -// if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) { | ||
| 137 | -// boolean hasIgnored = powerManager.isIgnoringBatteryOptimizations(getPackageName()); | ||
| 138 | -// if (!hasIgnored) { | ||
| 139 | -// Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); | ||
| 140 | -// intent.setData(Uri.parse("package:" + getPackageName())); | ||
| 141 | -// PackageManager pm = getPackageManager(); | ||
| 142 | -// if (intent.resolveActivity(pm) != null) { | ||
| 143 | -// startActivity(intent); | ||
| 144 | -// } | ||
| 145 | -// } | ||
| 146 | -// } | ||
| 147 | getPermissionsWithTip(); | 118 | getPermissionsWithTip(); |
| 148 | } | 119 | } |
| 149 | 120 | ||
| @@ -178,7 +149,9 @@ public class CollPedometerMainActivity extends QMUIFragmentActivity { | @@ -178,7 +149,9 @@ public class CollPedometerMainActivity extends QMUIFragmentActivity { | ||
| 178 | startActivityForResult(intent, 10); | 149 | startActivityForResult(intent, 10); |
| 179 | Toast.makeText(getApplicationContext(), getString(R.string.open_gps_tip), Toast.LENGTH_LONG).show(); | 150 | Toast.makeText(getApplicationContext(), getString(R.string.open_gps_tip), Toast.LENGTH_LONG).show(); |
| 180 | } else { | 151 | } else { |
| 181 | - addFragment(); | 152 | + if (getCurrentFragment() == null) { |
| 153 | + addFragment(); | ||
| 154 | + } | ||
| 182 | } | 155 | } |
| 183 | } | 156 | } |
| 184 | }) | 157 | }) |
| @@ -227,4 +200,6 @@ public class CollPedometerMainActivity extends QMUIFragmentActivity { | @@ -227,4 +200,6 @@ public class CollPedometerMainActivity extends QMUIFragmentActivity { | ||
| 227 | Intent intent = new Intent(activity, CollPedometerMainActivity.class); | 200 | Intent intent = new Intent(activity, CollPedometerMainActivity.class); |
| 228 | activity.startActivity(intent); | 201 | activity.startActivity(intent); |
| 229 | } | 202 | } |
| 203 | + | ||
| 204 | + | ||
| 230 | } | 205 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/CollRunRaceDetailActivity.java
| @@ -4,6 +4,7 @@ import android.app.Activity; | @@ -4,6 +4,7 @@ import android.app.Activity; | ||
| 4 | import android.content.Intent; | 4 | import android.content.Intent; |
| 5 | import android.os.Bundle; | 5 | import android.os.Bundle; |
| 6 | import android.support.annotation.Nullable; | 6 | import android.support.annotation.Nullable; |
| 7 | +import android.util.Log; | ||
| 7 | 8 | ||
| 8 | import com.alibaba.android.arouter.facade.annotation.Route; | 9 | import com.alibaba.android.arouter.facade.annotation.Route; |
| 9 | import com.cnlive.libs.base.ui.QMUIFragment; | 10 | import com.cnlive.libs.base.ui.QMUIFragment; |
| @@ -13,6 +14,7 @@ import com.cnlive.libs.base.util.StatusBarUtil2; | @@ -13,6 +14,7 @@ import com.cnlive.libs.base.util.StatusBarUtil2; | ||
| 13 | import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunMainFragment; | 14 | import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunMainFragment; |
| 14 | import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunRaceDetailFragment; | 15 | import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunRaceDetailFragment; |
| 15 | import com.cnlive.moudle.pedometer.commonInfo.CollCommonInfo; | 16 | import com.cnlive.moudle.pedometer.commonInfo.CollCommonInfo; |
| 17 | +import com.cnlive.moudle.pedometer.utils.CheckUtil; | ||
| 16 | import com.example.moudle_pedometer.R; | 18 | import com.example.moudle_pedometer.R; |
| 17 | 19 | ||
| 18 | /** | 20 | /** |
| @@ -22,6 +24,7 @@ import com.example.moudle_pedometer.R; | @@ -22,6 +24,7 @@ import com.example.moudle_pedometer.R; | ||
| 22 | */ | 24 | */ |
| 23 | @Route(path = "/moudle_pedometer/CollRunRaceDetailActivity") | 25 | @Route(path = "/moudle_pedometer/CollRunRaceDetailActivity") |
| 24 | public class CollRunRaceDetailActivity extends QMUIFragmentActivity { | 26 | public class CollRunRaceDetailActivity extends QMUIFragmentActivity { |
| 27 | + private final String TAG = "CollRunRaceDetail"; | ||
| 25 | private QMUIFragment fragment; | 28 | private QMUIFragment fragment; |
| 26 | 29 | ||
| 27 | @Override | 30 | @Override |
| @@ -38,7 +41,7 @@ public class CollRunRaceDetailActivity extends QMUIFragmentActivity { | @@ -38,7 +41,7 @@ public class CollRunRaceDetailActivity extends QMUIFragmentActivity { | ||
| 38 | // boolean isRunStep = CollCommonInfo.getIsRunStepService(this); | 41 | // boolean isRunStep = CollCommonInfo.getIsRunStepService(this); |
| 39 | // //没有找到相关记录 | 42 | // //没有找到相关记录 |
| 40 | // if (!isRunStep) { | 43 | // if (!isRunStep) { |
| 41 | - fragment = new CollRunRaceDetailFragment(); | 44 | + fragment = new CollRunRaceDetailFragment(); |
| 42 | // } | 45 | // } |
| 43 | // //找到记录 | 46 | // //找到记录 |
| 44 | // else { | 47 | // else { |
| @@ -47,6 +50,18 @@ public class CollRunRaceDetailActivity extends QMUIFragmentActivity { | @@ -47,6 +50,18 @@ public class CollRunRaceDetailActivity extends QMUIFragmentActivity { | ||
| 47 | if (fragment != null) { | 50 | if (fragment != null) { |
| 48 | addFragment(fragment); | 51 | addFragment(fragment); |
| 49 | } | 52 | } |
| 53 | + | ||
| 54 | + | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + @Override | ||
| 58 | + protected void onResume() { | ||
| 59 | + super.onResume(); | ||
| 60 | + boolean isSet = CheckUtil.isIgnoringBatteryOptimizationss(this); | ||
| 61 | + if (!isSet) { | ||
| 62 | + isSet = CheckUtil.isIgnoringBatteryOptimizationss(this); | ||
| 63 | + } | ||
| 64 | + | ||
| 50 | } | 65 | } |
| 51 | 66 | ||
| 52 | private void addFragment(QMUIFragment fragment) { | 67 | private void addFragment(QMUIFragment fragment) { |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/StartCollectTraceActivity.java
| @@ -35,6 +35,5 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity { | @@ -35,6 +35,5 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity { | ||
| 35 | public static void startActivity(Activity activity) { | 35 | public static void startActivity(Activity activity) { |
| 36 | Intent intent = new Intent(activity, StartCollectTraceActivity.class); | 36 | Intent intent = new Intent(activity, StartCollectTraceActivity.class); |
| 37 | activity.startActivity(intent); | 37 | activity.startActivity(intent); |
| 38 | - activity.finish(); | ||
| 39 | } | 38 | } |
| 40 | } | 39 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/fragment/CollRunMainFragment.java
| @@ -2,9 +2,13 @@ package com.cnlive.moudle.collectionTrace.ui.fragment; | @@ -2,9 +2,13 @@ package com.cnlive.moudle.collectionTrace.ui.fragment; | ||
| 2 | 2 | ||
| 3 | import android.os.Bundle; | 3 | import android.os.Bundle; |
| 4 | import android.os.Handler; | 4 | import android.os.Handler; |
| 5 | +import android.support.annotation.NonNull; | ||
| 5 | import android.support.annotation.Nullable; | 6 | import android.support.annotation.Nullable; |
| 6 | import android.text.TextUtils; | 7 | import android.text.TextUtils; |
| 8 | +import android.util.Log; | ||
| 9 | +import android.view.LayoutInflater; | ||
| 7 | import android.view.View; | 10 | import android.view.View; |
| 11 | +import android.view.ViewGroup; | ||
| 8 | 12 | ||
| 9 | import com.cnlive.libs.base.ui.QMUIFragment; | 13 | import com.cnlive.libs.base.ui.QMUIFragment; |
| 10 | import com.cnlive.libs.base.util.StatusBarUtil2; | 14 | import com.cnlive.libs.base.util.StatusBarUtil2; |
| @@ -23,6 +27,12 @@ public class CollRunMainFragment extends QMUIFragment<CollRunMainFragmentView, C | @@ -23,6 +27,12 @@ public class CollRunMainFragment extends QMUIFragment<CollRunMainFragmentView, C | ||
| 23 | private final String TAG = "CollRunMainFragment"; | 27 | private final String TAG = "CollRunMainFragment"; |
| 24 | private String userId = "yangshuai"; | 28 | private String userId = "yangshuai"; |
| 25 | 29 | ||
| 30 | + @NonNull | ||
| 31 | + @Override | ||
| 32 | + protected View onCreateView(@NonNull LayoutInflater inflater, @NonNull ViewGroup container) { | ||
| 33 | + return super.onCreateView(inflater, container); | ||
| 34 | + } | ||
| 35 | + | ||
| 26 | @Override | 36 | @Override |
| 27 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | 37 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 28 | super.onViewCreated(view, savedInstanceState); | 38 | super.onViewCreated(view, savedInstanceState); |
| @@ -32,6 +42,7 @@ public class CollRunMainFragment extends QMUIFragment<CollRunMainFragmentView, C | @@ -32,6 +42,7 @@ public class CollRunMainFragment extends QMUIFragment<CollRunMainFragmentView, C | ||
| 32 | new Handler().postDelayed(new Runnable() { | 42 | new Handler().postDelayed(new Runnable() { |
| 33 | @Override | 43 | @Override |
| 34 | public void run() { | 44 | public void run() { |
| 45 | + | ||
| 35 | getMvpView().initView(); | 46 | getMvpView().initView(); |
| 36 | } | 47 | } |
| 37 | }, 5); | 48 | }, 5); |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/fragment/CollRunRaceDetailFragment.java
| @@ -11,11 +11,19 @@ import android.widget.Button; | @@ -11,11 +11,19 @@ import android.widget.Button; | ||
| 11 | import com.cnlive.libs.base.ui.QMUIFragment; | 11 | import com.cnlive.libs.base.ui.QMUIFragment; |
| 12 | import com.cnlive.moudle.collectionTrace.frame.presenter.CollRunRaceDetailFragmentPresenter; | 12 | import com.cnlive.moudle.collectionTrace.frame.presenter.CollRunRaceDetailFragmentPresenter; |
| 13 | import com.cnlive.moudle.collectionTrace.frame.view.CollRunRaceDetailFragmentView; | 13 | import com.cnlive.moudle.collectionTrace.frame.view.CollRunRaceDetailFragmentView; |
| 14 | +import com.cnlive.moudle.collectionTrace.ui.activity.StartCollectTraceActivity; | ||
| 15 | +import com.cnlive.moudle.pedometer.model.Constant; | ||
| 16 | +import com.cnlive.moudle.pedometer.model.MessageEvent; | ||
| 14 | import com.cnlive.moudle.pedometer.ui.activity.RunLineActivity; | 17 | import com.cnlive.moudle.pedometer.ui.activity.RunLineActivity; |
| 18 | +import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil; | ||
| 15 | import com.example.moudle_pedometer.R; | 19 | import com.example.moudle_pedometer.R; |
| 16 | import com.example.moudle_pedometer.databinding.FragmentCollectRunRaceDetailBinding; | 20 | import com.example.moudle_pedometer.databinding.FragmentCollectRunRaceDetailBinding; |
| 17 | import com.qmuiteam.qmui.widget.QMUITopBar; | 21 | import com.qmuiteam.qmui.widget.QMUITopBar; |
| 18 | 22 | ||
| 23 | +import org.greenrobot.eventbus.EventBus; | ||
| 24 | +import org.greenrobot.eventbus.Subscribe; | ||
| 25 | +import org.greenrobot.eventbus.ThreadMode; | ||
| 26 | + | ||
| 19 | import static android.content.Context.SENSOR_SERVICE; | 27 | import static android.content.Context.SENSOR_SERVICE; |
| 20 | 28 | ||
| 21 | /** | 29 | /** |
| @@ -60,7 +68,6 @@ public class CollRunRaceDetailFragment extends QMUIFragment<CollRunRaceDetailFra | @@ -60,7 +68,6 @@ public class CollRunRaceDetailFragment extends QMUIFragment<CollRunRaceDetailFra | ||
| 60 | @Override | 68 | @Override |
| 61 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | 69 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 62 | super.onViewCreated(view, savedInstanceState); | 70 | super.onViewCreated(view, savedInstanceState); |
| 63 | - | ||
| 64 | mSensorManager = (SensorManager) getActivity().getSystemService(SENSOR_SERVICE);//获取传感器管理服务 | 71 | mSensorManager = (SensorManager) getActivity().getSystemService(SENSOR_SERVICE);//获取传感器管理服务 |
| 65 | if (getMvpView() != null) { | 72 | if (getMvpView() != null) { |
| 66 | getMvpView().initMap(); | 73 | getMvpView().initMap(); |
| @@ -111,6 +118,7 @@ public class CollRunRaceDetailFragment extends QMUIFragment<CollRunRaceDetailFra | @@ -111,6 +118,7 @@ public class CollRunRaceDetailFragment extends QMUIFragment<CollRunRaceDetailFra | ||
| 111 | } | 118 | } |
| 112 | 119 | ||
| 113 | } | 120 | } |
| 121 | + | ||
| 114 | /** | 122 | /** |
| 115 | * 屏蔽边缘返回 | 123 | * 屏蔽边缘返回 |
| 116 | * 杨帅 | 124 | * 杨帅 |
| @@ -167,4 +175,7 @@ public class CollRunRaceDetailFragment extends QMUIFragment<CollRunRaceDetailFra | @@ -167,4 +175,7 @@ public class CollRunRaceDetailFragment extends QMUIFragment<CollRunRaceDetailFra | ||
| 167 | // FivePersonIconView fivePersonIconView = view.findViewById(R.id.five_join_person); | 175 | // FivePersonIconView fivePersonIconView = view.findViewById(R.id.five_join_person); |
| 168 | // fivePersonIconView.initIconData(data); | 176 | // fivePersonIconView.initIconData(data); |
| 169 | // } | 177 | // } |
| 178 | + | ||
| 179 | + | ||
| 180 | + | ||
| 170 | } | 181 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/fragment/CollRunningMapFragment.java
| @@ -25,6 +25,7 @@ import com.cnlive.moudle.pedometer.utils.ChineseToSpeechUtil; | @@ -25,6 +25,7 @@ import com.cnlive.moudle.pedometer.utils.ChineseToSpeechUtil; | ||
| 25 | import com.cnlive.moudle.pedometer.utils.GsonUtil; | 25 | import com.cnlive.moudle.pedometer.utils.GsonUtil; |
| 26 | import com.cnlive.moudle.pedometer.utils.TimeUtil; | 26 | import com.cnlive.moudle.pedometer.utils.TimeUtil; |
| 27 | import com.example.moudle_pedometer.R; | 27 | import com.example.moudle_pedometer.R; |
| 28 | +import com.example.moudle_pedometer.databinding.FragmentCollectRunningMapBinding; | ||
| 28 | import com.example.moudle_pedometer.databinding.FragmentRunningMapBinding; | 29 | import com.example.moudle_pedometer.databinding.FragmentRunningMapBinding; |
| 29 | 30 | ||
| 30 | import org.greenrobot.eventbus.EventBus; | 31 | import org.greenrobot.eventbus.EventBus; |
| @@ -41,7 +42,7 @@ import static android.content.Context.SENSOR_SERVICE; | @@ -41,7 +42,7 @@ import static android.content.Context.SENSOR_SERVICE; | ||
| 41 | * | 42 | * |
| 42 | * @author ShinnyYang | 43 | * @author ShinnyYang |
| 43 | */ | 44 | */ |
| 44 | -public class CollRunningMapFragment extends QMUIFragment<CollRunningMapFragmentView, CollRunningMapFragmentPresenter, FragmentRunningMapBinding> { | 45 | +public class CollRunningMapFragment extends QMUIFragment<CollRunningMapFragmentView, CollRunningMapFragmentPresenter, FragmentCollectRunningMapBinding> { |
| 45 | private static final String TAG = "CollRunningMapFragment"; | 46 | private static final String TAG = "CollRunningMapFragment"; |
| 46 | private RunningMapBean runningMapBean; | 47 | private RunningMapBean runningMapBean; |
| 47 | private SensorManager mSensorManager; | 48 | private SensorManager mSensorManager; |
| @@ -62,7 +63,7 @@ public class CollRunningMapFragment extends QMUIFragment<CollRunningMapFragmentV | @@ -62,7 +63,7 @@ public class CollRunningMapFragment extends QMUIFragment<CollRunningMapFragmentV | ||
| 62 | 63 | ||
| 63 | @Override | 64 | @Override |
| 64 | protected int getLayoutId() { | 65 | protected int getLayoutId() { |
| 65 | - return R.layout.fragment_running_map; | 66 | + return R.layout.fragment_collect_running_map; |
| 66 | } | 67 | } |
| 67 | 68 | ||
| 68 | public static CollRunningMapFragment getInstance(RunningMapBean runningMapBean) { | 69 | public static CollRunningMapFragment getInstance(RunningMapBean runningMapBean) { |
| @@ -118,7 +119,7 @@ public class CollRunningMapFragment extends QMUIFragment<CollRunningMapFragmentV | @@ -118,7 +119,7 @@ public class CollRunningMapFragment extends QMUIFragment<CollRunningMapFragmentV | ||
| 118 | // Log.e(TAG, "onViewCreated: " + "hour:" + hour + ",minute" + minute + ",second:" + second); | 119 | // Log.e(TAG, "onViewCreated: " + "hour:" + hour + ",minute" + minute + ",second:" + second); |
| 119 | getPresenter().queryHistoryTrace(getActivity(), StepService.entityName, startTime, endTime); | 120 | getPresenter().queryHistoryTrace(getActivity(), StepService.entityName, startTime, endTime); |
| 120 | //查询实时轨迹 | 121 | //查询实时轨迹 |
| 121 | - getPresenter().queryRealTimeTrace(getActivity(), StepService.entityName, startTime); | 122 | +// getPresenter().queryRealTimeTrace(getActivity(), StepService.entityName, startTime); |
| 122 | 123 | ||
| 123 | } | 124 | } |
| 124 | 125 | ||
| @@ -128,7 +129,6 @@ public class CollRunningMapFragment extends QMUIFragment<CollRunningMapFragmentV | @@ -128,7 +129,6 @@ public class CollRunningMapFragment extends QMUIFragment<CollRunningMapFragmentV | ||
| 128 | com.baidu.trace.model.LatLng tempLatLng = new com.baidu.trace.model.LatLng(latLng.latitude, latLng.longitude); | 129 | com.baidu.trace.model.LatLng tempLatLng = new com.baidu.trace.model.LatLng(latLng.latitude, latLng.longitude); |
| 129 | fenceLatLngs.add(tempLatLng); | 130 | fenceLatLngs.add(tempLatLng); |
| 130 | } | 131 | } |
| 131 | - getPresenter().createFence(getActivity(), fenceLatLngs); | ||
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | @Override | 134 | @Override |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/fragment/StartTraceFragment.java
| @@ -5,12 +5,22 @@ import android.hardware.SensorManager; | @@ -5,12 +5,22 @@ import android.hardware.SensorManager; | ||
| 5 | import android.os.Bundle; | 5 | import android.os.Bundle; |
| 6 | import android.support.annotation.Nullable; | 6 | import android.support.annotation.Nullable; |
| 7 | import android.view.View; | 7 | import android.view.View; |
| 8 | + | ||
| 8 | import com.cnlive.libs.base.ui.QMUIFragment; | 9 | import com.cnlive.libs.base.ui.QMUIFragment; |
| 9 | import com.cnlive.moudle.collectionTrace.frame.presenter.StartTraceFragmentPresenter; | 10 | import com.cnlive.moudle.collectionTrace.frame.presenter.StartTraceFragmentPresenter; |
| 10 | import com.cnlive.moudle.collectionTrace.frame.view.StartTraceFragmentView; | 11 | import com.cnlive.moudle.collectionTrace.frame.view.StartTraceFragmentView; |
| 12 | +import com.cnlive.moudle.collectionTrace.ui.activity.CollPedometerMainActivity; | ||
| 13 | +import com.cnlive.moudle.collectionTrace.ui.activity.StartCollectTraceActivity; | ||
| 14 | +import com.cnlive.moudle.pedometer.model.Constant; | ||
| 15 | +import com.cnlive.moudle.pedometer.model.MessageEvent; | ||
| 16 | +import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil; | ||
| 11 | import com.example.moudle_pedometer.R; | 17 | import com.example.moudle_pedometer.R; |
| 12 | import com.example.moudle_pedometer.databinding.FragmentStartCollectTraceBinding; | 18 | import com.example.moudle_pedometer.databinding.FragmentStartCollectTraceBinding; |
| 13 | 19 | ||
| 20 | +import org.greenrobot.eventbus.EventBus; | ||
| 21 | +import org.greenrobot.eventbus.Subscribe; | ||
| 22 | +import org.greenrobot.eventbus.ThreadMode; | ||
| 23 | + | ||
| 14 | import static android.content.Context.SENSOR_SERVICE; | 24 | import static android.content.Context.SENSOR_SERVICE; |
| 15 | 25 | ||
| 16 | public class StartTraceFragment extends QMUIFragment<StartTraceFragmentView, StartTraceFragmentPresenter, FragmentStartCollectTraceBinding> { | 26 | public class StartTraceFragment extends QMUIFragment<StartTraceFragmentView, StartTraceFragmentPresenter, FragmentStartCollectTraceBinding> { |
| @@ -35,6 +45,7 @@ public class StartTraceFragment extends QMUIFragment<StartTraceFragmentView, Sta | @@ -35,6 +45,7 @@ public class StartTraceFragment extends QMUIFragment<StartTraceFragmentView, Sta | ||
| 35 | @Override | 45 | @Override |
| 36 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | 46 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 37 | super.onViewCreated(view, savedInstanceState); | 47 | super.onViewCreated(view, savedInstanceState); |
| 48 | + EventBus.getDefault().register(this); | ||
| 38 | mSensorManager = (SensorManager) getActivity().getSystemService(SENSOR_SERVICE);//获取传感器管理服务 | 49 | mSensorManager = (SensorManager) getActivity().getSystemService(SENSOR_SERVICE);//获取传感器管理服务 |
| 39 | 50 | ||
| 40 | if (getMvpView() != null) { | 51 | if (getMvpView() != null) { |
| @@ -68,6 +79,9 @@ public class StartTraceFragment extends QMUIFragment<StartTraceFragmentView, Sta | @@ -68,6 +79,9 @@ public class StartTraceFragment extends QMUIFragment<StartTraceFragmentView, Sta | ||
| 68 | if (getMvpView() != null) { | 79 | if (getMvpView() != null) { |
| 69 | getMvpView().onDestroy(); | 80 | getMvpView().onDestroy(); |
| 70 | } | 81 | } |
| 82 | + if (EventBus.getDefault().isRegistered(this)) { | ||
| 83 | + EventBus.getDefault().unregister(this); | ||
| 84 | + } | ||
| 71 | } | 85 | } |
| 72 | 86 | ||
| 73 | /** | 87 | /** |
| @@ -81,4 +95,22 @@ public class StartTraceFragment extends QMUIFragment<StartTraceFragmentView, Sta | @@ -81,4 +95,22 @@ public class StartTraceFragment extends QMUIFragment<StartTraceFragmentView, Sta | ||
| 81 | return 0; | 95 | return 0; |
| 82 | 96 | ||
| 83 | } | 97 | } |
| 98 | + | ||
| 99 | + @Subscribe(threadMode = ThreadMode.MAIN) | ||
| 100 | + public void Event(MessageEvent messageEvent) { | ||
| 101 | + //启动鹰眼成功 | ||
| 102 | + if (messageEvent.getMessageType() == Constant.COLL_START_TRACE_GATHER_SUCCESS) { | ||
| 103 | + if (getMvpView() != null) { | ||
| 104 | + QMUITipDialogUtil.dismessDialog(); | ||
| 105 | + CollPedometerMainActivity.startActivity(getActivity()); | ||
| 106 | + } | ||
| 107 | + } | ||
| 108 | + //启动鹰眼失败 | ||
| 109 | + else if (messageEvent.getMessageType() == Constant.COLL_START_TRACE_GATHER_FAIL) { | ||
| 110 | + if (getMvpView() != null) { | ||
| 111 | + QMUITipDialogUtil.dismessDialog(); | ||
| 112 | + QMUITipDialogUtil.textDialog(getContext(), "服务异常,请重试!", 1); | ||
| 113 | + } | ||
| 114 | + } | ||
| 115 | + } | ||
| 84 | } | 116 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/commonInfo/CollCommonInfo.java
| @@ -135,6 +135,26 @@ public class CollCommonInfo { | @@ -135,6 +135,26 @@ public class CollCommonInfo { | ||
| 135 | return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getBoolean("CollRunBaiduTraceService", false); | 135 | return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getBoolean("CollRunBaiduTraceService", false); |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | + /** | ||
| 139 | + * 是否是第一次启动鹰眼服务的通知 | ||
| 140 | + * | ||
| 141 | + * @param context | ||
| 142 | + * @param isAllow | ||
| 143 | + */ | ||
| 144 | + public static void setIsFirstStepSendTraceTip(Context context, boolean isAllow) { | ||
| 145 | + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).putBoolean("CollFirstStepSendTraceTip", isAllow); | ||
| 146 | + } | ||
| 147 | + | ||
| 148 | + /** | ||
| 149 | + * 是否是第一次启动鹰眼服务的通知 | ||
| 150 | + * 默认返回true | ||
| 151 | + * | ||
| 152 | + * @param context | ||
| 153 | + */ | ||
| 154 | + public static boolean getIsFirstStepSendTraceTip(Context context) { | ||
| 155 | + return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getBoolean("CollFirstStepSendTraceTip", true); | ||
| 156 | + } | ||
| 157 | + | ||
| 138 | /*重置 | 158 | /*重置 |
| 139 | * @param context | 159 | * @param context |
| 140 | */ | 160 | */ |
| @@ -146,7 +166,7 @@ public class CollCommonInfo { | @@ -146,7 +166,7 @@ public class CollCommonInfo { | ||
| 146 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("CollKeepAliveService"); | 166 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("CollKeepAliveService"); |
| 147 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("CollRunBaiduTraceService"); | 167 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("CollRunBaiduTraceService"); |
| 148 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("CollstreetId"); | 168 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("CollstreetId"); |
| 149 | - | 169 | + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("CollFirstStepSendTraceTip"); |
| 150 | } | 170 | } |
| 151 | 171 | ||
| 152 | 172 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/commonInfo/CommonInfo.java
| @@ -136,6 +136,26 @@ public class CommonInfo { | @@ -136,6 +136,26 @@ public class CommonInfo { | ||
| 136 | return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getBoolean("RunBaiduTraceService", false); | 136 | return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getBoolean("RunBaiduTraceService", false); |
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | + /** | ||
| 140 | + * 是否是第一次启动鹰眼服务的通知 | ||
| 141 | + * | ||
| 142 | + * @param context | ||
| 143 | + * @param isAllow | ||
| 144 | + */ | ||
| 145 | + public static void setIsFirstStepSendTraceTip(Context context, boolean isAllow) { | ||
| 146 | + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).putBoolean("FirstStepSendTraceTip", isAllow); | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + /** | ||
| 150 | + * 是否是第一次启动鹰眼服务的通知 | ||
| 151 | + * 默认返回true | ||
| 152 | + * | ||
| 153 | + * @param context | ||
| 154 | + */ | ||
| 155 | + public static boolean getIsFirstStepSendTraceTip(Context context) { | ||
| 156 | + return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getBoolean("FirstStepSendTraceTip", true); | ||
| 157 | + } | ||
| 158 | + | ||
| 139 | /*重置 | 159 | /*重置 |
| 140 | * @param context | 160 | * @param context |
| 141 | */ | 161 | */ |
| @@ -147,7 +167,7 @@ public class CommonInfo { | @@ -147,7 +167,7 @@ public class CommonInfo { | ||
| 147 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("KeepAliveService"); | 167 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("KeepAliveService"); |
| 148 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("RunBaiduTraceService"); | 168 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("RunBaiduTraceService"); |
| 149 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("streetId"); | 169 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("streetId"); |
| 150 | - | 170 | + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("FirstStepSendTraceTip"); |
| 151 | } | 171 | } |
| 152 | 172 | ||
| 153 | 173 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunMainFragmentView.java
| @@ -156,8 +156,6 @@ public class RunMainFragmentView implements MvpView { | @@ -156,8 +156,6 @@ public class RunMainFragmentView implements MvpView { | ||
| 156 | } | 156 | } |
| 157 | } | 157 | } |
| 158 | }, 10); | 158 | }, 10); |
| 159 | - //开启计步服务 | ||
| 160 | - startStepService(getContext(), uid); | ||
| 161 | } | 159 | } |
| 162 | } | 160 | } |
| 163 | }; | 161 | }; |
| @@ -460,23 +458,7 @@ public class RunMainFragmentView implements MvpView { | @@ -460,23 +458,7 @@ public class RunMainFragmentView implements MvpView { | ||
| 460 | } | 458 | } |
| 461 | } | 459 | } |
| 462 | 460 | ||
| 463 | - /** | ||
| 464 | - * 启动计步服务 | ||
| 465 | - * | ||
| 466 | - * @param userId | ||
| 467 | - */ | ||
| 468 | - public void startStepService(Context context, String userId) { | ||
| 469 | - if (CommonInfo.getStepStartTime(context) == 0) { | ||
| 470 | - CommonInfo.setStepStartTime(context, TimeUtil.getNowTimeStamp()); | ||
| 471 | - } | ||
| 472 | - CommonInfo.setIsRunKeepAliveService(context, true); | ||
| 473 | - CommonInfo.setIsRunStepService(context, true); | ||
| 474 | - CommonInfo.setTsRunBaiduTraceService(context, true); | ||
| 475 | - CommonInfo.setIsWriteUserStep(context, true); | ||
| 476 | - Intent intent = new Intent(fragment.getActivity(), KeepLiveService.class); | ||
| 477 | - ContextCompat.startForegroundService(fragment.getActivity(), intent); | ||
| 478 | 461 | ||
| 479 | - } | ||
| 480 | 462 | ||
| 481 | /** | 463 | /** |
| 482 | * 更新行走距离 | 464 | * 更新行走距离 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunRaceDetailFragmentView.java
| @@ -8,6 +8,7 @@ import android.hardware.Sensor; | @@ -8,6 +8,7 @@ import android.hardware.Sensor; | ||
| 8 | import android.hardware.SensorEvent; | 8 | import android.hardware.SensorEvent; |
| 9 | import android.hardware.SensorEventListener; | 9 | import android.hardware.SensorEventListener; |
| 10 | import android.hardware.SensorManager; | 10 | import android.hardware.SensorManager; |
| 11 | +import android.support.v4.content.ContextCompat; | ||
| 11 | import android.text.TextUtils; | 12 | import android.text.TextUtils; |
| 12 | import android.util.Log; | 13 | import android.util.Log; |
| 13 | import android.view.View; | 14 | import android.view.View; |
| @@ -45,7 +46,9 @@ import com.baidu.mapapi.search.route.WalkingRoutePlanOption; | @@ -45,7 +46,9 @@ import com.baidu.mapapi.search.route.WalkingRoutePlanOption; | ||
| 45 | import com.baidu.mapapi.search.route.WalkingRouteResult; | 46 | import com.baidu.mapapi.search.route.WalkingRouteResult; |
| 46 | import com.baidu.mapapi.utils.DistanceUtil; | 47 | import com.baidu.mapapi.utils.DistanceUtil; |
| 47 | import com.baidu.trace.model.SortType; | 48 | import com.baidu.trace.model.SortType; |
| 49 | +import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | ||
| 48 | import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; | 50 | import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; |
| 51 | +import com.cnlive.moudle.pedometer.service.KeepLiveService; | ||
| 49 | import com.cnlive.moudle.pedometer.ui.activity.PedometerMainActivity; | 52 | import com.cnlive.moudle.pedometer.ui.activity.PedometerMainActivity; |
| 50 | import com.cnlive.moudle.pedometer.ui.activity.RaceRecordActivity; | 53 | import com.cnlive.moudle.pedometer.ui.activity.RaceRecordActivity; |
| 51 | import com.cnlive.moudle.pedometer.ui.activity.RegistrationInfoActivity; | 54 | import com.cnlive.moudle.pedometer.ui.activity.RegistrationInfoActivity; |
| @@ -101,7 +104,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -101,7 +104,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 101 | 104 | ||
| 102 | private String startPoint = "首都师范大学南门"; | 105 | private String startPoint = "首都师范大学南门"; |
| 103 | private String endPoint = "首都师范大学篮球场"; | 106 | private String endPoint = "首都师范大学篮球场"; |
| 104 | -// private String test = "[{\"latitude\":39.933889208848,\"latitudeE6\":3.9933889208848E7,\"longitude\":116.30900265517,\"longitudeE6\":1.1630900265517001E8},{\"latitude\":39.933868507347,\"latitudeE6\":3.9933868507347E7,\"longitude\":116.30865416508,\"longitudeE6\":1.1630865416508E8},{\"latitude\":39.934756505077,\"latitudeE6\":3.9934756505077E7,\"longitude\":116.30860516469,\"longitudeE6\":1.1630860516468999E8},{\"latitude\":39.934781620502,\"latitudeE6\":3.9934781620502E7,\"longitude\":116.30961013007,\"longitudeE6\":1.1630961013007E8},{\"latitude\":39.934881620374,\"latitudeE6\":3.9934881620374E7,\"longitude\":116.30960513008,\"longitudeE6\":1.1630960513008E8},{\"latitude\":39.934077623132,\"latitudeE6\":3.9934077623132E7,\"longitude\":116.30965812942,\"longitudeE6\":1.1630965812942E8},{\"latitude\":39.933972618463,\"latitudeE6\":3.9933972618463E7,\"longitude\":116.30962113087,\"longitudeE6\":1.1630962113087E8},{\"latitude\":39.933932608856,\"latitudeE6\":3.9933932608856E7,\"longitude\":116.30953913383,\"longitudeE6\":1.1630953913383E8}]"; | 107 | + // private String test = "[{\"latitude\":39.933889208848,\"latitudeE6\":3.9933889208848E7,\"longitude\":116.30900265517,\"longitudeE6\":1.1630900265517001E8},{\"latitude\":39.933868507347,\"latitudeE6\":3.9933868507347E7,\"longitude\":116.30865416508,\"longitudeE6\":1.1630865416508E8},{\"latitude\":39.934756505077,\"latitudeE6\":3.9934756505077E7,\"longitude\":116.30860516469,\"longitudeE6\":1.1630860516468999E8},{\"latitude\":39.934781620502,\"latitudeE6\":3.9934781620502E7,\"longitude\":116.30961013007,\"longitudeE6\":1.1630961013007E8},{\"latitude\":39.934881620374,\"latitudeE6\":3.9934881620374E7,\"longitude\":116.30960513008,\"longitudeE6\":1.1630960513008E8},{\"latitude\":39.934077623132,\"latitudeE6\":3.9934077623132E7,\"longitude\":116.30965812942,\"longitudeE6\":1.1630965812942E8},{\"latitude\":39.933972618463,\"latitudeE6\":3.9933972618463E7,\"longitude\":116.30962113087,\"longitudeE6\":1.1630962113087E8},{\"latitude\":39.933932608856,\"latitudeE6\":3.9933932608856E7,\"longitude\":116.30953913383,\"longitudeE6\":1.1630953913383E8}]"; |
| 105 | private LinkedList<LatLng> importLatLngs;//关键点 | 108 | private LinkedList<LatLng> importLatLngs;//关键点 |
| 106 | private LatLng startLatLng = new LatLng(39.934733, 116.308646);//起始点 | 109 | private LatLng startLatLng = new LatLng(39.934733, 116.308646);//起始点 |
| 107 | private List<LatLng> trackPoints; | 110 | private List<LatLng> trackPoints; |
| @@ -198,7 +201,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -198,7 +201,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 198 | fragment.binding.includeStreet.tvAddress.setText(runRaceDetailInfo.getAddress()); | 201 | fragment.binding.includeStreet.tvAddress.setText(runRaceDetailInfo.getAddress()); |
| 199 | //设置活动距离 | 202 | //设置活动距离 |
| 200 | if (!TextUtils.isEmpty(runRaceDetailInfo.getMileage())) { | 203 | if (!TextUtils.isEmpty(runRaceDetailInfo.getMileage())) { |
| 201 | - fragment.binding.includeStreet.tvAddress.append("\t\t"+runRaceDetailInfo.getMileage()); | 204 | + fragment.binding.includeStreet.tvAddress.append("\t\t" + runRaceDetailInfo.getMileage()); |
| 202 | } | 205 | } |
| 203 | } | 206 | } |
| 204 | 207 | ||
| @@ -228,7 +231,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -228,7 +231,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 228 | fragment.binding.includeStreet.tvActiveEndTime.setText(TimeUtil.getStampToTime(runRaceDetailInfo.getEnd_time(), "yyyy-MM-dd")); | 231 | fragment.binding.includeStreet.tvActiveEndTime.setText(TimeUtil.getStampToTime(runRaceDetailInfo.getEnd_time(), "yyyy-MM-dd")); |
| 229 | } | 232 | } |
| 230 | //设置活动类型 | 233 | //设置活动类型 |
| 231 | - if (!TextUtils.isEmpty(runRaceDetailInfo.getEventType())){ | 234 | + if (!TextUtils.isEmpty(runRaceDetailInfo.getEventType())) { |
| 232 | fragment.binding.includeStreet.tvEventType.setText(runRaceDetailInfo.getEventType()); | 235 | fragment.binding.includeStreet.tvEventType.setText(runRaceDetailInfo.getEventType()); |
| 233 | } | 236 | } |
| 234 | //设置参加人数 | 237 | //设置参加人数 |
| @@ -248,7 +251,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -248,7 +251,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 248 | //显示 | 251 | //显示 |
| 249 | fragment.binding.includePersonScore.llPersonScoreRoot.setVisibility(View.VISIBLE); | 252 | fragment.binding.includePersonScore.llPersonScoreRoot.setVisibility(View.VISIBLE); |
| 250 | //设置完成人数 | 253 | //设置完成人数 |
| 251 | - if (!TextUtils.isEmpty(runRaceDetailInfo.getFinishNum())){ | 254 | + if (!TextUtils.isEmpty(runRaceDetailInfo.getFinishNum())) { |
| 252 | fragment.binding.includeRank.tvFinishPerson.setText(runRaceDetailInfo.getFinishNum()); | 255 | fragment.binding.includeRank.tvFinishPerson.setText(runRaceDetailInfo.getFinishNum()); |
| 253 | } | 256 | } |
| 254 | //设置个人行走距离 | 257 | //设置个人行走距离 |
| @@ -290,7 +293,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -290,7 +293,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 290 | 293 | ||
| 291 | } | 294 | } |
| 292 | //设置路线描述 | 295 | //设置路线描述 |
| 293 | - if (!TextUtils.isEmpty(runRaceDetailInfo.getDescription())){ | 296 | + if (!TextUtils.isEmpty(runRaceDetailInfo.getDescription())) { |
| 294 | fragment.binding.includeStreetIntroduce.tvStreetIntroduce.setText(runRaceDetailInfo.getDescription()); | 297 | fragment.binding.includeStreetIntroduce.tvStreetIntroduce.setText(runRaceDetailInfo.getDescription()); |
| 295 | } | 298 | } |
| 296 | //设置路线介绍的图片 | 299 | //设置路线介绍的图片 |
| @@ -300,11 +303,11 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -300,11 +303,11 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 300 | 303 | ||
| 301 | } | 304 | } |
| 302 | //判断用户是否报名 | 305 | //判断用户是否报名 |
| 303 | - if (runRaceDetailInfo.isSignResult()){ | 306 | + if (runRaceDetailInfo.isSignResult()) { |
| 304 | fragment.binding.rlScrollViewStartBtn.setTag("1"); | 307 | fragment.binding.rlScrollViewStartBtn.setTag("1"); |
| 305 | fragment.binding.tvRunNow.setText("现在开始"); | 308 | fragment.binding.tvRunNow.setText("现在开始"); |
| 306 | fragment.binding.tvGoTip.setVisibility(View.VISIBLE); | 309 | fragment.binding.tvGoTip.setVisibility(View.VISIBLE); |
| 307 | - }else { | 310 | + } else { |
| 308 | fragment.binding.rlScrollViewStartBtn.setTag("0"); | 311 | fragment.binding.rlScrollViewStartBtn.setTag("0"); |
| 309 | fragment.binding.tvRunNow.setText("立即报名"); | 312 | fragment.binding.tvRunNow.setText("立即报名"); |
| 310 | fragment.binding.tvGoTip.setVisibility(View.GONE); | 313 | fragment.binding.tvGoTip.setVisibility(View.GONE); |
| @@ -376,19 +379,18 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -376,19 +379,18 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 376 | fragment.binding.rlScrollViewStartBtn.setTag("0"); | 379 | fragment.binding.rlScrollViewStartBtn.setTag("0"); |
| 377 | fragment.binding.tvRunNow.setText("立即报名"); | 380 | fragment.binding.tvRunNow.setText("立即报名"); |
| 378 | fragment.binding.tvGoTip.setVisibility(View.GONE); | 381 | fragment.binding.tvGoTip.setVisibility(View.GONE); |
| 379 | - fragment.getActivity().startActivity(new Intent(getContext(), PedometerMainActivity.class)); | 382 | + startStepService(getContext()); |
| 380 | //设置未滑动 | 383 | //设置未滑动 |
| 381 | fragment.binding.includeStreet.rlStartBtn.setTag("0"); | 384 | fragment.binding.includeStreet.rlStartBtn.setTag("0"); |
| 382 | fragment.binding.includeStreet.tvRunNow.setText("立即报名"); | 385 | fragment.binding.includeStreet.tvRunNow.setText("立即报名"); |
| 383 | fragment.binding.includeStreet.tvGoTip.setVisibility(View.GONE); | 386 | fragment.binding.includeStreet.tvGoTip.setVisibility(View.GONE); |
| 384 | - fragment.getActivity().startActivity(new Intent(getContext(), PedometerMainActivity.class)); | ||
| 385 | 387 | ||
| 386 | } | 388 | } |
| 387 | } | 389 | } |
| 388 | }); | 390 | }); |
| 389 | //查看全部成绩点击事件 | 391 | //查看全部成绩点击事件 |
| 390 | fragment.binding.includePersonScore.checkAllCord.setOnClickListener(v -> { | 392 | fragment.binding.includePersonScore.checkAllCord.setOnClickListener(v -> { |
| 391 | - RaceRecordActivity.newInstance(fragment.getActivity(),runRaceDetailInfo.getTitle()); | 393 | + RaceRecordActivity.newInstance(fragment.getActivity(), runRaceDetailInfo.getTitle()); |
| 392 | }); | 394 | }); |
| 393 | 395 | ||
| 394 | fragment.binding.includeStreet.fiveJoinPerson.setOnClickListener(v -> { | 396 | fragment.binding.includeStreet.fiveJoinPerson.setOnClickListener(v -> { |
| @@ -407,15 +409,8 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -407,15 +409,8 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 407 | } | 409 | } |
| 408 | 410 | ||
| 409 | public void initMap() { | 411 | public void initMap() { |
| 410 | - List<String> icons = new ArrayList<>(); | ||
| 411 | - icons.add("http://yweb0.cnliveimg.com/images/headImg/2019/0505/1557039035723_small.jpg"); | ||
| 412 | - icons.add("http://yweb0.cnliveimg.com/images/headImg/2019/0505/1557034319038_small.jpg"); | ||
| 413 | - icons.add("http://yweb0.cnliveimg.com/images/headImg/2018/0902/1535858459612_small.jpg"); | ||
| 414 | - icons.add("http://yweb0.cnliveimg.com/images/headImg/2019/0523/1558599016203_small.jpg"); | ||
| 415 | - icons.add("http://yweb0.cnliveimg.com/images/headImg/2019/0505/1557039035723_small.jpg"); | ||
| 416 | //隐藏底部滑动卡片 | 412 | //隐藏底部滑动卡片 |
| 417 | fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN); | 413 | fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN); |
| 418 | - fragment.binding.includeStreet.fiveJoinPerson.initIconData(icons); | ||
| 419 | this.mMapView = fragment.binding.mapView; | 414 | this.mMapView = fragment.binding.mapView; |
| 420 | if (baiduMap == null) { | 415 | if (baiduMap == null) { |
| 421 | baiduMap = mMapView.getMap(); | 416 | baiduMap = mMapView.getMap(); |
| @@ -863,4 +858,22 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -863,4 +858,22 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 863 | fragment.binding.emptyLayout.show(false, titleText, detailText, getContext().getString(R.string.retry), R.drawable.wufalianjie, listener); | 858 | fragment.binding.emptyLayout.show(false, titleText, detailText, getContext().getString(R.string.retry), R.drawable.wufalianjie, listener); |
| 864 | } | 859 | } |
| 865 | 860 | ||
| 861 | + | ||
| 862 | + /** | ||
| 863 | + * 启动计步服务 | ||
| 864 | + * | ||
| 865 | + */ | ||
| 866 | + public void startStepService(Context context) { | ||
| 867 | + if (CommonInfo.getStepStartTime(context) == 0) { | ||
| 868 | + CommonInfo.setStepStartTime(context, TimeUtil.getNowTimeStamp()); | ||
| 869 | + } | ||
| 870 | + CommonInfo.setIsRunKeepAliveService(context, true); | ||
| 871 | + CommonInfo.setIsRunStepService(context, true); | ||
| 872 | + CommonInfo.setTsRunBaiduTraceService(context, true); | ||
| 873 | + CommonInfo.setIsWriteUserStep(context, true); | ||
| 874 | + Intent intent = new Intent(fragment.getActivity(), KeepLiveService.class); | ||
| 875 | + ContextCompat.startForegroundService(fragment.getActivity(), intent); | ||
| 876 | + | ||
| 877 | + } | ||
| 878 | + | ||
| 866 | } | 879 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/model/Constant.java
| @@ -8,5 +8,9 @@ public class Constant { | @@ -8,5 +8,9 @@ public class Constant { | ||
| 8 | public static final int FRAGMENT_RUN_CHRONOMETER = 4;//同步计时器 | 8 | public static final int FRAGMENT_RUN_CHRONOMETER = 4;//同步计时器 |
| 9 | public static final int EXIT_RANGE = 5;//超出范围 | 9 | public static final int EXIT_RANGE = 5;//超出范围 |
| 10 | public static final int ENTER_RANGE = 6;//进入范围 | 10 | public static final int ENTER_RANGE = 6;//进入范围 |
| 11 | + public static final int COLL_START_TRACE_GATHER_SUCCESS = 7;//启动轨迹服务成功(运营) | ||
| 12 | + public static final int COLL_START_TRACE_GATHER_FAIL = 8;//启动轨迹服务失败(运营) | ||
| 13 | + public static final int START_TRACE_GATHER_SUCCESS = 9;//启动轨迹服务成功(用户) | ||
| 14 | + public static final int START_TRACE_GATHER_FAIL = 10;//启动轨迹服务失败(用户) | ||
| 11 | 15 | ||
| 12 | } | 16 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/service/KeepLiveService.java
| @@ -221,7 +221,6 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion | @@ -221,7 +221,6 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion | ||
| 221 | @Override | 221 | @Override |
| 222 | public void onDestroy() { | 222 | public void onDestroy() { |
| 223 | super.onDestroy(); | 223 | super.onDestroy(); |
| 224 | - Log.e("onDestroy", "onDestroy:" + notification); | ||
| 225 | if (myReceiver != null) { | 224 | if (myReceiver != null) { |
| 226 | unregisterReceiver(myReceiver); | 225 | unregisterReceiver(myReceiver); |
| 227 | } | 226 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/service/StepService.java
| @@ -37,6 +37,7 @@ import com.baidu.trace.model.LocationMode; | @@ -37,6 +37,7 @@ import com.baidu.trace.model.LocationMode; | ||
| 37 | import com.baidu.trace.model.OnTraceListener; | 37 | import com.baidu.trace.model.OnTraceListener; |
| 38 | import com.baidu.trace.model.PushMessage; | 38 | import com.baidu.trace.model.PushMessage; |
| 39 | import com.baidu.trace.model.StatusCodes; | 39 | import com.baidu.trace.model.StatusCodes; |
| 40 | +import com.cnlive.moudle.pedometer.commonInfo.CollCommonInfo; | ||
| 40 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | 41 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 41 | import com.cnlive.moudle.pedometer.model.Constant; | 42 | import com.cnlive.moudle.pedometer.model.Constant; |
| 42 | import com.cnlive.moudle.pedometer.model.MessageEvent; | 43 | import com.cnlive.moudle.pedometer.model.MessageEvent; |
| @@ -241,6 +242,17 @@ public class StepService extends Service implements SensorEventListener { | @@ -241,6 +242,17 @@ public class StepService extends Service implements SensorEventListener { | ||
| 241 | if (mClient != null) { | 242 | if (mClient != null) { |
| 242 | mClient.startGather(traceListener); | 243 | mClient.startGather(traceListener); |
| 243 | Toast.makeText(getApplicationContext(), "开启轨迹服务", Toast.LENGTH_LONG).show(); | 244 | Toast.makeText(getApplicationContext(), "开启轨迹服务", Toast.LENGTH_LONG).show(); |
| 245 | + boolean isFirstSendNotification = CommonInfo.getIsFirstStepSendTraceTip(getApplicationContext()); | ||
| 246 | + if (isFirstSendNotification) { | ||
| 247 | + CommonInfo.setIsFirstStepSendTraceTip(getApplicationContext(), false); | ||
| 248 | + EventBus.getDefault().post(new MessageEvent(Constant.START_TRACE_GATHER_SUCCESS, "")); | ||
| 249 | + } | ||
| 250 | + } | ||
| 251 | + } else { | ||
| 252 | + boolean isFirstSendNotification = CommonInfo.getIsFirstStepSendTraceTip(getApplicationContext()); | ||
| 253 | + if (isFirstSendNotification) { | ||
| 254 | + CommonInfo.setIsFirstStepSendTraceTip(getApplicationContext(), false); | ||
| 255 | + EventBus.getDefault().post(new MessageEvent(Constant.START_TRACE_GATHER_FAIL, "")); | ||
| 244 | } | 256 | } |
| 245 | } | 257 | } |
| 246 | } | 258 | } |
| @@ -382,6 +394,8 @@ public class StepService extends Service implements SensorEventListener { | @@ -382,6 +394,8 @@ public class StepService extends Service implements SensorEventListener { | ||
| 382 | } | 394 | } |
| 383 | }).start(); | 395 | }).start(); |
| 384 | startTimeCount(); | 396 | startTimeCount(); |
| 397 | + } else { | ||
| 398 | + EventBus.getDefault().post(new MessageEvent(Constant.START_TRACE_GATHER_FAIL, "")); | ||
| 385 | } | 399 | } |
| 386 | // if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { | 400 | // if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { |
| 387 | // //开始配置JobInfo | 401 | // //开始配置JobInfo |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/sql/dao/DaoMaster.java
| @@ -21,14 +21,14 @@ public class DaoMaster extends AbstractDaoMaster { | @@ -21,14 +21,14 @@ public class DaoMaster extends AbstractDaoMaster { | ||
| 21 | 21 | ||
| 22 | /** Creates underlying database table using DAOs. */ | 22 | /** Creates underlying database table using DAOs. */ |
| 23 | public static void createAllTables(Database db, boolean ifNotExists) { | 23 | public static void createAllTables(Database db, boolean ifNotExists) { |
| 24 | - UserStepEntityDao.createTable(db, ifNotExists); | ||
| 25 | CollUserStepEntityDao.createTable(db, ifNotExists); | 24 | CollUserStepEntityDao.createTable(db, ifNotExists); |
| 25 | + UserStepEntityDao.createTable(db, ifNotExists); | ||
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | /** Drops underlying database table using DAOs. */ | 28 | /** Drops underlying database table using DAOs. */ |
| 29 | public static void dropAllTables(Database db, boolean ifExists) { | 29 | public static void dropAllTables(Database db, boolean ifExists) { |
| 30 | - UserStepEntityDao.dropTable(db, ifExists); | ||
| 31 | CollUserStepEntityDao.dropTable(db, ifExists); | 30 | CollUserStepEntityDao.dropTable(db, ifExists); |
| 31 | + UserStepEntityDao.dropTable(db, ifExists); | ||
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | /** | 34 | /** |
| @@ -47,8 +47,8 @@ public class DaoMaster extends AbstractDaoMaster { | @@ -47,8 +47,8 @@ public class DaoMaster extends AbstractDaoMaster { | ||
| 47 | 47 | ||
| 48 | public DaoMaster(Database db) { | 48 | public DaoMaster(Database db) { |
| 49 | super(db, SCHEMA_VERSION); | 49 | super(db, SCHEMA_VERSION); |
| 50 | - registerDaoClass(UserStepEntityDao.class); | ||
| 51 | registerDaoClass(CollUserStepEntityDao.class); | 50 | registerDaoClass(CollUserStepEntityDao.class); |
| 51 | + registerDaoClass(UserStepEntityDao.class); | ||
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | public DaoSession newSession() { | 54 | public DaoSession newSession() { |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/sql/dao/DaoSession.java
| @@ -8,11 +8,11 @@ import org.greenrobot.greendao.database.Database; | @@ -8,11 +8,11 @@ import org.greenrobot.greendao.database.Database; | ||
| 8 | import org.greenrobot.greendao.identityscope.IdentityScopeType; | 8 | import org.greenrobot.greendao.identityscope.IdentityScopeType; |
| 9 | import org.greenrobot.greendao.internal.DaoConfig; | 9 | import org.greenrobot.greendao.internal.DaoConfig; |
| 10 | 10 | ||
| 11 | -import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; | ||
| 12 | import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity; | 11 | import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity; |
| 12 | +import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; | ||
| 13 | 13 | ||
| 14 | -import com.cnlive.moudle.pedometer.sql.dao.UserStepEntityDao; | ||
| 15 | import com.cnlive.moudle.pedometer.sql.dao.CollUserStepEntityDao; | 14 | import com.cnlive.moudle.pedometer.sql.dao.CollUserStepEntityDao; |
| 15 | +import com.cnlive.moudle.pedometer.sql.dao.UserStepEntityDao; | ||
| 16 | 16 | ||
| 17 | // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. | 17 | // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. |
| 18 | 18 | ||
| @@ -23,40 +23,40 @@ import com.cnlive.moudle.pedometer.sql.dao.CollUserStepEntityDao; | @@ -23,40 +23,40 @@ import com.cnlive.moudle.pedometer.sql.dao.CollUserStepEntityDao; | ||
| 23 | */ | 23 | */ |
| 24 | public class DaoSession extends AbstractDaoSession { | 24 | public class DaoSession extends AbstractDaoSession { |
| 25 | 25 | ||
| 26 | - private final DaoConfig userStepEntityDaoConfig; | ||
| 27 | private final DaoConfig collUserStepEntityDaoConfig; | 26 | private final DaoConfig collUserStepEntityDaoConfig; |
| 27 | + private final DaoConfig userStepEntityDaoConfig; | ||
| 28 | 28 | ||
| 29 | - private final UserStepEntityDao userStepEntityDao; | ||
| 30 | private final CollUserStepEntityDao collUserStepEntityDao; | 29 | private final CollUserStepEntityDao collUserStepEntityDao; |
| 30 | + private final UserStepEntityDao userStepEntityDao; | ||
| 31 | 31 | ||
| 32 | public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig> | 32 | public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig> |
| 33 | daoConfigMap) { | 33 | daoConfigMap) { |
| 34 | super(db); | 34 | super(db); |
| 35 | 35 | ||
| 36 | - userStepEntityDaoConfig = daoConfigMap.get(UserStepEntityDao.class).clone(); | ||
| 37 | - userStepEntityDaoConfig.initIdentityScope(type); | ||
| 38 | - | ||
| 39 | collUserStepEntityDaoConfig = daoConfigMap.get(CollUserStepEntityDao.class).clone(); | 36 | collUserStepEntityDaoConfig = daoConfigMap.get(CollUserStepEntityDao.class).clone(); |
| 40 | collUserStepEntityDaoConfig.initIdentityScope(type); | 37 | collUserStepEntityDaoConfig.initIdentityScope(type); |
| 41 | 38 | ||
| 42 | - userStepEntityDao = new UserStepEntityDao(userStepEntityDaoConfig, this); | 39 | + userStepEntityDaoConfig = daoConfigMap.get(UserStepEntityDao.class).clone(); |
| 40 | + userStepEntityDaoConfig.initIdentityScope(type); | ||
| 41 | + | ||
| 43 | collUserStepEntityDao = new CollUserStepEntityDao(collUserStepEntityDaoConfig, this); | 42 | collUserStepEntityDao = new CollUserStepEntityDao(collUserStepEntityDaoConfig, this); |
| 43 | + userStepEntityDao = new UserStepEntityDao(userStepEntityDaoConfig, this); | ||
| 44 | 44 | ||
| 45 | - registerDao(UserStepEntity.class, userStepEntityDao); | ||
| 46 | registerDao(CollUserStepEntity.class, collUserStepEntityDao); | 45 | registerDao(CollUserStepEntity.class, collUserStepEntityDao); |
| 46 | + registerDao(UserStepEntity.class, userStepEntityDao); | ||
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | public void clear() { | 49 | public void clear() { |
| 50 | - userStepEntityDaoConfig.clearIdentityScope(); | ||
| 51 | collUserStepEntityDaoConfig.clearIdentityScope(); | 50 | collUserStepEntityDaoConfig.clearIdentityScope(); |
| 52 | - } | ||
| 53 | - | ||
| 54 | - public UserStepEntityDao getUserStepEntityDao() { | ||
| 55 | - return userStepEntityDao; | 51 | + userStepEntityDaoConfig.clearIdentityScope(); |
| 56 | } | 52 | } |
| 57 | 53 | ||
| 58 | public CollUserStepEntityDao getCollUserStepEntityDao() { | 54 | public CollUserStepEntityDao getCollUserStepEntityDao() { |
| 59 | return collUserStepEntityDao; | 55 | return collUserStepEntityDao; |
| 60 | } | 56 | } |
| 61 | 57 | ||
| 58 | + public UserStepEntityDao getUserStepEntityDao() { | ||
| 59 | + return userStepEntityDao; | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | } | 62 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/PedometerMainActivity.java
| @@ -24,6 +24,7 @@ import com.cnlive.libs.base.ui.QMUIFragment; | @@ -24,6 +24,7 @@ import com.cnlive.libs.base.ui.QMUIFragment; | ||
| 24 | import com.cnlive.libs.base.ui.QMUIFragmentActivity; | 24 | import com.cnlive.libs.base.ui.QMUIFragmentActivity; |
| 25 | import com.cnlive.libs.base.util.StatusBarUtil; | 25 | import com.cnlive.libs.base.util.StatusBarUtil; |
| 26 | import com.cnlive.libs.base.util.StatusBarUtil2; | 26 | import com.cnlive.libs.base.util.StatusBarUtil2; |
| 27 | +import com.cnlive.moudle.collectionTrace.ui.activity.CollPedometerMainActivity; | ||
| 27 | import com.cnlive.moudle.pedometer.ui.fragment.RunMainFragment; | 28 | import com.cnlive.moudle.pedometer.ui.fragment.RunMainFragment; |
| 28 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; | 29 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; |
| 29 | import com.cnlive.moudle.pedometer.utils.lib_permisshelper.PermissionsListener; | 30 | import com.cnlive.moudle.pedometer.utils.lib_permisshelper.PermissionsListener; |
| @@ -137,19 +138,7 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | @@ -137,19 +138,7 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | ||
| 137 | 138 | ||
| 138 | super.onResume(); | 139 | super.onResume(); |
| 139 | check(); | 140 | check(); |
| 140 | -// PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE); | ||
| 141 | - | ||
| 142 | -// if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) { | ||
| 143 | -// boolean hasIgnored = powerManager.isIgnoringBatteryOptimizations(getPackageName()); | ||
| 144 | -// if (!hasIgnored) { | ||
| 145 | -// Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); | ||
| 146 | -// intent.setData(Uri.parse("package:" + getPackageName())); | ||
| 147 | -// PackageManager pm = getPackageManager(); | ||
| 148 | -// if (intent.resolveActivity(pm) != null) { | ||
| 149 | -// startActivity(intent); | ||
| 150 | -// } | ||
| 151 | -// } | ||
| 152 | -// } | 141 | +// |
| 153 | getPermissionsWithTip(); | 142 | getPermissionsWithTip(); |
| 154 | } | 143 | } |
| 155 | 144 | ||
| @@ -184,7 +173,9 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | @@ -184,7 +173,9 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | ||
| 184 | startActivityForResult(intent, 10); | 173 | startActivityForResult(intent, 10); |
| 185 | Toast.makeText(getApplicationContext(), getString(R.string.open_gps_tip), Toast.LENGTH_LONG).show(); | 174 | Toast.makeText(getApplicationContext(), getString(R.string.open_gps_tip), Toast.LENGTH_LONG).show(); |
| 186 | } else { | 175 | } else { |
| 187 | - addFragment(); | 176 | + if (getCurrentFragment() == null) { |
| 177 | + addFragment(); | ||
| 178 | + } | ||
| 188 | } | 179 | } |
| 189 | } | 180 | } |
| 190 | }) | 181 | }) |
| @@ -229,4 +220,8 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | @@ -229,4 +220,8 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | ||
| 229 | return; | 220 | return; |
| 230 | } | 221 | } |
| 231 | 222 | ||
| 223 | + public static void startActivity(Activity activity) { | ||
| 224 | + Intent intent = new Intent(activity, PedometerMainActivity.class); | ||
| 225 | + activity.startActivity(intent); | ||
| 226 | + } | ||
| 232 | } | 227 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RunRaceDetailFragment.java
| @@ -15,12 +15,17 @@ import android.widget.LinearLayout; | @@ -15,12 +15,17 @@ import android.widget.LinearLayout; | ||
| 15 | 15 | ||
| 16 | import com.cnlive.libs.base.ui.QMUIFragment; | 16 | import com.cnlive.libs.base.ui.QMUIFragment; |
| 17 | import com.cnlive.libs.base.util.StatusBarUtil2; | 17 | import com.cnlive.libs.base.util.StatusBarUtil2; |
| 18 | +import com.cnlive.moudle.collectionTrace.ui.activity.CollPedometerMainActivity; | ||
| 18 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | 19 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 19 | import com.cnlive.moudle.pedometer.frame.presenter.RunRaceDetailFragmentPresenter; | 20 | import com.cnlive.moudle.pedometer.frame.presenter.RunRaceDetailFragmentPresenter; |
| 20 | import com.cnlive.moudle.pedometer.frame.view.RunRaceDetailFragmentView; | 21 | import com.cnlive.moudle.pedometer.frame.view.RunRaceDetailFragmentView; |
| 22 | +import com.cnlive.moudle.pedometer.model.Constant; | ||
| 23 | +import com.cnlive.moudle.pedometer.model.MessageEvent; | ||
| 21 | import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; | 24 | import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; |
| 25 | +import com.cnlive.moudle.pedometer.ui.activity.PedometerMainActivity; | ||
| 22 | import com.cnlive.moudle.pedometer.ui.widget.FivePersonIconView; | 26 | import com.cnlive.moudle.pedometer.ui.widget.FivePersonIconView; |
| 23 | import com.cnlive.moudle.pedometer.utils.ChineseToSpeechUtil; | 27 | import com.cnlive.moudle.pedometer.utils.ChineseToSpeechUtil; |
| 28 | +import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil; | ||
| 24 | import com.cnlive.moudle.pedometer.utils.ScreenUtil; | 29 | import com.cnlive.moudle.pedometer.utils.ScreenUtil; |
| 25 | import com.cnlive.moudle.pedometer.utils.StepUtil; | 30 | import com.cnlive.moudle.pedometer.utils.StepUtil; |
| 26 | import com.example.moudle_pedometer.R; | 31 | import com.example.moudle_pedometer.R; |
| @@ -29,6 +34,8 @@ import com.qmuiteam.qmui.util.QMUIStatusBarHelper; | @@ -29,6 +34,8 @@ import com.qmuiteam.qmui.util.QMUIStatusBarHelper; | ||
| 29 | import com.sothree.slidinguppanel.SlidingUpPanelLayout; | 34 | import com.sothree.slidinguppanel.SlidingUpPanelLayout; |
| 30 | 35 | ||
| 31 | import org.greenrobot.eventbus.EventBus; | 36 | import org.greenrobot.eventbus.EventBus; |
| 37 | +import org.greenrobot.eventbus.Subscribe; | ||
| 38 | +import org.greenrobot.eventbus.ThreadMode; | ||
| 32 | 39 | ||
| 33 | import java.util.ArrayList; | 40 | import java.util.ArrayList; |
| 34 | import java.util.List; | 41 | import java.util.List; |
| @@ -171,4 +178,22 @@ public class RunRaceDetailFragment extends QMUIFragment<RunRaceDetailFragmentVie | @@ -171,4 +178,22 @@ public class RunRaceDetailFragment extends QMUIFragment<RunRaceDetailFragmentVie | ||
| 171 | // FivePersonIconView fivePersonIconView = view.findViewById(R.id.five_join_person); | 178 | // FivePersonIconView fivePersonIconView = view.findViewById(R.id.five_join_person); |
| 172 | // fivePersonIconView.initIconData(data); | 179 | // fivePersonIconView.initIconData(data); |
| 173 | // } | 180 | // } |
| 181 | + | ||
| 182 | + @Subscribe(threadMode = ThreadMode.MAIN) | ||
| 183 | + public void Event(MessageEvent messageEvent) { | ||
| 184 | + //启动鹰眼成功 | ||
| 185 | + if (messageEvent.getMessageType() == Constant.START_TRACE_GATHER_SUCCESS) { | ||
| 186 | + if (getMvpView() != null) { | ||
| 187 | + QMUITipDialogUtil.dismessDialog(); | ||
| 188 | + PedometerMainActivity.startActivity(getActivity()); | ||
| 189 | + } | ||
| 190 | + } | ||
| 191 | + //启动鹰眼失败 | ||
| 192 | + else if (messageEvent.getMessageType() == Constant.START_TRACE_GATHER_FAIL) { | ||
| 193 | + if (getMvpView() != null) { | ||
| 194 | + QMUITipDialogUtil.dismessDialog(); | ||
| 195 | + QMUITipDialogUtil.textDialog(getContext(), "服务异常,请重试!", 1); | ||
| 196 | + } | ||
| 197 | + } | ||
| 198 | + } | ||
| 174 | } | 199 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/CheckUtil.java
0 → 100644
| 1 | +package com.cnlive.moudle.pedometer.utils; | ||
| 2 | + | ||
| 3 | +import android.app.Activity; | ||
| 4 | +import android.content.Context; | ||
| 5 | +import android.content.Intent; | ||
| 6 | +import android.content.pm.PackageManager; | ||
| 7 | +import android.net.Uri; | ||
| 8 | +import android.os.PowerManager; | ||
| 9 | +import android.provider.Settings; | ||
| 10 | + | ||
| 11 | +import static android.content.Context.POWER_SERVICE; | ||
| 12 | + | ||
| 13 | +public class CheckUtil { | ||
| 14 | + | ||
| 15 | + public static boolean isIgnoringBatteryOptimizationss(Activity context) { | ||
| 16 | + PowerManager powerManager = (PowerManager) context.getSystemService(POWER_SERVICE); | ||
| 17 | + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) { | ||
| 18 | + boolean hasIgnored = powerManager.isIgnoringBatteryOptimizations(context.getPackageName()); | ||
| 19 | + if (!hasIgnored) { | ||
| 20 | + Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); | ||
| 21 | + intent.setData(Uri.parse("package:" + context.getPackageName())); | ||
| 22 | + PackageManager pm = context.getPackageManager(); | ||
| 23 | + if (intent.resolveActivity(pm) != null) { | ||
| 24 | + context.startActivity(intent); | ||
| 25 | + } | ||
| 26 | + return false; | ||
| 27 | + } else { | ||
| 28 | + return true; | ||
| 29 | + } | ||
| 30 | + } | ||
| 31 | + return false; | ||
| 32 | + } | ||
| 33 | +} |
moudle_pedometer/src/main/res/layout/fragment_collect_running_map.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<layout xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 3 | + | ||
| 4 | + <FrameLayout | ||
| 5 | + android:layout_width="match_parent" | ||
| 6 | + android:layout_height="match_parent" | ||
| 7 | + android:orientation="vertical"> | ||
| 8 | + | ||
| 9 | + <com.baidu.mapapi.map.MapView | ||
| 10 | + android:id="@+id/mapView" | ||
| 11 | + android:layout_width="match_parent" | ||
| 12 | + android:layout_height="match_parent"></com.baidu.mapapi.map.MapView> | ||
| 13 | + | ||
| 14 | + <!--地图上面加一层类似于全透明黑色蒙版--> | ||
| 15 | + <LinearLayout | ||
| 16 | + android:layout_width="match_parent" | ||
| 17 | + android:layout_height="match_parent" | ||
| 18 | + android:background="#0D000000" | ||
| 19 | + android:clickable="false" | ||
| 20 | + android:focusable="false" | ||
| 21 | + android:focusableInTouchMode="false"></LinearLayout> | ||
| 22 | + | ||
| 23 | + <FrameLayout | ||
| 24 | + android:id="@+id/fl_back" | ||
| 25 | + android:layout_width="40dp" | ||
| 26 | + android:layout_height="40dp" | ||
| 27 | + android:layout_margin="10dp" | ||
| 28 | + android:background="@drawable/circle_white_shadow_bg" | ||
| 29 | + android:focusable="true"> | ||
| 30 | + | ||
| 31 | + <ImageView | ||
| 32 | + android:layout_width="12dp" | ||
| 33 | + android:layout_height="20dp" | ||
| 34 | + android:layout_gravity="center" | ||
| 35 | + android:layout_marginLeft="-2dp" | ||
| 36 | + android:layout_marginBottom="3dp" | ||
| 37 | + android:background="@drawable/icon_back" | ||
| 38 | + android:focusable="false" /> | ||
| 39 | + </FrameLayout> | ||
| 40 | + | ||
| 41 | + <LinearLayout | ||
| 42 | + android:layout_width="wrap_content" | ||
| 43 | + android:layout_height="wrap_content" | ||
| 44 | + android:layout_gravity="top|right" | ||
| 45 | + android:layout_marginTop="15dp" | ||
| 46 | + android:layout_marginRight="10dp" | ||
| 47 | + android:orientation="vertical"> | ||
| 48 | + | ||
| 49 | + <LinearLayout | ||
| 50 | + android:layout_width="80dp" | ||
| 51 | + android:layout_height="35dp" | ||
| 52 | + android:layout_gravity="right" | ||
| 53 | + android:background="@drawable/gps_white_shadow" | ||
| 54 | + android:gravity="center"> | ||
| 55 | + | ||
| 56 | + <TextView | ||
| 57 | + android:layout_width="wrap_content" | ||
| 58 | + android:layout_height="wrap_content" | ||
| 59 | + android:layout_marginBottom="4dp" | ||
| 60 | + android:text="GPS" | ||
| 61 | + android:textColor="@color/text_black" | ||
| 62 | + android:textSize="12sp" | ||
| 63 | + android:textStyle="bold" /> | ||
| 64 | + | ||
| 65 | + <ImageView | ||
| 66 | + android:id="@+id/iv_gps_state" | ||
| 67 | + android:layout_width="18dp" | ||
| 68 | + android:layout_height="5dp" | ||
| 69 | + android:layout_marginLeft="5dp" | ||
| 70 | + android:layout_marginBottom="4dp" /> | ||
| 71 | + </LinearLayout> | ||
| 72 | + <!----> | ||
| 73 | + <TextView | ||
| 74 | + android:id="@+id/tv_gps_pop_bg" | ||
| 75 | + android:layout_width="wrap_content" | ||
| 76 | + android:layout_height="45dp" | ||
| 77 | + android:layout_marginTop="-5dp" | ||
| 78 | + android:background="@drawable/gps_tip_bg" | ||
| 79 | + android:gravity="center" | ||
| 80 | + android:paddingLeft="15dp" | ||
| 81 | + android:paddingRight="15dp" | ||
| 82 | + android:textColor="@color/text_black" | ||
| 83 | + android:textSize="12sp" | ||
| 84 | + android:visibility="gone" /> | ||
| 85 | + <!----> | ||
| 86 | + </LinearLayout> | ||
| 87 | + | ||
| 88 | + | ||
| 89 | + <FrameLayout | ||
| 90 | + android:id="@+id/fl_location" | ||
| 91 | + android:layout_width="40dp" | ||
| 92 | + android:layout_height="40dp" | ||
| 93 | + android:layout_gravity="bottom" | ||
| 94 | + android:layout_marginLeft="10dp" | ||
| 95 | + android:layout_marginBottom="150dp" | ||
| 96 | + android:background="@drawable/circle_white_shadow_bg" | ||
| 97 | + android:focusable="true"> | ||
| 98 | + | ||
| 99 | + <ImageView | ||
| 100 | + android:layout_width="20dp" | ||
| 101 | + android:layout_height="20dp" | ||
| 102 | + android:layout_gravity="center" | ||
| 103 | + android:layout_marginBottom="4dp" | ||
| 104 | + android:background="@drawable/rt_ic_location_blank" | ||
| 105 | + android:focusable="false" /> | ||
| 106 | + </FrameLayout> | ||
| 107 | + | ||
| 108 | + <FrameLayout | ||
| 109 | + android:id="@+id/fl_take_import_point" | ||
| 110 | + android:layout_width="50dp" | ||
| 111 | + android:layout_height="50dp" | ||
| 112 | + android:layout_gravity="right|bottom" | ||
| 113 | + android:layout_marginRight="10dp" | ||
| 114 | + android:layout_marginBottom="200dp" | ||
| 115 | + android:background="@drawable/circle_white_shadow_bg" | ||
| 116 | + android:focusable="true"> | ||
| 117 | + | ||
| 118 | + <TextView | ||
| 119 | + android:layout_width="wrap_content" | ||
| 120 | + android:layout_height="wrap_content" | ||
| 121 | + android:layout_gravity="center" | ||
| 122 | + android:layout_marginBottom="5dp" | ||
| 123 | + android:text="打点" | ||
| 124 | + android:textColor="@color/text_black" | ||
| 125 | + android:textSize="15sp" /> | ||
| 126 | + </FrameLayout> | ||
| 127 | + | ||
| 128 | + <FrameLayout | ||
| 129 | + android:id="@+id/fl_end_point" | ||
| 130 | + android:layout_width="50dp" | ||
| 131 | + android:layout_height="50dp" | ||
| 132 | + android:layout_gravity="right|bottom" | ||
| 133 | + android:layout_marginRight="10dp" | ||
| 134 | + android:layout_marginBottom="140dp" | ||
| 135 | + android:background="@drawable/circle_white_shadow_bg" | ||
| 136 | + android:focusable="true"> | ||
| 137 | + | ||
| 138 | + <TextView | ||
| 139 | + android:layout_width="wrap_content" | ||
| 140 | + android:layout_height="wrap_content" | ||
| 141 | + android:layout_gravity="center" | ||
| 142 | + android:layout_marginBottom="5dp" | ||
| 143 | + android:text="结束" | ||
| 144 | + android:textColor="@color/text_black" | ||
| 145 | + android:textSize="15sp" /> | ||
| 146 | + </FrameLayout> | ||
| 147 | + | ||
| 148 | + <LinearLayout | ||
| 149 | + android:layout_width="match_parent" | ||
| 150 | + android:layout_height="130dp" | ||
| 151 | + android:layout_gravity="bottom" | ||
| 152 | + android:layout_marginBottom="10dp" | ||
| 153 | + android:background="@drawable/white_shadow_bg" | ||
| 154 | + android:scaleX="1.02"> | ||
| 155 | + | ||
| 156 | + <LinearLayout | ||
| 157 | + android:layout_width="0dp" | ||
| 158 | + android:layout_height="match_parent" | ||
| 159 | + android:layout_weight="1.2" | ||
| 160 | + android:gravity="center" | ||
| 161 | + android:orientation="vertical" | ||
| 162 | + android:paddingLeft="5dp" | ||
| 163 | + android:paddingRight="5dp"> | ||
| 164 | + | ||
| 165 | + <TextView | ||
| 166 | + android:id="@+id/tv_current_speed" | ||
| 167 | + android:layout_width="wrap_content" | ||
| 168 | + android:layout_height="wrap_content" | ||
| 169 | + android:text="--" | ||
| 170 | + android:textColor="@color/black" | ||
| 171 | + android:textSize="20sp" | ||
| 172 | + android:textStyle="bold" /> | ||
| 173 | + | ||
| 174 | + <TextView | ||
| 175 | + android:layout_width="wrap_content" | ||
| 176 | + android:layout_height="wrap_content" | ||
| 177 | + android:layout_marginTop="10dp" | ||
| 178 | + android:text="配速" | ||
| 179 | + android:textColor="@color/black" | ||
| 180 | + android:textSize="15sp" /> | ||
| 181 | + </LinearLayout> | ||
| 182 | + | ||
| 183 | + <LinearLayout | ||
| 184 | + android:layout_width="0dp" | ||
| 185 | + android:layout_height="match_parent" | ||
| 186 | + android:layout_weight="1.2" | ||
| 187 | + android:gravity="center" | ||
| 188 | + android:orientation="vertical"> | ||
| 189 | + | ||
| 190 | + <Chronometer | ||
| 191 | + android:id="@+id/chronometer" | ||
| 192 | + android:layout_width="wrap_content" | ||
| 193 | + android:layout_height="wrap_content" | ||
| 194 | + android:format="00:00:00" | ||
| 195 | + android:textColor="@color/black" | ||
| 196 | + android:textSize="20sp" | ||
| 197 | + android:textStyle="bold" /> | ||
| 198 | + | ||
| 199 | + <TextView | ||
| 200 | + android:layout_width="wrap_content" | ||
| 201 | + android:layout_height="wrap_content" | ||
| 202 | + android:layout_marginTop="10dp" | ||
| 203 | + android:text="用时" | ||
| 204 | + android:textColor="@color/black" | ||
| 205 | + android:textSize="15sp" /> | ||
| 206 | + </LinearLayout> | ||
| 207 | + | ||
| 208 | + | ||
| 209 | + <LinearLayout | ||
| 210 | + android:layout_width="0dp" | ||
| 211 | + android:layout_height="match_parent" | ||
| 212 | + android:layout_weight="1" | ||
| 213 | + android:gravity="center" | ||
| 214 | + android:orientation="vertical" | ||
| 215 | + android:paddingLeft="5dp" | ||
| 216 | + android:paddingRight="5dp"> | ||
| 217 | + | ||
| 218 | + <TextView | ||
| 219 | + android:id="@+id/tv_current_diatance" | ||
| 220 | + android:layout_width="wrap_content" | ||
| 221 | + android:layout_height="wrap_content" | ||
| 222 | + android:text="--" | ||
| 223 | + android:textColor="@color/black" | ||
| 224 | + android:textSize="20sp" | ||
| 225 | + android:textStyle="bold" /> | ||
| 226 | + | ||
| 227 | + <TextView | ||
| 228 | + android:layout_width="wrap_content" | ||
| 229 | + android:layout_height="wrap_content" | ||
| 230 | + android:layout_marginTop="10dp" | ||
| 231 | + android:text="距离(km)" | ||
| 232 | + android:textColor="@color/black" | ||
| 233 | + android:textSize="15sp" /> | ||
| 234 | + </LinearLayout> | ||
| 235 | + | ||
| 236 | + </LinearLayout> | ||
| 237 | + | ||
| 238 | + <!----> | ||
| 239 | + | ||
| 240 | + </FrameLayout> | ||
| 241 | +</layout> | ||
| 0 | \ No newline at end of file | 242 | \ No newline at end of file |
moudle_pedometer/src/main/res/layout/fragment_run_main.xml
| @@ -20,7 +20,8 @@ | @@ -20,7 +20,8 @@ | ||
| 20 | <RelativeLayout | 20 | <RelativeLayout |
| 21 | android:id="@+id/rl_close" | 21 | android:id="@+id/rl_close" |
| 22 | android:layout_width="match_parent" | 22 | android:layout_width="match_parent" |
| 23 | - android:layout_height="wrap_content"> | 23 | + android:layout_height="wrap_content" |
| 24 | + android:visibility="gone"> | ||
| 24 | 25 | ||
| 25 | <ImageView | 26 | <ImageView |
| 26 | android:layout_width="25dp" | 27 | android:layout_width="25dp" |
| @@ -33,7 +34,7 @@ | @@ -33,7 +34,7 @@ | ||
| 33 | <LinearLayout | 34 | <LinearLayout |
| 34 | android:layout_width="match_parent" | 35 | android:layout_width="match_parent" |
| 35 | android:layout_height="0dp" | 36 | android:layout_height="0dp" |
| 36 | - android:layout_weight="1" | 37 | + android:layout_weight="1.2" |
| 37 | android:gravity="center" | 38 | android:gravity="center" |
| 38 | android:paddingLeft="50dp"> | 39 | android:paddingLeft="50dp"> |
| 39 | 40 | ||
| @@ -85,8 +86,7 @@ | @@ -85,8 +86,7 @@ | ||
| 85 | android:layout_height="5dp" | 86 | android:layout_height="5dp" |
| 86 | android:layout_centerVertical="true" | 87 | android:layout_centerVertical="true" |
| 87 | android:layout_marginLeft="5dp" | 88 | android:layout_marginLeft="5dp" |
| 88 | - android:layout_toRightOf="@id/tv_gps" | ||
| 89 | - /> | 89 | + android:layout_toRightOf="@id/tv_gps" /> |
| 90 | 90 | ||
| 91 | <TextView | 91 | <TextView |
| 92 | android:id="@+id/tv_look_trace" | 92 | android:id="@+id/tv_look_trace" |
| @@ -163,8 +163,7 @@ | @@ -163,8 +163,7 @@ | ||
| 163 | android:gravity="center" | 163 | android:gravity="center" |
| 164 | android:text="配速" | 164 | android:text="配速" |
| 165 | android:textColor="@color/text_gray99" | 165 | android:textColor="@color/text_gray99" |
| 166 | - android:textSize="15sp" | ||
| 167 | - /> | 166 | + android:textSize="15sp" /> |
| 168 | </LinearLayout> | 167 | </LinearLayout> |
| 169 | <!--用时--> | 168 | <!--用时--> |
| 170 | <LinearLayout | 169 | <LinearLayout |
| @@ -196,8 +195,7 @@ | @@ -196,8 +195,7 @@ | ||
| 196 | android:gravity="center" | 195 | android:gravity="center" |
| 197 | android:text="用时" | 196 | android:text="用时" |
| 198 | android:textColor="@color/text_gray99" | 197 | android:textColor="@color/text_gray99" |
| 199 | - android:textSize="15sp" | ||
| 200 | - /> | 198 | + android:textSize="15sp" /> |
| 201 | </LinearLayout> | 199 | </LinearLayout> |
| 202 | <!--热量--> | 200 | <!--热量--> |
| 203 | <LinearLayout | 201 | <LinearLayout |
| @@ -230,8 +228,7 @@ | @@ -230,8 +228,7 @@ | ||
| 230 | android:gravity="center" | 228 | android:gravity="center" |
| 231 | android:text="步" | 229 | android:text="步" |
| 232 | android:textColor="@color/text_gray99" | 230 | android:textColor="@color/text_gray99" |
| 233 | - android:textSize="15sp" | ||
| 234 | - /> | 231 | + android:textSize="15sp" /> |
| 235 | </LinearLayout> | 232 | </LinearLayout> |
| 236 | </LinearLayout> | 233 | </LinearLayout> |
| 237 | 234 | ||
| @@ -259,11 +256,11 @@ | @@ -259,11 +256,11 @@ | ||
| 259 | <LinearLayout | 256 | <LinearLayout |
| 260 | android:id="@+id/ll_two_bottom_button" | 257 | android:id="@+id/ll_two_bottom_button" |
| 261 | android:layout_width="match_parent" | 258 | android:layout_width="match_parent" |
| 262 | - android:layout_height="match_parent" | 259 | + android:layout_height="wrap_content" |
| 260 | + android:layout_gravity="center" | ||
| 261 | + android:layout_marginBottom="25dp" | ||
| 263 | android:gravity="center_horizontal" | 262 | android:gravity="center_horizontal" |
| 264 | - android:visibility="gone" | ||
| 265 | - | ||
| 266 | - > | 263 | + android:visibility="gone"> |
| 267 | 264 | ||
| 268 | <LinearLayout | 265 | <LinearLayout |
| 269 | android:layout_width="wrap_content" | 266 | android:layout_width="wrap_content" |