Commit aab700e44337866bf26e754a0fc0fbe3d9f30ac7
1 parent
e8e32e1c
1 实现重新上传功能模块
2 完成全部成绩详情页
Showing
24 changed files
with
985 additions
and
86 deletions
moudle_pedometer/src/main/AndroidManifest.xml
| @@ -128,7 +128,7 @@ | @@ -128,7 +128,7 @@ | ||
| 128 | <activity | 128 | <activity |
| 129 | android:name="com.cnlive.moudle.pedometer.ui.activity.RunRaceDetailActivity" | 129 | android:name="com.cnlive.moudle.pedometer.ui.activity.RunRaceDetailActivity" |
| 130 | android:launchMode="singleTask" | 130 | android:launchMode="singleTask" |
| 131 | - android:process=":step" /> | 131 | + /> |
| 132 | <activity | 132 | <activity |
| 133 | android:name="com.cnlive.moudle.pedometer.ui.activity.RunningFinishActivity" | 133 | android:name="com.cnlive.moudle.pedometer.ui.activity.RunningFinishActivity" |
| 134 | android:launchMode="singleTask" | 134 | android:launchMode="singleTask" |
| @@ -136,7 +136,11 @@ | @@ -136,7 +136,11 @@ | ||
| 136 | <activity | 136 | <activity |
| 137 | android:name="com.cnlive.moudle.pedometer.ui.activity.UploadFailDetailActivity" | 137 | android:name="com.cnlive.moudle.pedometer.ui.activity.UploadFailDetailActivity" |
| 138 | android:launchMode="singleTask" | 138 | android:launchMode="singleTask" |
| 139 | - android:process=":step" /> | 139 | + /> |
| 140 | + <!--全部成绩详情页--> | ||
| 141 | + <activity | ||
| 142 | + android:name="com.cnlive.moudle.pedometer.ui.activity.ALLScoreDetailActivity" | ||
| 143 | + android:launchMode="singleTask" /> | ||
| 140 | <!--************************************************路径工具**********************************************--> | 144 | <!--************************************************路径工具**********************************************--> |
| 141 | <service | 145 | <service |
| 142 | android:name="com.cnlive.moudle.collectionTrace.service.CollKeepLiveService" | 146 | android:name="com.cnlive.moudle.collectionTrace.service.CollKeepLiveService" |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/CollRunningFinishActivity.java
| @@ -39,7 +39,7 @@ public class CollRunningFinishActivity extends QMUIFragmentActivity { | @@ -39,7 +39,7 @@ public class CollRunningFinishActivity extends QMUIFragmentActivity { | ||
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | private void addFragment(RunningFinishBean runningFinishBean) { | 41 | private void addFragment(RunningFinishBean runningFinishBean) { |
| 42 | - QMUIFragment fragment = CollRunningFinishFragment.instance(runningFinishBean); | 42 | + QMUIFragment fragment =RunningFinishFragment.instance(runningFinishBean); |
| 43 | getSupportFragmentManager().beginTransaction() | 43 | getSupportFragmentManager().beginTransaction() |
| 44 | .add(getContextViewId(), fragment, fragment.getClass().getSimpleName()) | 44 | .add(getContextViewId(), fragment, fragment.getClass().getSimpleName()) |
| 45 | .addToBackStack(fragment.getClass().getSimpleName()) | 45 | .addToBackStack(fragment.getClass().getSimpleName()) |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/ALLScoreDetailFragmentPresenter.java
0 → 100644
| 1 | +package com.cnlive.moudle.pedometer.frame.presenter; | ||
| 2 | + | ||
| 3 | +import com.cnlive.moudle.pedometer.frame.view.ALLScoreDetailFragmentView; | ||
| 4 | +import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; | ||
| 5 | + | ||
| 6 | +public class ALLScoreDetailFragmentPresenter extends MvpBasePresenter<ALLScoreDetailFragmentView> { | ||
| 7 | +} |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/LineUpAgainPresenter.java
| 1 | package com.cnlive.moudle.pedometer.frame.presenter; | 1 | package com.cnlive.moudle.pedometer.frame.presenter; |
| 2 | 2 | ||
| 3 | +import android.app.Activity; | ||
| 4 | +import android.os.Handler; | ||
| 5 | +import android.text.TextUtils; | ||
| 6 | +import android.util.Log; | ||
| 7 | +import android.widget.Toast; | ||
| 8 | + | ||
| 9 | +import com.baidu.mapapi.model.LatLng; | ||
| 10 | +import com.baidu.trace.LBSTraceClient; | ||
| 11 | +import com.baidu.trace.model.SortType; | ||
| 12 | +import com.cnlive.libs.base.logic.Logic; | ||
| 13 | +import com.cnlive.libs.base.logic.callback.DataCallback; | ||
| 14 | +import com.cnlive.libs.base.logic.callback.FailureCallback; | ||
| 15 | +import com.cnlive.libs.base.logic.callback.SuccessCallback; | ||
| 16 | +import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | ||
| 3 | import com.cnlive.moudle.pedometer.frame.view.LineUpAgainView; | 17 | import com.cnlive.moudle.pedometer.frame.view.LineUpAgainView; |
| 18 | +import com.cnlive.moudle.pedometer.model.Constant; | ||
| 19 | +import com.cnlive.moudle.pedometer.net.ApiServiceRunLin; | ||
| 20 | +import com.cnlive.moudle.pedometer.net.SubscriptionRequest; | ||
| 21 | +import com.cnlive.moudle.pedometer.net.bean.BaseInfo; | ||
| 22 | +import com.cnlive.moudle.pedometer.sql.entity.FailedEntity; | ||
| 23 | +import com.cnlive.moudle.pedometer.ui.activity.LineUpAgainActivity; | ||
| 24 | +import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; | ||
| 25 | +import com.cnlive.moudle.pedometer.utils.GsonUtil; | ||
| 26 | +import com.cnlive.moudle.pedometer.utils.MyMapUtil; | ||
| 27 | +import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil; | ||
| 28 | +import com.cnlive.moudle.pedometer.utils.StepUtil; | ||
| 29 | +import com.example.moudle_pedometer.R; | ||
| 4 | import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; | 30 | import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; |
| 5 | 31 | ||
| 32 | +import java.util.HashMap; | ||
| 33 | +import java.util.List; | ||
| 34 | +import java.util.Map; | ||
| 35 | + | ||
| 36 | +import io.reactivex.disposables.Disposable; | ||
| 37 | + | ||
| 6 | /** | 38 | /** |
| 7 | * Created by hanyayun 019/06/20. | 39 | * Created by hanyayun 019/06/20. |
| 8 | */ | 40 | */ |
| 9 | public class LineUpAgainPresenter extends MvpBasePresenter<LineUpAgainView> { | 41 | public class LineUpAgainPresenter extends MvpBasePresenter<LineUpAgainView> { |
| 42 | + private LBSTraceClient mClient = null; | ||
| 43 | + private List<LatLng> importPoints; | ||
| 44 | + private SelectDialog uploadFailDialog; | ||
| 45 | + private SelectDialog failTraceDialog; | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 查询当前用户历史轨迹(用于重新上传按钮) | ||
| 49 | + */ | ||
| 50 | + public void queryHistoryTraceNoMap(Activity context, FailedEntity failedEntity,onResultListener onResultListener) { | ||
| 51 | + QMUITipDialogUtil.loadingDialog(context, "正在获取轨迹信息,请稍后", false); | ||
| 52 | + //查询当前用户的历史轨迹 | ||
| 53 | + long startTime = failedEntity.getUserStartTime(); | ||
| 54 | + //获取当前的时间戳(秒) | ||
| 55 | + long endTime = failedEntity.getUserEndTime(); | ||
| 56 | + //获取当前的实体名称 | ||
| 57 | + String entityName = CommonInfo.getUserId(context); | ||
| 58 | + //打的重要点 | ||
| 59 | + importPoints = null; | ||
| 60 | + if (!TextUtils.isEmpty(failedEntity.getImportPoint())) { | ||
| 61 | + importPoints = GsonUtil.jsonToList(failedEntity.getImportPoint(), LatLng.class); | ||
| 62 | + } | ||
| 63 | + if (mClient == null) { | ||
| 64 | + mClient = new LBSTraceClient(context); | ||
| 65 | + } | ||
| 66 | + MyMapUtil.queryHistoryTrace(context, mClient, entityName, startTime, endTime, new MyMapUtil.CallBack() { | ||
| 67 | + @Override | ||
| 68 | + public void success(List<LatLng> resultPoints) { | ||
| 69 | + if (resultPoints != null) { | ||
| 70 | + if (getView() != null) { | ||
| 71 | + QMUITipDialogUtil.dismessDialog(); | ||
| 72 | + if (importPoints != null) { | ||
| 73 | + //判断是否完成 | ||
| 74 | + boolean isFinish = MyMapUtil.checkIsFinishTrace(importPoints, resultPoints, Constant.PASS_RATE); | ||
| 75 | + if (isFinish) { | ||
| 76 | + Toast.makeText(context, "完成", Toast.LENGTH_LONG).show(); | ||
| 77 | + failedEntity.setIsFinish("1"); | ||
| 78 | + } else { | ||
| 79 | + Toast.makeText(context, "没有完成", Toast.LENGTH_LONG).show(); | ||
| 80 | + failedEntity.setIsFinish("0"); | ||
| 81 | + } | ||
| 82 | + saveRouteData(context, failedEntity,onResultListener); | ||
| 83 | + } | ||
| 84 | + } | ||
| 85 | + } | ||
| 86 | + //查询失败 | ||
| 87 | + else { | ||
| 88 | + QMUITipDialogUtil.dismessDialog(); | ||
| 89 | + if (failTraceDialog == null) { | ||
| 90 | + failTraceDialog = new SelectDialog(context, "获取轨迹失败,是否重试?", "重试", new SelectDialog.DialogInterface() { | ||
| 91 | + @Override | ||
| 92 | + public void onClick(SelectDialog dialog) { | ||
| 93 | + dialog.dismiss(); | ||
| 94 | + queryHistoryTraceNoMap(context, failedEntity,onResultListener); | ||
| 95 | + } | ||
| 96 | + }, "取消", new SelectDialog.DialogInterface() { | ||
| 97 | + @Override | ||
| 98 | + public void onClick(SelectDialog dialog) { | ||
| 99 | + dialog.dismiss(); | ||
| 100 | + | ||
| 101 | + } | ||
| 102 | + }); | ||
| 103 | + failTraceDialog.setCanceledOnTouchOutside(false); | ||
| 104 | + failTraceDialog.setCancelable(false); | ||
| 105 | + if (!failTraceDialog.isShowing()) { | ||
| 106 | + failTraceDialog.show(); | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + } else { | ||
| 110 | + if (!failTraceDialog.isShowing()) { | ||
| 111 | + failTraceDialog.show(); | ||
| 112 | + } | ||
| 113 | + } | ||
| 114 | + } | ||
| 115 | + } | ||
| 116 | + }); | ||
| 117 | + | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + /** | ||
| 121 | + * 上传数据 | ||
| 122 | + * | ||
| 123 | + * @param context | ||
| 124 | + * @param failedEntity | ||
| 125 | + */ | ||
| 126 | + public void saveRouteData(Activity context, FailedEntity failedEntity,onResultListener onResultListener) { | ||
| 127 | + QMUITipDialogUtil.loadingDialog(context, "正在上传数据", false); | ||
| 128 | + // 赛事id | ||
| 129 | + String eventId = failedEntity.getStreetId(); | ||
| 130 | + //用户ID | ||
| 131 | + String sid = CommonInfo.getUserId(context); | ||
| 132 | + //用时 | ||
| 133 | + String employTime = failedEntity.getTime(); | ||
| 134 | + //路线全程里数 | ||
| 135 | + String mileage = ""; | ||
| 136 | + if ("--".equals(failedEntity.getDistance())) { | ||
| 137 | + mileage = "0"; | ||
| 138 | + } else { | ||
| 139 | + mileage = failedEntity.getDistance(); | ||
| 140 | + } | ||
| 141 | + //配速 | ||
| 142 | + String pace = ""; | ||
| 143 | + if ("--".equals(failedEntity.getSpeed())) { | ||
| 144 | + pace = "0"; | ||
| 145 | + } else { | ||
| 146 | + pace = failedEntity.getSpeed(); | ||
| 147 | + } | ||
| 148 | + // 路线图 | ||
| 149 | + String roadmap = ""; | ||
| 150 | + //经纬度 | ||
| 151 | + String latLongitude = ""; | ||
| 152 | + // 开始时间 | ||
| 153 | + String startTime = failedEntity.getUserStartTime() + ""; | ||
| 154 | + //结束时间 | ||
| 155 | + String endTime = failedEntity.getUserEndTime() + ""; | ||
| 156 | + //暂停时间 | ||
| 157 | + String pauseTime = ""; | ||
| 158 | + String isPause = "0";//1暂停 | ||
| 159 | + if (failedEntity.getIsPause()) { | ||
| 160 | + pauseTime = failedEntity.getUserPauseTime() + ""; | ||
| 161 | + isPause = "1"; | ||
| 162 | + } | ||
| 163 | + //继续时间 | ||
| 164 | + String continueTime = ""; | ||
| 165 | + //是否完成 | ||
| 166 | + String completeStatus = failedEntity.getIsFinish(); | ||
| 167 | + | ||
| 168 | + //设置请求参数 | ||
| 169 | + Map<String, String> paramsMap = new HashMap<>(); | ||
| 170 | + paramsMap.put("eventId", eventId); | ||
| 171 | + paramsMap.put("sid", sid); | ||
| 172 | + paramsMap.put("employTime", employTime); | ||
| 173 | + paramsMap.put("mileage", mileage); | ||
| 174 | + paramsMap.put("pace", pace); | ||
| 175 | + paramsMap.put("latLongitude", latLongitude); | ||
| 176 | + paramsMap.put("roadmap", roadmap); | ||
| 177 | + paramsMap.put("startTime", startTime); | ||
| 178 | + paramsMap.put("endTime", endTime); | ||
| 179 | + paramsMap.put("pauseTime", pauseTime); | ||
| 180 | + paramsMap.put("continueTime", continueTime); | ||
| 181 | + paramsMap.put("isPause", isPause); | ||
| 182 | + paramsMap.put("completeStatus", completeStatus); | ||
| 183 | + | ||
| 184 | + | ||
| 185 | + Logic.create(paramsMap).action(new Logic.Action<Map<String, String>, BaseInfo>() { | ||
| 186 | + @Override | ||
| 187 | + public Disposable action(Map<String, String> stringStringMap, DataCallback<BaseInfo> dataCallback) { | ||
| 188 | + return SubscriptionRequest.service(ApiServiceRunLin.class, api -> api.saveRouteData(stringStringMap)).subscribe(context, dataCallback); | ||
| 189 | + } | ||
| 190 | + }).<BaseInfo>event() | ||
| 191 | + .setFailureCallback(new FailureCallback() { | ||
| 192 | + @Override | ||
| 193 | + public void onFailure(int code, String message) { | ||
| 194 | + if (getView() == null) { | ||
| 195 | + return; | ||
| 196 | + } | ||
| 197 | + if (onResultListener!=null){ | ||
| 198 | + onResultListener.onFailed(message); | ||
| 199 | + } | ||
| 200 | + Log.e("saveRouteData", "onFailure: " + message); | ||
| 201 | + QMUITipDialogUtil.dismessDialog(); | ||
| 202 | + if (uploadFailDialog == null) { | ||
| 203 | + uploadFailDialog = new SelectDialog(context, "上传数据失败,是否重试?", "重试", new SelectDialog.DialogInterface() { | ||
| 204 | + @Override | ||
| 205 | + public void onClick(SelectDialog dialog) { | ||
| 206 | + dialog.dismiss(); | ||
| 207 | + saveRouteData(context, failedEntity,onResultListener); | ||
| 208 | + } | ||
| 209 | + }, "取消", new SelectDialog.DialogInterface() { | ||
| 210 | + @Override | ||
| 211 | + public void onClick(SelectDialog dialog) { | ||
| 212 | + dialog.dismiss(); | ||
| 213 | + } | ||
| 214 | + }); | ||
| 215 | + uploadFailDialog.setCanceledOnTouchOutside(false); | ||
| 216 | + uploadFailDialog.setCancelable(false); | ||
| 217 | + if (!uploadFailDialog.isShowing()) { | ||
| 218 | + uploadFailDialog.show(); | ||
| 219 | + } | ||
| 220 | + } else { | ||
| 221 | + if (!uploadFailDialog.isShowing()) { | ||
| 222 | + uploadFailDialog.show(); | ||
| 223 | + } | ||
| 224 | + } | ||
| 225 | + } | ||
| 226 | + }).setSuccessCallback(new SuccessCallback<BaseInfo>() { | ||
| 227 | + @Override | ||
| 228 | + public void onSuccess(BaseInfo baseInfo) { | ||
| 229 | + if (getView() == null) { | ||
| 230 | + return; | ||
| 231 | + } | ||
| 232 | + | ||
| 233 | + QMUITipDialogUtil.dismessDialog(); | ||
| 234 | + QMUITipDialogUtil.successDialog(context, "上传成功", 1); | ||
| 235 | + //删除暂存数据 | ||
| 236 | + FailedEntity entity = StepUtil.getTempSaveFailData(context, CommonInfo.getUserId(context), failedEntity.getUserStartTime()); | ||
| 237 | + if (entity != null) { | ||
| 238 | + //删除 | ||
| 239 | + StepUtil.deleteTempSaveFailData(context, entity); | ||
| 240 | + } | ||
| 241 | + if (onResultListener!=null){ | ||
| 242 | + onResultListener.onSuccess(); | ||
| 243 | + } | ||
| 244 | + } | ||
| 245 | + }).start(); | ||
| 246 | + } | ||
| 247 | + | ||
| 248 | + public interface onResultListener { | ||
| 249 | + void onSuccess(); | ||
| 250 | + | ||
| 251 | + void onFailed(String tip); | ||
| 252 | + } | ||
| 10 | } | 253 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/RunningFinishFragmetPresenter.java
| @@ -105,7 +105,8 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter<RunningFinis | @@ -105,7 +105,8 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter<RunningFinis | ||
| 105 | String continueTime = ""; | 105 | String continueTime = ""; |
| 106 | //是否完成 | 106 | //是否完成 |
| 107 | String completeStatus = runningFinishBean.getIsFinish(); | 107 | String completeStatus = runningFinishBean.getIsFinish(); |
| 108 | - | 108 | + //设置步数 |
| 109 | + String step = runningFinishBean.getStep(); | ||
| 109 | //设置请求参数 | 110 | //设置请求参数 |
| 110 | Map<String, String> paramsMap = new HashMap<>(); | 111 | Map<String, String> paramsMap = new HashMap<>(); |
| 111 | paramsMap.put("eventId", eventId); | 112 | paramsMap.put("eventId", eventId); |
| @@ -121,6 +122,8 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter<RunningFinis | @@ -121,6 +122,8 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter<RunningFinis | ||
| 121 | paramsMap.put("continueTime", continueTime); | 122 | paramsMap.put("continueTime", continueTime); |
| 122 | paramsMap.put("isPause", isPause); | 123 | paramsMap.put("isPause", isPause); |
| 123 | paramsMap.put("completeStatus", completeStatus); | 124 | paramsMap.put("completeStatus", completeStatus); |
| 125 | + paramsMap.put("step", step); | ||
| 126 | + | ||
| 124 | 127 | ||
| 125 | 128 | ||
| 126 | Logic.create(paramsMap).action(new Logic.Action<Map<String, String>, BaseInfo>() { | 129 | Logic.create(paramsMap).action(new Logic.Action<Map<String, String>, BaseInfo>() { |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/RunningMapFragmentPresenter.java
| @@ -370,7 +370,7 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | @@ -370,7 +370,7 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | ||
| 370 | Toast.makeText(context, "没有完成", Toast.LENGTH_LONG).show(); | 370 | Toast.makeText(context, "没有完成", Toast.LENGTH_LONG).show(); |
| 371 | 371 | ||
| 372 | } | 372 | } |
| 373 | - MyMapUtil.drawHistoryTrack(context, getView().baiduMap, resultPoints, SortType.asc, R.color.red, R.drawable.icon_start, R.drawable.icon_end); | 373 | + MyMapUtil.drawRealTimeTrack(context, getView().baiduMap, resultPoints, SortType.asc, R.color.red, R.drawable.icon_start); |
| 374 | } | 374 | } |
| 375 | } | 375 | } |
| 376 | } | 376 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/UploadFailDetailFragmentPresenter.java
| 1 | package com.cnlive.moudle.pedometer.frame.presenter; | 1 | package com.cnlive.moudle.pedometer.frame.presenter; |
| 2 | 2 | ||
| 3 | +import android.app.Activity; | ||
| 4 | +import android.os.Handler; | ||
| 5 | +import android.text.TextUtils; | ||
| 6 | +import android.util.Log; | ||
| 7 | +import android.widget.Toast; | ||
| 8 | + | ||
| 9 | +import com.baidu.mapapi.model.LatLng; | ||
| 10 | +import com.baidu.trace.LBSTraceClient; | ||
| 11 | +import com.baidu.trace.model.SortType; | ||
| 12 | +import com.cnlive.libs.base.logic.Logic; | ||
| 13 | +import com.cnlive.libs.base.logic.callback.DataCallback; | ||
| 14 | +import com.cnlive.libs.base.logic.callback.FailureCallback; | ||
| 15 | +import com.cnlive.libs.base.logic.callback.SuccessCallback; | ||
| 16 | +import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | ||
| 3 | import com.cnlive.moudle.pedometer.frame.view.UploadFailDetailFragmentView; | 17 | import com.cnlive.moudle.pedometer.frame.view.UploadFailDetailFragmentView; |
| 18 | +import com.cnlive.moudle.pedometer.model.Constant; | ||
| 19 | +import com.cnlive.moudle.pedometer.model.RunningFinishBean; | ||
| 20 | +import com.cnlive.moudle.pedometer.net.ApiServiceRunLin; | ||
| 21 | +import com.cnlive.moudle.pedometer.net.SubscriptionRequest; | ||
| 22 | +import com.cnlive.moudle.pedometer.net.bean.BaseInfo; | ||
| 23 | +import com.cnlive.moudle.pedometer.sql.entity.FailedEntity; | ||
| 24 | +import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; | ||
| 25 | +import com.cnlive.moudle.pedometer.ui.activity.LineUpAgainActivity; | ||
| 26 | +import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; | ||
| 27 | +import com.cnlive.moudle.pedometer.utils.GsonUtil; | ||
| 28 | +import com.cnlive.moudle.pedometer.utils.MyMapUtil; | ||
| 29 | +import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil; | ||
| 30 | +import com.cnlive.moudle.pedometer.utils.StepUtil; | ||
| 31 | +import com.example.moudle_pedometer.R; | ||
| 4 | import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; | 32 | import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; |
| 5 | 33 | ||
| 34 | +import java.util.HashMap; | ||
| 35 | +import java.util.List; | ||
| 36 | +import java.util.Map; | ||
| 37 | + | ||
| 38 | +import io.reactivex.disposables.Disposable; | ||
| 39 | + | ||
| 6 | public class UploadFailDetailFragmentPresenter extends MvpBasePresenter<UploadFailDetailFragmentView> { | 40 | public class UploadFailDetailFragmentPresenter extends MvpBasePresenter<UploadFailDetailFragmentView> { |
| 41 | + private LBSTraceClient mClient = null; | ||
| 42 | + private List<LatLng> importPoints; | ||
| 43 | + private SelectDialog uploadFailDialog; | ||
| 44 | + private SelectDialog failTraceDialog; | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * 查询当前用户历史轨迹 | ||
| 48 | + */ | ||
| 49 | + public void queryHistoryTrace(Activity context, FailedEntity failedEntity) { | ||
| 50 | + QMUITipDialogUtil.loadingDialog(context, "正在获取轨迹信息,请稍后", false); | ||
| 51 | + //查询当前用户的历史轨迹 | ||
| 52 | + long startTime = failedEntity.getUserStartTime(); | ||
| 53 | + //获取当前的时间戳(秒) | ||
| 54 | + long endTime = failedEntity.getUserEndTime(); | ||
| 55 | + //获取当前的实体名称 | ||
| 56 | + String entityName = CommonInfo.getUserId(context); | ||
| 57 | + //打的重要点 | ||
| 58 | + importPoints = null; | ||
| 59 | + if (!TextUtils.isEmpty(failedEntity.getImportPoint())) { | ||
| 60 | + importPoints = GsonUtil.jsonToList(failedEntity.getImportPoint(), LatLng.class); | ||
| 61 | + } | ||
| 62 | + if (mClient == null) { | ||
| 63 | + mClient = new LBSTraceClient(context); | ||
| 64 | + } | ||
| 65 | + MyMapUtil.queryHistoryTrace(context, mClient, entityName, startTime, endTime, new MyMapUtil.CallBack() { | ||
| 66 | + @Override | ||
| 67 | + public void success(List<LatLng> resultPoints) { | ||
| 68 | + if (resultPoints != null) { | ||
| 69 | + if (getView() != null) { | ||
| 70 | + QMUITipDialogUtil.dismessDialog(); | ||
| 71 | + getView().updateStartBtnState(true); | ||
| 72 | + if (importPoints != null) { | ||
| 73 | + //判断是否完成 | ||
| 74 | + boolean isFinish = MyMapUtil.checkIsFinishTrace(importPoints, resultPoints, Constant.PASS_RATE); | ||
| 75 | + if (isFinish) { | ||
| 76 | + Toast.makeText(context, "完成", Toast.LENGTH_LONG).show(); | ||
| 77 | + failedEntity.setIsFinish("1"); | ||
| 78 | + if (getView() != null) { | ||
| 79 | + getView().updateIsFinish("1"); | ||
| 80 | + } | ||
| 81 | + } else { | ||
| 82 | + Toast.makeText(context, "没有完成", Toast.LENGTH_LONG).show(); | ||
| 83 | + failedEntity.setIsFinish("0"); | ||
| 84 | + if (getView() != null) { | ||
| 85 | + getView().updateIsFinish("0"); | ||
| 86 | + } | ||
| 87 | + } | ||
| 88 | + if (resultPoints.size() > 1) { | ||
| 89 | + MyMapUtil.drawHistoryTrack(context, getView().baiduMap, resultPoints, SortType.asc, R.color.red, R.drawable.icon_start, R.drawable.icon_end); | ||
| 90 | + //设置地图自动缩放 | ||
| 91 | + MyMapUtil.setMapAutoZoom(getView().baiduMap, resultPoints, -2f); | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + } | ||
| 95 | + } | ||
| 96 | + } | ||
| 97 | + //查询失败 | ||
| 98 | + else { | ||
| 99 | + if (getView() == null) { | ||
| 100 | + return; | ||
| 101 | + } | ||
| 102 | + getView().updateStartBtnState(false); | ||
| 103 | + QMUITipDialogUtil.dismessDialog(); | ||
| 104 | + | ||
| 105 | + if (failTraceDialog == null) { | ||
| 106 | + failTraceDialog = new SelectDialog(context, "获取轨迹失败,是否重试?", "重试", new SelectDialog.DialogInterface() { | ||
| 107 | + @Override | ||
| 108 | + public void onClick(SelectDialog dialog) { | ||
| 109 | + dialog.dismiss(); | ||
| 110 | + queryHistoryTrace(context, failedEntity); | ||
| 111 | + } | ||
| 112 | + }, "取消", new SelectDialog.DialogInterface() { | ||
| 113 | + @Override | ||
| 114 | + public void onClick(SelectDialog dialog) { | ||
| 115 | + dialog.dismiss(); | ||
| 116 | + | ||
| 117 | + } | ||
| 118 | + }); | ||
| 119 | + failTraceDialog.setCanceledOnTouchOutside(false); | ||
| 120 | + failTraceDialog.setCancelable(false); | ||
| 121 | + if (!failTraceDialog.isShowing()) { | ||
| 122 | + failTraceDialog.show(); | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + } else { | ||
| 126 | + if (!failTraceDialog.isShowing()) { | ||
| 127 | + failTraceDialog.show(); | ||
| 128 | + } | ||
| 129 | + } | ||
| 130 | + } | ||
| 131 | + } | ||
| 132 | + }); | ||
| 133 | + | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + /** | ||
| 137 | + * 上传数据 | ||
| 138 | + * | ||
| 139 | + * @param context | ||
| 140 | + * @param failedEntity | ||
| 141 | + */ | ||
| 142 | + public void saveRouteData(Activity context, FailedEntity failedEntity) { | ||
| 143 | + QMUITipDialogUtil.loadingDialog(context, "正在上传数据", false); | ||
| 144 | + // 赛事id | ||
| 145 | + String eventId = failedEntity.getStreetId(); | ||
| 146 | + //用户ID | ||
| 147 | + String sid = CommonInfo.getUserId(context); | ||
| 148 | + //用时 | ||
| 149 | + String employTime = failedEntity.getTime(); | ||
| 150 | + //路线全程里数 | ||
| 151 | + String mileage = ""; | ||
| 152 | + if ("--".equals(failedEntity.getDistance())) { | ||
| 153 | + mileage = "0"; | ||
| 154 | + } else { | ||
| 155 | + mileage = failedEntity.getDistance(); | ||
| 156 | + } | ||
| 157 | + //配速 | ||
| 158 | + String pace = ""; | ||
| 159 | + if ("--".equals(failedEntity.getSpeed())) { | ||
| 160 | + pace = "0"; | ||
| 161 | + } else { | ||
| 162 | + pace = failedEntity.getSpeed(); | ||
| 163 | + } | ||
| 164 | + // 路线图 | ||
| 165 | + String roadmap = ""; | ||
| 166 | + //经纬度 | ||
| 167 | + String latLongitude = ""; | ||
| 168 | + // 开始时间 | ||
| 169 | + String startTime = failedEntity.getUserStartTime() + ""; | ||
| 170 | + //结束时间 | ||
| 171 | + String endTime = failedEntity.getUserEndTime() + ""; | ||
| 172 | + //暂停时间 | ||
| 173 | + String pauseTime = ""; | ||
| 174 | + String isPause = "0";//1暂停 | ||
| 175 | + if (failedEntity.getIsPause()) { | ||
| 176 | + pauseTime = failedEntity.getUserPauseTime() + ""; | ||
| 177 | + isPause = "1"; | ||
| 178 | + } | ||
| 179 | + //继续时间 | ||
| 180 | + String continueTime = ""; | ||
| 181 | + //是否完成 | ||
| 182 | + String completeStatus = failedEntity.getIsFinish(); | ||
| 183 | + //设置步数 | ||
| 184 | + String step = failedEntity.getStep(); | ||
| 185 | + //设置请求参数 | ||
| 186 | + Map<String, String> paramsMap = new HashMap<>(); | ||
| 187 | + paramsMap.put("eventId", eventId); | ||
| 188 | + paramsMap.put("sid", sid); | ||
| 189 | + paramsMap.put("employTime", employTime); | ||
| 190 | + paramsMap.put("mileage", mileage); | ||
| 191 | + paramsMap.put("pace", pace); | ||
| 192 | + paramsMap.put("latLongitude", latLongitude); | ||
| 193 | + paramsMap.put("roadmap", roadmap); | ||
| 194 | + paramsMap.put("startTime", startTime); | ||
| 195 | + paramsMap.put("endTime", endTime); | ||
| 196 | + paramsMap.put("pauseTime", pauseTime); | ||
| 197 | + paramsMap.put("continueTime", continueTime); | ||
| 198 | + paramsMap.put("isPause", isPause); | ||
| 199 | + paramsMap.put("completeStatus", completeStatus); | ||
| 200 | + paramsMap.put("step", step); | ||
| 201 | + | ||
| 202 | + Logic.create(paramsMap).action(new Logic.Action<Map<String, String>, BaseInfo>() { | ||
| 203 | + @Override | ||
| 204 | + public Disposable action(Map<String, String> stringStringMap, DataCallback<BaseInfo> dataCallback) { | ||
| 205 | + return SubscriptionRequest.service(ApiServiceRunLin.class, api -> api.saveRouteData(stringStringMap)).subscribe(context, dataCallback); | ||
| 206 | + } | ||
| 207 | + }).<BaseInfo>event() | ||
| 208 | + .setFailureCallback(new FailureCallback() { | ||
| 209 | + @Override | ||
| 210 | + public void onFailure(int code, String message) { | ||
| 211 | + if (getView() == null) { | ||
| 212 | + return; | ||
| 213 | + } | ||
| 214 | + Log.e("saveRouteData", "onFailure: " + message); | ||
| 215 | + QMUITipDialogUtil.dismessDialog(); | ||
| 216 | + if (uploadFailDialog == null) { | ||
| 217 | + uploadFailDialog = new SelectDialog(context, "上传数据失败,是否重试?", "重试", new SelectDialog.DialogInterface() { | ||
| 218 | + @Override | ||
| 219 | + public void onClick(SelectDialog dialog) { | ||
| 220 | + dialog.dismiss(); | ||
| 221 | + saveRouteData(context, failedEntity); | ||
| 222 | + } | ||
| 223 | + }, "取消", new SelectDialog.DialogInterface() { | ||
| 224 | + @Override | ||
| 225 | + public void onClick(SelectDialog dialog) { | ||
| 226 | + dialog.dismiss(); | ||
| 227 | + | ||
| 228 | + } | ||
| 229 | + }); | ||
| 230 | + uploadFailDialog.setCanceledOnTouchOutside(false); | ||
| 231 | + uploadFailDialog.setCancelable(false); | ||
| 232 | + if (!uploadFailDialog.isShowing()) { | ||
| 233 | + uploadFailDialog.show(); | ||
| 234 | + } | ||
| 235 | + } else { | ||
| 236 | + if (!uploadFailDialog.isShowing()) { | ||
| 237 | + uploadFailDialog.show(); | ||
| 238 | + } | ||
| 239 | + } | ||
| 240 | + } | ||
| 241 | + }).setSuccessCallback(new SuccessCallback<BaseInfo>() { | ||
| 242 | + @Override | ||
| 243 | + public void onSuccess(BaseInfo baseInfo) { | ||
| 244 | + if (getView() == null) { | ||
| 245 | + return; | ||
| 246 | + } | ||
| 247 | + QMUITipDialogUtil.dismessDialog(); | ||
| 248 | + QMUITipDialogUtil.successDialog(context, "上传成功", 1); | ||
| 249 | + //删除暂存数据 | ||
| 250 | + FailedEntity entity = StepUtil.getTempSaveFailData(context, CommonInfo.getUserId(context), failedEntity.getUserStartTime()); | ||
| 251 | + if (entity != null) { | ||
| 252 | + //删除 | ||
| 253 | + StepUtil.deleteTempSaveFailData(context, entity); | ||
| 254 | + //结束 | ||
| 255 | + new Handler().postDelayed(new Runnable() { | ||
| 256 | + @Override | ||
| 257 | + public void run() { | ||
| 258 | + if (context != null) { | ||
| 259 | + context.finish(); | ||
| 260 | + } | ||
| 261 | + } | ||
| 262 | + }, 1000); | ||
| 263 | + } | ||
| 264 | + } | ||
| 265 | + }).start(); | ||
| 266 | + } | ||
| 7 | } | 267 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/ALLScoreDetailFragmentView.java
0 → 100644
| 1 | +package com.cnlive.moudle.pedometer.frame.view; | ||
| 2 | + | ||
| 3 | +import android.content.Context; | ||
| 4 | +import android.text.TextUtils; | ||
| 5 | +import android.view.View; | ||
| 6 | + | ||
| 7 | +import com.cnlive.moudle.pedometer.model.RunningFinishBean; | ||
| 8 | +import com.cnlive.moudle.pedometer.ui.fragment.ALLScoreDetailFragment; | ||
| 9 | +import com.cnlive.moudle.pedometer.utils.TimeUtil; | ||
| 10 | +import com.hannesdorfmann.mosby3.mvp.MvpView; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * 全部成绩详情页 | ||
| 14 | + * | ||
| 15 | + * @author ShinnyYang | ||
| 16 | + */ | ||
| 17 | +public class ALLScoreDetailFragmentView implements MvpView { | ||
| 18 | + private ALLScoreDetailFragment fragment; | ||
| 19 | + private RunningFinishBean runningFinishBean; | ||
| 20 | + | ||
| 21 | + public ALLScoreDetailFragmentView(ALLScoreDetailFragment fragment) { | ||
| 22 | + this.fragment = fragment; | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + public Context getContext() { | ||
| 26 | + return fragment == null ? null : fragment.getActivity(); | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + public void initView(RunningFinishBean runningFinishBean) { | ||
| 30 | + this.runningFinishBean = runningFinishBean; | ||
| 31 | + //隐藏开始按钮 | ||
| 32 | + fragment.binding.rlScrollViewStartBtn.setVisibility(View.GONE); | ||
| 33 | + //设置标题 | ||
| 34 | + fragment.binding.includeFinishUserInfo.tvStreetName.setText(runningFinishBean.getStreetTitle()); | ||
| 35 | + //设置距离 | ||
| 36 | + fragment.binding.includeFinishUserInfo.tvDistance.setText(runningFinishBean.getRunDistance()); | ||
| 37 | + //设置配速 | ||
| 38 | + fragment.binding.includeFinishUserInfo.tvSpeed.setText(runningFinishBean.getSpeed()); | ||
| 39 | + if (!TextUtils.isEmpty(runningFinishBean.getEmployTime())) { | ||
| 40 | + //设置用时 | ||
| 41 | + fragment.binding.includeFinishUserInfo.tvTimer.setText(TimeUtil.stampToChronometer(Long.parseLong(runningFinishBean.getEmployTime()))); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + //设置日期 | ||
| 45 | + | ||
| 46 | + } | ||
| 47 | +} |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/LineUpAgainView.java
| @@ -4,6 +4,7 @@ import android.support.v7.widget.LinearLayoutManager; | @@ -4,6 +4,7 @@ import android.support.v7.widget.LinearLayoutManager; | ||
| 4 | import android.view.View; | 4 | import android.view.View; |
| 5 | 5 | ||
| 6 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | 6 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 7 | +import com.cnlive.moudle.pedometer.frame.presenter.LineUpAgainPresenter; | ||
| 7 | import com.cnlive.moudle.pedometer.sql.entity.FailedEntity; | 8 | import com.cnlive.moudle.pedometer.sql.entity.FailedEntity; |
| 8 | import com.cnlive.moudle.pedometer.ui.activity.UploadFailDetailActivity; | 9 | import com.cnlive.moudle.pedometer.ui.activity.UploadFailDetailActivity; |
| 9 | import com.cnlive.moudle.pedometer.ui.adapter.LineUpAgainAdapter; | 10 | import com.cnlive.moudle.pedometer.ui.adapter.LineUpAgainAdapter; |
| @@ -50,5 +51,38 @@ public class LineUpAgainView implements MvpView { | @@ -50,5 +51,38 @@ public class LineUpAgainView implements MvpView { | ||
| 50 | UploadFailDetailActivity.startActivity(fragment.getActivity(), bean); | 51 | UploadFailDetailActivity.startActivity(fragment.getActivity(), bean); |
| 51 | } | 52 | } |
| 52 | }); | 53 | }); |
| 54 | + //设置重新上传按钮点击事件 | ||
| 55 | + againAdapter.setOnRestartUploadClickListener(new LineUpAgainAdapter.OnRestartUploadClickListener() { | ||
| 56 | + @Override | ||
| 57 | + public void onRestartUploadClickListener(FailedEntity failedEntity) { | ||
| 58 | + if (fragment.getActivity() == null || fragment.getPresenter() == null) { | ||
| 59 | + return; | ||
| 60 | + } | ||
| 61 | + fragment.getPresenter().queryHistoryTraceNoMap(fragment.getActivity(), failedEntity, new LineUpAgainPresenter.onResultListener() { | ||
| 62 | + @Override | ||
| 63 | + public void onSuccess() { | ||
| 64 | + //刷新列表 | ||
| 65 | + List<FailedEntity> failedEntities = StepUtil.getFailListData(fragment.getActivity(), CommonInfo.getUserId(fragment.getActivity())); | ||
| 66 | + if (failedEntities == null || failedEntities.size() < 1) { | ||
| 67 | + fragment.binding.llNoFailTip.setVisibility(View.VISIBLE); | ||
| 68 | + } else { | ||
| 69 | + uploadList(failedEntities); | ||
| 70 | + } | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + @Override | ||
| 74 | + public void onFailed(String tip) { | ||
| 75 | + | ||
| 76 | + } | ||
| 77 | + }); | ||
| 78 | + } | ||
| 79 | + }); | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + public void uploadList(List<FailedEntity> failedEntities) { | ||
| 83 | + //更新数据 | ||
| 84 | + if (againAdapter != null) { | ||
| 85 | + againAdapter.uploadData(failedEntities); | ||
| 86 | + } | ||
| 53 | } | 87 | } |
| 54 | } | 88 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RaceRecorView.java
| @@ -10,6 +10,7 @@ import com.cnlive.moudle.pedometer.model.RunningFinishBean; | @@ -10,6 +10,7 @@ import com.cnlive.moudle.pedometer.model.RunningFinishBean; | ||
| 10 | import com.cnlive.moudle.pedometer.net.bean.BaseInfo; | 10 | import com.cnlive.moudle.pedometer.net.bean.BaseInfo; |
| 11 | import com.cnlive.moudle.pedometer.net.bean.EventRouteRecordBeanVoListBean; | 11 | import com.cnlive.moudle.pedometer.net.bean.EventRouteRecordBeanVoListBean; |
| 12 | import com.cnlive.moudle.pedometer.net.bean.RaceRecordInfo; | 12 | import com.cnlive.moudle.pedometer.net.bean.RaceRecordInfo; |
| 13 | +import com.cnlive.moudle.pedometer.ui.activity.ALLScoreDetailActivity; | ||
| 13 | import com.cnlive.moudle.pedometer.ui.activity.ShareRecordActivity; | 14 | import com.cnlive.moudle.pedometer.ui.activity.ShareRecordActivity; |
| 14 | import com.cnlive.moudle.pedometer.ui.adapter.RaceRecordAdapter; | 15 | import com.cnlive.moudle.pedometer.ui.adapter.RaceRecordAdapter; |
| 15 | import com.cnlive.moudle.pedometer.ui.fragment.RaceRecorFragment; | 16 | import com.cnlive.moudle.pedometer.ui.fragment.RaceRecorFragment; |
| @@ -40,7 +41,7 @@ public class RaceRecorView implements MvpView { | @@ -40,7 +41,7 @@ public class RaceRecorView implements MvpView { | ||
| 40 | .create(); | 41 | .create(); |
| 41 | } | 42 | } |
| 42 | 43 | ||
| 43 | - public void initView(){ | 44 | + public void initView() { |
| 44 | fragment.binding.topbar.addLeftImageButton(R.drawable.top_back_black, R.id.fragment_back).setOnClickListener(v -> { | 45 | fragment.binding.topbar.addLeftImageButton(R.drawable.top_back_black, R.id.fragment_back).setOnClickListener(v -> { |
| 45 | fragment.getActivity().finish(); | 46 | fragment.getActivity().finish(); |
| 46 | }); | 47 | }); |
| @@ -49,58 +50,74 @@ public class RaceRecorView implements MvpView { | @@ -49,58 +50,74 @@ public class RaceRecorView implements MvpView { | ||
| 49 | fragment.binding.refreshLayout.setRefreshFooter(new ClassicsFooter(fragment.getActivity())); | 50 | fragment.binding.refreshLayout.setRefreshFooter(new ClassicsFooter(fragment.getActivity())); |
| 50 | } | 51 | } |
| 51 | 52 | ||
| 52 | - public void setData(BaseInfo<RaceRecordInfo> raceRecordInfoBaseInfo){ | 53 | + public void setData(BaseInfo<RaceRecordInfo> raceRecordInfoBaseInfo) { |
| 53 | hideLoading(); | 54 | hideLoading(); |
| 54 | fragment.binding.ryRecord.setVisibility(View.VISIBLE); | 55 | fragment.binding.ryRecord.setVisibility(View.VISIBLE); |
| 55 | fragment.binding.txAll.setVisibility(View.VISIBLE); | 56 | fragment.binding.txAll.setVisibility(View.VISIBLE); |
| 56 | - if(raceRecordInfoBaseInfo.getData().getBestResult() == null){ | 57 | + if (raceRecordInfoBaseInfo.getData().getBestResult() == null) { |
| 57 | showEmpty(); | 58 | showEmpty(); |
| 58 | return; | 59 | return; |
| 59 | } | 60 | } |
| 60 | 61 | ||
| 61 | - if(fragment.currentPage == 1){ | 62 | + if (fragment.currentPage == 1) { |
| 62 | list.clear(); | 63 | list.clear(); |
| 63 | list.addAll(raceRecordInfoBaseInfo.getData().getEventRouteRecordBeanVoList()); | 64 | list.addAll(raceRecordInfoBaseInfo.getData().getEventRouteRecordBeanVoList()); |
| 64 | - if(adapter == null){ | ||
| 65 | - RaceRecordInfo.BestResultBean bestResultBean = raceRecordInfoBaseInfo.getData().getBestResult(); | 65 | + if (adapter == null) { |
| 66 | + RaceRecordInfo.BestResultBean bestResultBean = raceRecordInfoBaseInfo.getData().getBestResult(); | ||
| 66 | fragment.binding.kilometerNum.setText(bestResultBean.getMileage()); | 67 | fragment.binding.kilometerNum.setText(bestResultBean.getMileage()); |
| 67 | fragment.binding.stepNum.setText(bestResultBean.getStep()); | 68 | fragment.binding.stepNum.setText(bestResultBean.getStep()); |
| 68 | fragment.binding.kilometerTime.setText(bestResultBean.getEmployTime()); | 69 | fragment.binding.kilometerTime.setText(bestResultBean.getEmployTime()); |
| 69 | fragment.binding.kilometerSpeed.setText(bestResultBean.getPace()); | 70 | fragment.binding.kilometerSpeed.setText(bestResultBean.getPace()); |
| 70 | fragment.binding.recordRecy.setLayoutManager(new LinearLayoutManager(fragment.getActivity())); | 71 | fragment.binding.recordRecy.setLayoutManager(new LinearLayoutManager(fragment.getActivity())); |
| 71 | - adapter = new RaceRecordAdapter(list,fragment.getActivity()); | 72 | + adapter = new RaceRecordAdapter(list, fragment.getActivity()); |
| 72 | fragment.binding.recordRecy.setAdapter(adapter); | 73 | fragment.binding.recordRecy.setAdapter(adapter); |
| 73 | adapter.setOnClickListener(new RaceRecordAdapter.OnClickListener() { | 74 | adapter.setOnClickListener(new RaceRecordAdapter.OnClickListener() { |
| 74 | @Override | 75 | @Override |
| 75 | public void onClickListener(EventRouteRecordBeanVoListBean bean, int position) { | 76 | public void onClickListener(EventRouteRecordBeanVoListBean bean, int position) { |
| 76 | - CollRunningFinishActivity.startActivity(fragment.getActivity(),new RunningFinishBean()); | 77 | + if (null != bean) { |
| 78 | + //设置数据 | ||
| 79 | + RunningFinishBean runningFinishBean = new RunningFinishBean(); | ||
| 80 | + //设置赛事标题 | ||
| 81 | + runningFinishBean.setStreetTitle(bean.getEventTitle()); | ||
| 82 | + //设置步数 | ||
| 83 | + runningFinishBean.setStep(bean.getStep()); | ||
| 84 | + //设置距离 | ||
| 85 | + runningFinishBean.setRunDistance(bean.getMileage()); | ||
| 86 | + //设置配速 | ||
| 87 | + runningFinishBean.setSpeed(bean.getPace()); | ||
| 88 | + //设置用书 | ||
| 89 | + runningFinishBean.setEmployTime(bean.getEmployTime()); | ||
| 90 | + //设置起点 | ||
| 91 | + ALLScoreDetailActivity.startActivity(fragment.getActivity(), runningFinishBean); | ||
| 92 | + | ||
| 93 | + } | ||
| 77 | } | 94 | } |
| 78 | }); | 95 | }); |
| 79 | fragment.binding.topbar.addRightImageButton(R.drawable.share_img, R.id.fragment_more) | 96 | fragment.binding.topbar.addRightImageButton(R.drawable.share_img, R.id.fragment_more) |
| 80 | .setOnClickListener(v -> { | 97 | .setOnClickListener(v -> { |
| 81 | //分享 | 98 | //分享 |
| 82 | - ShareRecordActivity.newInstance(fragment.getActivity(),fragment.raceTitle,bestResultBean.getMileage(),bestResultBean.getStep(), | ||
| 83 | - bestResultBean.getEmployTime(),bestResultBean.getPace()); | 99 | + ShareRecordActivity.newInstance(fragment.getActivity(), fragment.raceTitle, bestResultBean.getMileage(), bestResultBean.getStep(), |
| 100 | + bestResultBean.getEmployTime(), bestResultBean.getPace()); | ||
| 84 | }); | 101 | }); |
| 85 | 102 | ||
| 86 | - }else { | 103 | + } else { |
| 87 | adapter.notifyDataSetChanged(); | 104 | adapter.notifyDataSetChanged(); |
| 88 | } | 105 | } |
| 89 | } | 106 | } |
| 90 | 107 | ||
| 91 | - if(list.size() != 0){ | 108 | + if (list.size() != 0) { |
| 92 | fragment.binding.emptyNet.setVisibility(View.GONE); | 109 | fragment.binding.emptyNet.setVisibility(View.GONE); |
| 93 | fragment.binding.refreshLayout.setVisibility(View.VISIBLE); | 110 | fragment.binding.refreshLayout.setVisibility(View.VISIBLE); |
| 94 | - }else { | 111 | + } else { |
| 95 | showEmpty(); | 112 | showEmpty(); |
| 96 | } | 113 | } |
| 97 | 114 | ||
| 98 | - if(raceRecordInfoBaseInfo.getData().getEventRouteRecordBeanVoList().size() < fragment.pageSize){ | 115 | + if (raceRecordInfoBaseInfo.getData().getEventRouteRecordBeanVoList().size() < fragment.pageSize) { |
| 99 | fragment.binding.refreshLayout.setEnableLoadMore(false); | 116 | fragment.binding.refreshLayout.setEnableLoadMore(false); |
| 100 | - }else { | 117 | + } else { |
| 101 | fragment.binding.refreshLayout.setEnableLoadMore(true); | 118 | fragment.binding.refreshLayout.setEnableLoadMore(true); |
| 102 | } | 119 | } |
| 103 | - if(fragment.currentPage > 1){ | 120 | + if (fragment.currentPage > 1) { |
| 104 | list.addAll(raceRecordInfoBaseInfo.getData().getEventRouteRecordBeanVoList()); | 121 | list.addAll(raceRecordInfoBaseInfo.getData().getEventRouteRecordBeanVoList()); |
| 105 | adapter.notifyDataSetChanged(); | 122 | adapter.notifyDataSetChanged(); |
| 106 | } | 123 | } |
| @@ -108,7 +125,7 @@ public class RaceRecorView implements MvpView { | @@ -108,7 +125,7 @@ public class RaceRecorView implements MvpView { | ||
| 108 | fragment.binding.refreshLayout.finishLoadMore(); | 125 | fragment.binding.refreshLayout.finishLoadMore(); |
| 109 | } | 126 | } |
| 110 | 127 | ||
| 111 | - public void showEmpty(){ | 128 | + public void showEmpty() { |
| 112 | fragment.binding.refreshLayout.setVisibility(View.GONE); | 129 | fragment.binding.refreshLayout.setVisibility(View.GONE); |
| 113 | fragment.binding.emptyNet.setVisibility(View.VISIBLE); | 130 | fragment.binding.emptyNet.setVisibility(View.VISIBLE); |
| 114 | fragment.binding.kilometerNum.setText("0.00"); | 131 | fragment.binding.kilometerNum.setText("0.00"); |
| @@ -118,7 +135,7 @@ public class RaceRecorView implements MvpView { | @@ -118,7 +135,7 @@ public class RaceRecorView implements MvpView { | ||
| 118 | fragment.binding.emptyNet.show("你还没有该线路的成绩", "", R.drawable.bmcg_has); | 135 | fragment.binding.emptyNet.show("你还没有该线路的成绩", "", R.drawable.bmcg_has); |
| 119 | } | 136 | } |
| 120 | 137 | ||
| 121 | - public void showError(String msg){ | 138 | + public void showError(String msg) { |
| 122 | fragment.binding.refreshLayout.finishRefresh(); | 139 | fragment.binding.refreshLayout.finishRefresh(); |
| 123 | fragment.binding.refreshLayout.finishLoadMore(); | 140 | fragment.binding.refreshLayout.finishLoadMore(); |
| 124 | if (list.size() == 0) { | 141 | if (list.size() == 0) { |
| @@ -132,7 +149,7 @@ public class RaceRecorView implements MvpView { | @@ -132,7 +149,7 @@ public class RaceRecorView implements MvpView { | ||
| 132 | @Override | 149 | @Override |
| 133 | public void onClick(View v) { | 150 | public void onClick(View v) { |
| 134 | fragment.currentPage = 1; | 151 | fragment.currentPage = 1; |
| 135 | - fragment.getPresenter().getData(fragment.getActivity(), CommonInfo.getStreetId(fragment.getActivity()),CommonInfo.getUserId(fragment.getActivity()),fragment.currentPage,fragment.pageSize); | 152 | + fragment.getPresenter().getData(fragment.getActivity(), CommonInfo.getStreetId(fragment.getActivity()), CommonInfo.getUserId(fragment.getActivity()), fragment.currentPage, fragment.pageSize); |
| 136 | } | 153 | } |
| 137 | }); | 154 | }); |
| 138 | fragment.binding.emptyNet.setLoadingShowing(false); | 155 | fragment.binding.emptyNet.setLoadingShowing(false); |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunMainFragmentView.java
| @@ -122,7 +122,6 @@ public class RunMainFragmentView implements MvpView { | @@ -122,7 +122,6 @@ public class RunMainFragmentView implements MvpView { | ||
| 122 | * 初始化相关视图 | 122 | * 初始化相关视图 |
| 123 | */ | 123 | */ |
| 124 | public void initView(RunRaceDetailInfo runRaceDetailInfo) { | 124 | public void initView(RunRaceDetailInfo runRaceDetailInfo) { |
| 125 | - Log.e(TAG, "initView: +时间" + SystemClock.elapsedRealtime()); | ||
| 126 | uid = CommonInfo.getUserId(getContext()); | 125 | uid = CommonInfo.getUserId(getContext()); |
| 127 | userStepEntity = StepUtil.getUserStepData(getContext(), uid); | 126 | userStepEntity = StepUtil.getUserStepData(getContext(), uid); |
| 128 | //设置数据 | 127 | //设置数据 |
| @@ -138,9 +137,14 @@ public class RunMainFragmentView implements MvpView { | @@ -138,9 +137,14 @@ public class RunMainFragmentView implements MvpView { | ||
| 138 | StepUtil.setQueryTraceTime(getContext(), CommonInfo.getUserId(getContext()), startTime, endTime, runRaceDetailInfo.getEntityName()); | 137 | StepUtil.setQueryTraceTime(getContext(), CommonInfo.getUserId(getContext()), startTime, endTime, runRaceDetailInfo.getEntityName()); |
| 139 | } | 138 | } |
| 140 | //设置重要点 | 139 | //设置重要点 |
| 141 | - if (TextUtils.isEmpty(userStepEntity.getImportPoint())){ | ||
| 142 | - StepUtil.setImportPoints(getContext(),CommonInfo.getUserId(getContext()),runRaceDetailInfo.getLatLongitude()); | ||
| 143 | - } | 140 | + if (TextUtils.isEmpty(userStepEntity.getImportPoint())) { |
| 141 | + StepUtil.setImportPoints(getContext(), CommonInfo.getUserId(getContext()), runRaceDetailInfo.getLatLongitude()); | ||
| 142 | + } | ||
| 143 | + //设置开始时间和赛事id | ||
| 144 | + if (TextUtils.isEmpty(userStepEntity.getStreetId())) { | ||
| 145 | + StepUtil.setStepStartData(getContext(), uid, TimeUtil.getNowTimeStamp(), CommonInfo.getStreetId(getContext())); | ||
| 146 | + } | ||
| 147 | + | ||
| 144 | } | 148 | } |
| 145 | initLocationClient(); | 149 | initLocationClient(); |
| 146 | fragment.binding.llRunMainRoot.setVisibility(View.GONE); | 150 | fragment.binding.llRunMainRoot.setVisibility(View.GONE); |
| @@ -370,7 +374,7 @@ public class RunMainFragmentView implements MvpView { | @@ -370,7 +374,7 @@ public class RunMainFragmentView implements MvpView { | ||
| 370 | runningFinishBean.setSpeed(fragment.binding.tvSpeed.getText().toString()); | 374 | runningFinishBean.setSpeed(fragment.binding.tvSpeed.getText().toString()); |
| 371 | runningFinishBean.setStep(fragment.binding.tvStepCount.getText().toString()); | 375 | runningFinishBean.setStep(fragment.binding.tvStepCount.getText().toString()); |
| 372 | runningFinishBean.setTime(fragment.binding.chronometer.getText().toString()); | 376 | runningFinishBean.setTime(fragment.binding.chronometer.getText().toString()); |
| 373 | - runningFinishBean.setDate(TimeUtil.getStampToTime(userStepEntity.getFinishTimeStamp()*1000,"yyyy/MM/dd HH:mm")); | 377 | + runningFinishBean.setDate(TimeUtil.getStampToTime(userStepEntity.getFinishTimeStamp() * 1000, "yyyy/MM/dd HH:mm")); |
| 374 | runningFinishBean.setStreetTitle(userStepEntity.getStreetTitle()); | 378 | runningFinishBean.setStreetTitle(userStepEntity.getStreetTitle()); |
| 375 | //设置用时 | 379 | //设置用时 |
| 376 | runningFinishBean.setEmployTime(employTime); | 380 | runningFinishBean.setEmployTime(employTime); |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/UploadFailDetailFragmentView.java
| @@ -4,16 +4,24 @@ import android.content.Context; | @@ -4,16 +4,24 @@ import android.content.Context; | ||
| 4 | import android.text.TextUtils; | 4 | import android.text.TextUtils; |
| 5 | import android.view.View; | 5 | import android.view.View; |
| 6 | 6 | ||
| 7 | +import com.baidu.mapapi.map.BaiduMap; | ||
| 8 | +import com.baidu.mapapi.map.MapView; | ||
| 9 | +import com.baidu.mapapi.map.UiSettings; | ||
| 7 | import com.bumptech.glide.Glide; | 10 | import com.bumptech.glide.Glide; |
| 11 | +import com.cnlive.libs.base.util.ToastUtil; | ||
| 8 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | 12 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 9 | import com.cnlive.moudle.pedometer.sql.entity.FailedEntity; | 13 | import com.cnlive.moudle.pedometer.sql.entity.FailedEntity; |
| 10 | import com.cnlive.moudle.pedometer.ui.fragment.UploadFailDetailFragment; | 14 | import com.cnlive.moudle.pedometer.ui.fragment.UploadFailDetailFragment; |
| 11 | import com.cnlive.moudle.pedometer.utils.TimeUtil; | 15 | import com.cnlive.moudle.pedometer.utils.TimeUtil; |
| 16 | +import com.example.moudle_pedometer.R; | ||
| 12 | import com.hannesdorfmann.mosby3.mvp.MvpView; | 17 | import com.hannesdorfmann.mosby3.mvp.MvpView; |
| 13 | 18 | ||
| 14 | public class UploadFailDetailFragmentView implements MvpView { | 19 | public class UploadFailDetailFragmentView implements MvpView { |
| 15 | private UploadFailDetailFragment fragment; | 20 | private UploadFailDetailFragment fragment; |
| 16 | private FailedEntity failedEntity; | 21 | private FailedEntity failedEntity; |
| 22 | + public BaiduMap baiduMap; | ||
| 23 | + private MapView mMapView; | ||
| 24 | + private UiSettings mUiSettings; | ||
| 17 | 25 | ||
| 18 | public UploadFailDetailFragmentView(UploadFailDetailFragment fragment) { | 26 | public UploadFailDetailFragmentView(UploadFailDetailFragment fragment) { |
| 19 | this.fragment = fragment; | 27 | this.fragment = fragment; |
| @@ -88,8 +96,72 @@ public class UploadFailDetailFragmentView implements MvpView { | @@ -88,8 +96,72 @@ public class UploadFailDetailFragmentView implements MvpView { | ||
| 88 | fragment.binding.rlScrollViewStartBtn.setOnClickListener(new View.OnClickListener() { | 96 | fragment.binding.rlScrollViewStartBtn.setOnClickListener(new View.OnClickListener() { |
| 89 | @Override | 97 | @Override |
| 90 | public void onClick(View view) { | 98 | public void onClick(View view) { |
| 99 | + if (fragment.getActivity() == null || fragment.getPresenter() == null || failedEntity == null) { | ||
| 100 | + return; | ||
| 101 | + } | ||
| 102 | + if (fragment.binding.rlScrollViewStartBtn.getTag() != null) { | ||
| 103 | + if ("1".equals(fragment.binding.rlScrollViewStartBtn.getTag().toString())) { | ||
| 104 | + fragment.getPresenter().saveRouteData(fragment.getActivity(), failedEntity); | ||
| 105 | + } else { | ||
| 106 | + if (fragment.getPresenter() == null || failedEntity == null) { | ||
| 107 | + return; | ||
| 108 | + } | ||
| 109 | + fragment.getPresenter().queryHistoryTrace(fragment.getActivity(), failedEntity); | ||
| 110 | + } | ||
| 111 | + } | ||
| 91 | 112 | ||
| 92 | } | 113 | } |
| 93 | }); | 114 | }); |
| 94 | } | 115 | } |
| 116 | + | ||
| 117 | + public void initMap() { | ||
| 118 | + this.mMapView = fragment.binding.mapView; | ||
| 119 | + if (baiduMap == null) { | ||
| 120 | + baiduMap = mMapView.getMap(); | ||
| 121 | + } | ||
| 122 | + if (mUiSettings == null) { | ||
| 123 | + mUiSettings = baiduMap.getUiSettings(); | ||
| 124 | + } | ||
| 125 | + //启动所有手势 | ||
| 126 | + mUiSettings.setAllGesturesEnabled(true); | ||
| 127 | + //通过设置enable为true或false 选择是否显示缩放按钮 | ||
| 128 | + mMapView.showZoomControls(false); | ||
| 129 | + mUiSettings.setEnlargeCenterWithDoubleClickEnable(true); | ||
| 130 | + //隐藏自带的指南针,改用自定义指南针 杨帅 | ||
| 131 | + mUiSettings.setCompassEnabled(false); | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + /** | ||
| 135 | + * 更新路线是否完成 | ||
| 136 | + * | ||
| 137 | + * @param state | ||
| 138 | + */ | ||
| 139 | + public void updateIsFinish(String state) { | ||
| 140 | + if (getContext() == null || TextUtils.isEmpty(state)) { | ||
| 141 | + return; | ||
| 142 | + } | ||
| 143 | + if ("1".equals(state)) { | ||
| 144 | + fragment.binding.includeFinishRunRoute.tvFinishState.setText("路线完成"); | ||
| 145 | + fragment.binding.includeFinishRunRoute.tvFinishState.setTextColor(getContext().getResources().getColor(R.color.green_round)); | ||
| 146 | + } else if ("0".equals(state)) { | ||
| 147 | + fragment.binding.includeFinishRunRoute.tvFinishState.setText("路线未完成"); | ||
| 148 | + fragment.binding.includeFinishRunRoute.tvFinishState.setTextColor(getContext().getResources().getColor(R.color.red)); | ||
| 149 | + } | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + /** | ||
| 153 | + * 更新开始按钮状态 | ||
| 154 | + * | ||
| 155 | + * @param isQuerySuccess | ||
| 156 | + */ | ||
| 157 | + public void updateStartBtnState(boolean isQuerySuccess) { | ||
| 158 | + if (fragment.getActivity() == null) { | ||
| 159 | + return; | ||
| 160 | + } | ||
| 161 | + if (!isQuerySuccess) { | ||
| 162 | + fragment.binding.rlScrollViewStartBtn.setTag("0"); | ||
| 163 | + } else { | ||
| 164 | + fragment.binding.rlScrollViewStartBtn.setTag("1"); | ||
| 165 | + } | ||
| 166 | + } | ||
| 95 | } | 167 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/service/StepService.java
| @@ -250,19 +250,7 @@ public class StepService extends Service implements SensorEventListener { | @@ -250,19 +250,7 @@ public class StepService extends Service implements SensorEventListener { | ||
| 250 | CommonInfo.setIsFirstStepSendTraceTip(getApplicationContext(), false); | 250 | CommonInfo.setIsFirstStepSendTraceTip(getApplicationContext(), false); |
| 251 | EventBus.getDefault().post(new MessageEvent(Constant.START_TRACE_GATHER_SUCCESS, "")); | 251 | EventBus.getDefault().post(new MessageEvent(Constant.START_TRACE_GATHER_SUCCESS, "")); |
| 252 | } | 252 | } |
| 253 | - //设置用户开始时间以及赛事ID | ||
| 254 | - UserStepEntity userStepEntity = StepUtil.getUserStepData(getApplicationContext(), CommonInfo.getUserId(getApplicationContext())); | ||
| 255 | - if (userStepEntity == null) { | ||
| 256 | - StepUtil.setStepStartData(getApplicationContext(), userId, TimeUtil.getNowTimeStamp(), CommonInfo.getStreetId(getApplicationContext())); | ||
| 257 | - //设置从服务器获取的时间(后续查询历史轨迹的时间,要从数据库中获取,因为涉及到现有运动恢复问题) | ||
| 258 | - int fenceId = CommonInfo.getFenceId(getApplicationContext()); | ||
| 259 | - Log.e(TAG, "onStartTraceCallback: 保存的围栏id" + fenceId); | ||
| 260 | - //设置围栏id | ||
| 261 | - StepUtil.setFenceId(getApplicationContext(), CommonInfo.getUserId(getApplicationContext()), fenceId); | ||
| 262 | - //清空临时保存的时间 | ||
| 263 | - CommonInfo.setFenceId(getApplicationContext(), -1); | ||
| 264 | 253 | ||
| 265 | - } | ||
| 266 | //开始设置围栏报警 | 254 | //开始设置围栏报警 |
| 267 | startQueryFence(); | 255 | startQueryFence(); |
| 268 | 256 | ||
| @@ -515,7 +503,14 @@ public class StepService extends Service implements SensorEventListener { | @@ -515,7 +503,14 @@ public class StepService extends Service implements SensorEventListener { | ||
| 515 | if (!EventBus.getDefault().isRegistered(this)) { | 503 | if (!EventBus.getDefault().isRegistered(this)) { |
| 516 | EventBus.getDefault().register(this); | 504 | EventBus.getDefault().register(this); |
| 517 | } | 505 | } |
| 518 | - | 506 | + //设置围栏ID |
| 507 | + UserStepEntity userStepEntity = StepUtil.getUserStepData(getApplicationContext(), CommonInfo.getUserId(getApplicationContext())); | ||
| 508 | + if (userStepEntity == null) { | ||
| 509 | + int fenceId = CommonInfo.getFenceId(getApplicationContext()); | ||
| 510 | + Log.e(TAG, "onStartTraceCallback: 保存的围栏id" + fenceId); | ||
| 511 | + //设置围栏id | ||
| 512 | + StepUtil.setFenceId(getApplicationContext(), CommonInfo.getUserId(getApplicationContext()), fenceId); | ||
| 513 | + } | ||
| 519 | entityName = userId; | 514 | entityName = userId; |
| 520 | initTodayData(userId); | 515 | initTodayData(userId); |
| 521 | initTrace(); | 516 | initTrace(); |
| @@ -627,14 +622,17 @@ public class StepService extends Service implements SensorEventListener { | @@ -627,14 +622,17 @@ public class StepService extends Service implements SensorEventListener { | ||
| 627 | handler.removeCallbacks(speedRunnable); | 622 | handler.removeCallbacks(speedRunnable); |
| 628 | } | 623 | } |
| 629 | // Log.e("杀死", "MyTestService"); | 624 | // Log.e("杀死", "MyTestService"); |
| 630 | - lastStep=0; | 625 | + lastStep = 0; |
| 631 | hasStepCount = 0; | 626 | hasStepCount = 0; |
| 632 | hasRecord = false; | 627 | hasRecord = false; |
| 633 | CURRENT_STEP = 0; | 628 | CURRENT_STEP = 0; |
| 634 | previousStepCount = 0; | 629 | previousStepCount = 0; |
| 635 | - sensorManager = null; | 630 | + if (sensorManager != null) { |
| 631 | + sensorManager.unregisterListener(StepService.this); | ||
| 632 | + sensorManager = null; | ||
| 633 | + } | ||
| 636 | stepSensorType = -1; | 634 | stepSensorType = -1; |
| 637 | - time=null; | 635 | + time = null; |
| 638 | } | 636 | } |
| 639 | 637 | ||
| 640 | //接收事件 | 638 | //接收事件 |
| @@ -1017,7 +1015,7 @@ public class StepService extends Service implements SensorEventListener { | @@ -1017,7 +1015,7 @@ public class StepService extends Service implements SensorEventListener { | ||
| 1017 | if (stepSensorType == Sensor.TYPE_STEP_COUNTER) { | 1015 | if (stepSensorType == Sensor.TYPE_STEP_COUNTER) { |
| 1018 | //获取当前传感器返回的临时步数 | 1016 | //获取当前传感器返回的临时步数 |
| 1019 | int tempStep = (int) event.values[0]; | 1017 | int tempStep = (int) event.values[0]; |
| 1020 | - Log.e(TAG, "onSensorChanged: 第一次,tempStep:" + tempStep + "lastStep:" + lastStep + ",previousStepCount" + previousStepCount + ",CURRENT_STEP" + CURRENT_STEP); | 1018 | +// Log.e(TAG, "onSensorChanged: 第一次,tempStep:" + tempStep + "lastStep:" + lastStep + ",previousStepCount" + previousStepCount + ",CURRENT_STEP" + CURRENT_STEP); |
| 1021 | //首次如果没有获取手机系统中已有的步数则获取一次系统中APP还未开始记步的步数 | 1019 | //首次如果没有获取手机系统中已有的步数则获取一次系统中APP还未开始记步的步数 |
| 1022 | if (!hasRecord) { | 1020 | if (!hasRecord) { |
| 1023 | hasRecord = true; | 1021 | hasRecord = true; |
| @@ -1026,26 +1024,26 @@ public class StepService extends Service implements SensorEventListener { | @@ -1026,26 +1024,26 @@ public class StepService extends Service implements SensorEventListener { | ||
| 1026 | } else { | 1024 | } else { |
| 1027 | if (tempStep > lastStep) { | 1025 | if (tempStep > lastStep) { |
| 1028 | //获取APP打开到现在的总步数=本次系统回调的总步数-APP打开之前已有的步数 | 1026 | //获取APP打开到现在的总步数=本次系统回调的总步数-APP打开之前已有的步数 |
| 1029 | - Log.e(TAG, "tempStep: " + tempStep + ",hasStepCount:" + hasStepCount); | 1027 | +// Log.e(TAG, "tempStep: " + tempStep + ",hasStepCount:" + hasStepCount); |
| 1030 | int thisStepCount = tempStep - hasStepCount; | 1028 | int thisStepCount = tempStep - hasStepCount; |
| 1031 | - Log.e(TAG, "onSensorChanged: thisStepCount" + thisStepCount); | 1029 | +// Log.e(TAG, "onSensorChanged: thisStepCount" + thisStepCount); |
| 1032 | //本次有效步数=(APP打开后所记录的总步数-上一次APP打开后所记录的总步数) | 1030 | //本次有效步数=(APP打开后所记录的总步数-上一次APP打开后所记录的总步数) |
| 1033 | int thisStep = thisStepCount - previousStepCount; | 1031 | int thisStep = thisStepCount - previousStepCount; |
| 1034 | //记录最后一次APP打开到现在的总步数 | 1032 | //记录最后一次APP打开到现在的总步数 |
| 1035 | previousStepCount = thisStepCount; | 1033 | previousStepCount = thisStepCount; |
| 1036 | - Log.e(TAG, "本次有效步数: thisStep" + thisStep + ",previousStepCount:" + previousStepCount); | 1034 | +// Log.e(TAG, "本次有效步数: thisStep" + thisStep + ",previousStepCount:" + previousStepCount); |
| 1037 | //当用户点击暂停了 | 1035 | //当用户点击暂停了 |
| 1038 | if (pauseFlag) { | 1036 | if (pauseFlag) { |
| 1039 | thisStep = 0; | 1037 | thisStep = 0; |
| 1040 | - Log.e(TAG, "修改: thisStepCount" + thisStep); | 1038 | +// Log.e(TAG, "修改: thisStepCount" + thisStep); |
| 1041 | } | 1039 | } |
| 1042 | - Log.e(TAG, "onSensorChanged: CURRENT_STEP" + CURRENT_STEP); | 1040 | +// Log.e(TAG, "onSensorChanged: CURRENT_STEP" + CURRENT_STEP); |
| 1043 | if (CURRENT_STEP < 0) { | 1041 | if (CURRENT_STEP < 0) { |
| 1044 | CURRENT_STEP = -CURRENT_STEP; | 1042 | CURRENT_STEP = -CURRENT_STEP; |
| 1045 | } | 1043 | } |
| 1046 | //总步数=现有的步数+本次有效步数 | 1044 | //总步数=现有的步数+本次有效步数 |
| 1047 | CURRENT_STEP += (thisStep); | 1045 | CURRENT_STEP += (thisStep); |
| 1048 | - Log.e(TAG, "onSensorChanged: 加了以后" + CURRENT_STEP); | 1046 | +// Log.e(TAG, "onSensorChanged: 加了以后" + CURRENT_STEP); |
| 1049 | lastStep = tempStep; | 1047 | lastStep = tempStep; |
| 1050 | } | 1048 | } |
| 1051 | } | 1049 | } |
| @@ -1103,9 +1101,11 @@ public class StepService extends Service implements SensorEventListener { | @@ -1103,9 +1101,11 @@ public class StepService extends Service implements SensorEventListener { | ||
| 1103 | @Override | 1101 | @Override |
| 1104 | public void onFinish() { | 1102 | public void onFinish() { |
| 1105 | // 如果计时器正常结束,则开始计步 | 1103 | // 如果计时器正常结束,则开始计步 |
| 1106 | - time.cancel(); | ||
| 1107 | - save(); | ||
| 1108 | - startTimeCount(); | 1104 | + if (null != time) { |
| 1105 | + time.cancel(); | ||
| 1106 | + save(); | ||
| 1107 | + startTimeCount(); | ||
| 1108 | + } | ||
| 1109 | } | 1109 | } |
| 1110 | 1110 | ||
| 1111 | @Override | 1111 | @Override |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/ALLScoreDetailActivity.java
0 → 100644
| 1 | +package com.cnlive.moudle.pedometer.ui.activity; | ||
| 2 | + | ||
| 3 | +import android.app.Activity; | ||
| 4 | +import android.content.Intent; | ||
| 5 | +import android.os.Bundle; | ||
| 6 | + | ||
| 7 | +import com.cnlive.libs.base.ui.QMUIFragment; | ||
| 8 | +import com.cnlive.libs.base.ui.QMUIFragmentActivity; | ||
| 9 | +import com.cnlive.moudle.pedometer.model.RunningFinishBean; | ||
| 10 | +import com.cnlive.moudle.pedometer.ui.fragment.ALLScoreDetailFragment; | ||
| 11 | +import com.example.moudle_pedometer.R; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * 全部成绩详情 | ||
| 15 | + * | ||
| 16 | + * @author ShinnyYang | ||
| 17 | + */ | ||
| 18 | +public class ALLScoreDetailActivity extends QMUIFragmentActivity { | ||
| 19 | + @Override | ||
| 20 | + protected int getContextViewId() { | ||
| 21 | + return R.id.fragment_all_score_detail; | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + @Override | ||
| 25 | + protected void onCreate(Bundle savedInstanceState) { | ||
| 26 | + super.onCreate(savedInstanceState); | ||
| 27 | + RunningFinishBean runningFinishBean = (RunningFinishBean) getIntent().getExtras().getSerializable("runningFinishBean"); | ||
| 28 | + if (runningFinishBean != null) { | ||
| 29 | + addFragment(ALLScoreDetailFragment.newInstance(runningFinishBean)); | ||
| 30 | + } | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + public static void startActivity(Activity activity, RunningFinishBean runningFinishBean) { | ||
| 34 | + Intent intent = new Intent(activity, ALLScoreDetailActivity.class); | ||
| 35 | + intent.putExtra("runningFinishBean", runningFinishBean); | ||
| 36 | + activity.startActivity(intent); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + private void addFragment(QMUIFragment fragment) { | ||
| 40 | + getSupportFragmentManager().beginTransaction() | ||
| 41 | + .add(getContextViewId(), fragment, fragment.getClass().getSimpleName()) | ||
| 42 | + .addToBackStack(fragment.getClass().getSimpleName()) | ||
| 43 | + .commit(); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | +} |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/adapter/LineUpAgainAdapter.java
| @@ -28,6 +28,11 @@ public class LineUpAgainAdapter extends RecyclerView.Adapter<LineUpAgainAdapter. | @@ -28,6 +28,11 @@ public class LineUpAgainAdapter extends RecyclerView.Adapter<LineUpAgainAdapter. | ||
| 28 | private List<FailedEntity> list; | 28 | private List<FailedEntity> list; |
| 29 | private Context context; | 29 | private Context context; |
| 30 | private OnClickListener onClickListener; | 30 | private OnClickListener onClickListener; |
| 31 | + private OnRestartUploadClickListener onRestartUploadClickListener; | ||
| 32 | + | ||
| 33 | + public void setOnRestartUploadClickListener(OnRestartUploadClickListener onRestartUploadClickListener) { | ||
| 34 | + this.onRestartUploadClickListener = onRestartUploadClickListener; | ||
| 35 | + } | ||
| 31 | 36 | ||
| 32 | public void setOnClickListener(OnClickListener onClickListener) { | 37 | public void setOnClickListener(OnClickListener onClickListener) { |
| 33 | this.onClickListener = onClickListener; | 38 | this.onClickListener = onClickListener; |
| @@ -38,6 +43,11 @@ public class LineUpAgainAdapter extends RecyclerView.Adapter<LineUpAgainAdapter. | @@ -38,6 +43,11 @@ public class LineUpAgainAdapter extends RecyclerView.Adapter<LineUpAgainAdapter. | ||
| 38 | this.context = context; | 43 | this.context = context; |
| 39 | } | 44 | } |
| 40 | 45 | ||
| 46 | + public void uploadData(List<FailedEntity> failedEntities) { | ||
| 47 | + this.list = failedEntities; | ||
| 48 | + notifyDataSetChanged(); | ||
| 49 | + } | ||
| 50 | + | ||
| 41 | @NonNull | 51 | @NonNull |
| 42 | @Override | 52 | @Override |
| 43 | public MyHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { | 53 | public MyHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { |
| @@ -51,11 +61,14 @@ public class LineUpAgainAdapter extends RecyclerView.Adapter<LineUpAgainAdapter. | @@ -51,11 +61,14 @@ public class LineUpAgainAdapter extends RecyclerView.Adapter<LineUpAgainAdapter. | ||
| 51 | if (onClickListener != null) { | 61 | if (onClickListener != null) { |
| 52 | myHolder.ry_re.setOnClickListener(v -> onClickListener.onClickListener(list.get(i), i)); | 62 | myHolder.ry_re.setOnClickListener(v -> onClickListener.onClickListener(list.get(i), i)); |
| 53 | } | 63 | } |
| 64 | + if (onRestartUploadClickListener != null) { | ||
| 65 | + myHolder.again_up.setOnClickListener(v -> onRestartUploadClickListener.onRestartUploadClickListener(list.get(i))); | ||
| 66 | + } | ||
| 54 | //设置视图数据 | 67 | //设置视图数据 |
| 55 | if (myHolder != null) { | 68 | if (myHolder != null) { |
| 56 | //设置数据创建时间 | 69 | //设置数据创建时间 |
| 57 | - myHolder.up_day.setText(TimeUtil.getStampToTime(list.get(i).getCreatTimeStamp()*1000, "MM月dd日")); | ||
| 58 | - myHolder.up_record_time.setText(TimeUtil.getStampToTime(list.get(i).getCreatTimeStamp()*1000, " HH:mm")); | 70 | + myHolder.up_day.setText(TimeUtil.getStampToTime(list.get(i).getCreatTimeStamp() * 1000, "MM月dd日")); |
| 71 | + myHolder.up_record_time.setText(TimeUtil.getStampToTime(list.get(i).getCreatTimeStamp() * 1000, " HH:mm")); | ||
| 59 | //设置赛道标题 | 72 | //设置赛道标题 |
| 60 | myHolder.up_item_title.setText(list.get(i).getStreetTitle()); | 73 | myHolder.up_item_title.setText(list.get(i).getStreetTitle()); |
| 61 | //设置公里 | 74 | //设置公里 |
| @@ -107,4 +120,8 @@ public class LineUpAgainAdapter extends RecyclerView.Adapter<LineUpAgainAdapter. | @@ -107,4 +120,8 @@ public class LineUpAgainAdapter extends RecyclerView.Adapter<LineUpAgainAdapter. | ||
| 107 | public interface OnClickListener { | 120 | public interface OnClickListener { |
| 108 | void onClickListener(FailedEntity bean, int position); | 121 | void onClickListener(FailedEntity bean, int position); |
| 109 | } | 122 | } |
| 123 | + | ||
| 124 | + public interface OnRestartUploadClickListener { | ||
| 125 | + void onRestartUploadClickListener(FailedEntity failedEntity); | ||
| 126 | + } | ||
| 110 | } | 127 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/adapter/RaceRecordAdapter.java
| @@ -4,6 +4,7 @@ package com.cnlive.moudle.pedometer.ui.adapter; | @@ -4,6 +4,7 @@ package com.cnlive.moudle.pedometer.ui.adapter; | ||
| 4 | import android.content.Context; | 4 | import android.content.Context; |
| 5 | import android.support.annotation.NonNull; | 5 | import android.support.annotation.NonNull; |
| 6 | import android.support.v7.widget.RecyclerView; | 6 | import android.support.v7.widget.RecyclerView; |
| 7 | +import android.text.TextUtils; | ||
| 7 | import android.view.LayoutInflater; | 8 | import android.view.LayoutInflater; |
| 8 | import android.view.View; | 9 | import android.view.View; |
| 9 | import android.view.ViewGroup; | 10 | import android.view.ViewGroup; |
| @@ -42,21 +43,25 @@ public class RaceRecordAdapter extends RecyclerView.Adapter<RaceRecordAdapter.My | @@ -42,21 +43,25 @@ public class RaceRecordAdapter extends RecyclerView.Adapter<RaceRecordAdapter.My | ||
| 42 | @NonNull | 43 | @NonNull |
| 43 | @Override | 44 | @Override |
| 44 | public MyHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { | 45 | public MyHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { |
| 45 | - View view = LayoutInflater.from(context).inflate(R.layout.item_race_record,viewGroup,false); | 46 | + View view = LayoutInflater.from(context).inflate(R.layout.item_race_record, viewGroup, false); |
| 46 | return new MyHolder(view); | 47 | return new MyHolder(view); |
| 47 | } | 48 | } |
| 48 | 49 | ||
| 49 | @Override | 50 | @Override |
| 50 | public void onBindViewHolder(@NonNull MyHolder myHolder, int i) { | 51 | public void onBindViewHolder(@NonNull MyHolder myHolder, int i) { |
| 51 | - myHolder.record_time_day.setText(TimeUtil.getStampToTime(list.get(i).getCreateTime(),"MM月dd日")); | ||
| 52 | - myHolder.record_time.setText(TimeUtil.getStampToTime(list.get(i).getCreateTime(),"HH:mm")); | 52 | + myHolder.record_time_day.setText(TimeUtil.getStampToTime(list.get(i).getCreateTime(), "MM月dd日")); |
| 53 | + myHolder.record_time.setText(TimeUtil.getStampToTime(list.get(i).getCreateTime(), "HH:mm")); | ||
| 53 | myHolder.item_title.setText(list.get(i).getEventTitle()); | 54 | myHolder.item_title.setText(list.get(i).getEventTitle()); |
| 54 | myHolder.record_kli.setText(list.get(i).getMileage()); | 55 | myHolder.record_kli.setText(list.get(i).getMileage()); |
| 55 | - myHolder.record_minit.setText(list.get(i).getEmployTime()); | 56 | + //设置时间 |
| 57 | + if (!TextUtils.isEmpty(list.get(i).getEmployTime())) { | ||
| 58 | + myHolder.record_minit.setText(TimeUtil.stampToChronometer(Long.parseLong(list.get(i).getEmployTime()))); | ||
| 59 | + } | ||
| 56 | myHolder.record_speed.setText(list.get(i).getPace()); | 60 | myHolder.record_speed.setText(list.get(i).getPace()); |
| 57 | myHolder.record_step.setText(list.get(i).getStep()); | 61 | myHolder.record_step.setText(list.get(i).getStep()); |
| 58 | Glide.with(context).load(list.get(i).getRoadmap()).into(myHolder.item_img); | 62 | Glide.with(context).load(list.get(i).getRoadmap()).into(myHolder.item_img); |
| 59 | - if(onClickListener != null) myHolder.ry_re.setOnClickListener(v -> onClickListener.onClickListener(list.get(i),i)); | 63 | + if (onClickListener != null) |
| 64 | + myHolder.ry_re.setOnClickListener(v -> onClickListener.onClickListener(list.get(i), i)); | ||
| 60 | } | 65 | } |
| 61 | 66 | ||
| 62 | @Override | 67 | @Override |
| @@ -64,7 +69,7 @@ public class RaceRecordAdapter extends RecyclerView.Adapter<RaceRecordAdapter.My | @@ -64,7 +69,7 @@ public class RaceRecordAdapter extends RecyclerView.Adapter<RaceRecordAdapter.My | ||
| 64 | return list.size(); | 69 | return list.size(); |
| 65 | } | 70 | } |
| 66 | 71 | ||
| 67 | - class MyHolder extends RecyclerView.ViewHolder{ | 72 | + class MyHolder extends RecyclerView.ViewHolder { |
| 68 | 73 | ||
| 69 | TextView record_time_day; | 74 | TextView record_time_day; |
| 70 | TextView record_time; | 75 | TextView record_time; |
| @@ -91,7 +96,7 @@ public class RaceRecordAdapter extends RecyclerView.Adapter<RaceRecordAdapter.My | @@ -91,7 +96,7 @@ public class RaceRecordAdapter extends RecyclerView.Adapter<RaceRecordAdapter.My | ||
| 91 | } | 96 | } |
| 92 | 97 | ||
| 93 | 98 | ||
| 94 | - public interface OnClickListener{ | 99 | + public interface OnClickListener { |
| 95 | void onClickListener(EventRouteRecordBeanVoListBean bean, int position); | 100 | void onClickListener(EventRouteRecordBeanVoListBean bean, int position); |
| 96 | } | 101 | } |
| 97 | } | 102 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/ALLScoreDetailFragment.java
0 → 100644
| 1 | +package com.cnlive.moudle.pedometer.ui.fragment; | ||
| 2 | + | ||
| 3 | +import android.os.Bundle; | ||
| 4 | +import android.support.annotation.Nullable; | ||
| 5 | +import android.view.View; | ||
| 6 | + | ||
| 7 | +import com.cnlive.libs.base.ui.QMUIFragment; | ||
| 8 | +import com.cnlive.libs.base.util.StatusBarUtil2; | ||
| 9 | +import com.cnlive.moudle.pedometer.frame.presenter.ALLScoreDetailFragmentPresenter; | ||
| 10 | +import com.cnlive.moudle.pedometer.frame.view.ALLScoreDetailFragmentView; | ||
| 11 | +import com.cnlive.moudle.pedometer.model.RunningFinishBean; | ||
| 12 | +import com.example.moudle_pedometer.R; | ||
| 13 | +import com.example.moudle_pedometer.databinding.FragmentFinishRunMapBinding; | ||
| 14 | + | ||
| 15 | +public class ALLScoreDetailFragment extends QMUIFragment<ALLScoreDetailFragmentView, ALLScoreDetailFragmentPresenter, FragmentFinishRunMapBinding> { | ||
| 16 | + private RunningFinishBean runningFinishBean; | ||
| 17 | + | ||
| 18 | + public static ALLScoreDetailFragment newInstance(RunningFinishBean runningFinishBean) { | ||
| 19 | + Bundle bundle = new Bundle(); | ||
| 20 | + bundle.putSerializable("runningFinishBean", runningFinishBean); | ||
| 21 | + ALLScoreDetailFragment fragment = new ALLScoreDetailFragment(); | ||
| 22 | + fragment.setArguments(bundle); | ||
| 23 | + return fragment; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + @Override | ||
| 27 | + protected int getToolbarId() { | ||
| 28 | + return 0; | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + @Override | ||
| 32 | + public String getTitle() { | ||
| 33 | + return null; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + @Override | ||
| 37 | + protected int getLayoutId() { | ||
| 38 | + return R.layout.fragment_finish_run_map; | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + @Override | ||
| 42 | + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | ||
| 43 | + super.onViewCreated(view, savedInstanceState); | ||
| 44 | + StatusBarUtil2.setColor(getActivity(), getResources().getColor(R.color.run_main_bg), 0); | ||
| 45 | + | ||
| 46 | + if (getArguments() != null) { | ||
| 47 | + runningFinishBean = (RunningFinishBean) getArguments().getSerializable("runningFinishBean"); | ||
| 48 | + if (runningFinishBean != null) { | ||
| 49 | + if (getMvpView() != null) { | ||
| 50 | + getMvpView().initView(runningFinishBean); | ||
| 51 | + } | ||
| 52 | + } | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | +} |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/LineUpAgainFragment.java
| @@ -4,6 +4,7 @@ package com.cnlive.moudle.pedometer.ui.fragment; | @@ -4,6 +4,7 @@ package com.cnlive.moudle.pedometer.ui.fragment; | ||
| 4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
| 5 | import android.support.annotation.NonNull; | 5 | import android.support.annotation.NonNull; |
| 6 | import android.support.annotation.Nullable; | 6 | import android.support.annotation.Nullable; |
| 7 | +import android.util.Log; | ||
| 7 | import android.view.View; | 8 | import android.view.View; |
| 8 | 9 | ||
| 9 | import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; | 10 | import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; |
| @@ -21,7 +22,7 @@ import java.util.List; | @@ -21,7 +22,7 @@ import java.util.List; | ||
| 21 | * Created by hanyayun 019/06/20. | 22 | * Created by hanyayun 019/06/20. |
| 22 | */ | 23 | */ |
| 23 | public class LineUpAgainFragment extends MvpBindingFragment<LineUpAgainView, LineUpAgainPresenter, Object, FragmentLineUpAgainBinding> { | 24 | public class LineUpAgainFragment extends MvpBindingFragment<LineUpAgainView, LineUpAgainPresenter, Object, FragmentLineUpAgainBinding> { |
| 24 | - | 25 | + private final String TAG = "LineUpAgainFragment"; |
| 25 | 26 | ||
| 26 | public LineUpAgainFragment() { | 27 | public LineUpAgainFragment() { |
| 27 | // Required empty public constructor | 28 | // Required empty public constructor |
| @@ -37,10 +38,9 @@ public class LineUpAgainFragment extends MvpBindingFragment<LineUpAgainView, Lin | @@ -37,10 +38,9 @@ public class LineUpAgainFragment extends MvpBindingFragment<LineUpAgainView, Lin | ||
| 37 | public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | 38 | public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { |
| 38 | super.onViewCreated(view, savedInstanceState); | 39 | super.onViewCreated(view, savedInstanceState); |
| 39 | List<FailedEntity> failedEntities = StepUtil.getFailListData(getActivity(), CommonInfo.getUserId(getActivity())); | 40 | List<FailedEntity> failedEntities = StepUtil.getFailListData(getActivity(), CommonInfo.getUserId(getActivity())); |
| 40 | - | ||
| 41 | if (getMvpView() != null) { | 41 | if (getMvpView() != null) { |
| 42 | getMvpView().initView(); | 42 | getMvpView().initView(); |
| 43 | - if (failedEntities == null||failedEntities.size()<1) { | 43 | + if (failedEntities == null || failedEntities.size() < 1) { |
| 44 | binding.llNoFailTip.setVisibility(View.VISIBLE); | 44 | binding.llNoFailTip.setVisibility(View.VISIBLE); |
| 45 | } else { | 45 | } else { |
| 46 | getMvpView().setData(failedEntities); | 46 | getMvpView().setData(failedEntities); |
| @@ -49,4 +49,18 @@ public class LineUpAgainFragment extends MvpBindingFragment<LineUpAgainView, Lin | @@ -49,4 +49,18 @@ public class LineUpAgainFragment extends MvpBindingFragment<LineUpAgainView, Lin | ||
| 49 | binding.refreshLayout.setEnableLoadMore(false); | 49 | binding.refreshLayout.setEnableLoadMore(false); |
| 50 | binding.refreshLayout.setEnableRefresh(false); | 50 | binding.refreshLayout.setEnableRefresh(false); |
| 51 | } | 51 | } |
| 52 | + | ||
| 53 | + @Override | ||
| 54 | + public void onResume() { | ||
| 55 | + super.onResume(); | ||
| 56 | + Log.e(TAG, "onResume: "); | ||
| 57 | + List<FailedEntity> failedEntities = StepUtil.getFailListData(getActivity(), CommonInfo.getUserId(getActivity())); | ||
| 58 | + if (getMvpView() != null) { | ||
| 59 | + if (failedEntities == null || failedEntities.size() < 1) { | ||
| 60 | + binding.llNoFailTip.setVisibility(View.VISIBLE); | ||
| 61 | + } else { | ||
| 62 | + getMvpView().uploadList(failedEntities); | ||
| 63 | + } | ||
| 64 | + } | ||
| 65 | + } | ||
| 52 | } | 66 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/UploadFailDetailFragment.java
| @@ -54,7 +54,9 @@ public class UploadFailDetailFragment extends QMUIFragment<UploadFailDetailFragm | @@ -54,7 +54,9 @@ public class UploadFailDetailFragment extends QMUIFragment<UploadFailDetailFragm | ||
| 54 | failedEntity = (FailedEntity) getArguments().getSerializable("failedEntity"); | 54 | failedEntity = (FailedEntity) getArguments().getSerializable("failedEntity"); |
| 55 | if (failedEntity != null) { | 55 | if (failedEntity != null) { |
| 56 | if (getMvpView() != null) { | 56 | if (getMvpView() != null) { |
| 57 | + getMvpView().initMap(); | ||
| 57 | getMvpView().initView(failedEntity); | 58 | getMvpView().initView(failedEntity); |
| 59 | + getPresenter().queryHistoryTrace(getActivity(),failedEntity); | ||
| 58 | } | 60 | } |
| 59 | } | 61 | } |
| 60 | } | 62 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/MyMapUtil.java
| @@ -270,7 +270,7 @@ public class MyMapUtil { | @@ -270,7 +270,7 @@ public class MyMapUtil { | ||
| 270 | */ | 270 | */ |
| 271 | public static Overlay drawHistoryTrack(Context context, BaiduMap baiduMap, List<LatLng> points, SortType sortType, int lineColor, int startIconRes, int endIconRes) { | 271 | public static Overlay drawHistoryTrack(Context context, BaiduMap baiduMap, List<LatLng> points, SortType sortType, int lineColor, int startIconRes, int endIconRes) { |
| 272 | // 绘制新覆盖物前,清空之前的覆盖物 | 272 | // 绘制新覆盖物前,清空之前的覆盖物 |
| 273 | - if (points == null || points.size() == 0) { | 273 | + if (points == null || points.size() == 0 || lineColor == 0 || startIconRes == 0 || endIconRes == 0) { |
| 274 | return null; | 274 | return null; |
| 275 | } | 275 | } |
| 276 | //只有一个点 | 276 | //只有一个点 |
| @@ -327,6 +327,54 @@ public class MyMapUtil { | @@ -327,6 +327,54 @@ public class MyMapUtil { | ||
| 327 | } | 327 | } |
| 328 | 328 | ||
| 329 | /** | 329 | /** |
| 330 | + * 绘制实时轨迹 | ||
| 331 | + */ | ||
| 332 | + public static Overlay drawRealTimeTrack(Context context, BaiduMap baiduMap, List<LatLng> points, SortType sortType, int lineColor, int startIconRes) { | ||
| 333 | + // 绘制新覆盖物前,清空之前的覆盖物 | ||
| 334 | + if (points == null || points.size() == 0 || lineColor == 0 || startIconRes == 0) { | ||
| 335 | + return null; | ||
| 336 | + } | ||
| 337 | + //只有一个点 | ||
| 338 | + if (points.size() == 1) { | ||
| 339 | + if (startIconRes != 0) { | ||
| 340 | + Bitmap pointBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), startIconRes), 24, 30); | ||
| 341 | + OverlayOptions startOptions = new MarkerOptions().position(points.get(0)).icon(BitmapDescriptorFactory.fromBitmap(pointBitmap)); | ||
| 342 | +// .zIndex(9).draggable(true); | ||
| 343 | + return baiduMap.addOverlay(startOptions); | ||
| 344 | + } else { | ||
| 345 | + return null; | ||
| 346 | + } | ||
| 347 | + } | ||
| 348 | + | ||
| 349 | + LatLng startPoint; | ||
| 350 | + LatLng endPoint; | ||
| 351 | + if (sortType == SortType.asc) { | ||
| 352 | + startPoint = points.get(0); | ||
| 353 | + endPoint = points.get(points.size() - 1); | ||
| 354 | + } else { | ||
| 355 | + startPoint = points.get(points.size() - 1); | ||
| 356 | + endPoint = points.get(0); | ||
| 357 | + } | ||
| 358 | + | ||
| 359 | + // 添加起点图标 | ||
| 360 | + Bitmap startPointBitmap = null; | ||
| 361 | + OverlayOptions startOptions = null; | ||
| 362 | + if (startIconRes != 0) { | ||
| 363 | + startPointBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), startIconRes), 24, 30); | ||
| 364 | + startOptions = new MarkerOptions().perspective(false).animateType(MarkerOptions.MarkerAnimateType.grow) | ||
| 365 | + .position(startPoint).icon(BitmapDescriptorFactory.fromBitmap(startPointBitmap)); | ||
| 366 | + } | ||
| 367 | + | ||
| 368 | + // 添加路线(轨迹) | ||
| 369 | + OverlayOptions polylineOptions = new PolylineOptions().width(10) | ||
| 370 | + .color(context.getResources().getColor(lineColor)).points(points); | ||
| 371 | + if (startOptions != null) { | ||
| 372 | + baiduMap.addOverlay(startOptions); | ||
| 373 | + } | ||
| 374 | + return baiduMap.addOverlay(polylineOptions); | ||
| 375 | + } | ||
| 376 | + | ||
| 377 | + /** | ||
| 330 | * 绘制服务器传过来的轨迹 | 378 | * 绘制服务器传过来的轨迹 |
| 331 | */ | 379 | */ |
| 332 | public static List<Overlay> drawServerLineTrack(Context context, BaiduMap baiduMap, List<LatLng> points, SortType sortType, int lineColor, int startIconRes, int endIconRes) { | 380 | public static List<Overlay> drawServerLineTrack(Context context, BaiduMap baiduMap, List<LatLng> points, SortType sortType, int lineColor, int startIconRes, int endIconRes) { |
| @@ -520,10 +568,18 @@ public class MyMapUtil { | @@ -520,10 +568,18 @@ public class MyMapUtil { | ||
| 520 | 568 | ||
| 521 | for (LatLng latLng : points) { | 569 | for (LatLng latLng : points) { |
| 522 | tempLatLng = latLng; | 570 | tempLatLng = latLng; |
| 523 | - if (tempLatLng.longitude > maxLng) maxLng = tempLatLng.longitude; | ||
| 524 | - if (tempLatLng.longitude < minLng) minLng = tempLatLng.longitude; | ||
| 525 | - if (tempLatLng.latitude > maxLat) maxLat = tempLatLng.latitude; | ||
| 526 | - if (tempLatLng.latitude < minLat) minLat = tempLatLng.latitude; | 571 | + if (tempLatLng.longitude > maxLng) { |
| 572 | + maxLng = tempLatLng.longitude; | ||
| 573 | + } | ||
| 574 | + if (tempLatLng.longitude < minLng) { | ||
| 575 | + minLng = tempLatLng.longitude; | ||
| 576 | + } | ||
| 577 | + if (tempLatLng.latitude > maxLat) { | ||
| 578 | + maxLat = tempLatLng.latitude; | ||
| 579 | + } | ||
| 580 | + if (tempLatLng.latitude < minLat) { | ||
| 581 | + minLat = tempLatLng.latitude; | ||
| 582 | + } | ||
| 527 | } | 583 | } |
| 528 | 584 | ||
| 529 | double[] zooms = {50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000, 25000, 50000, 100000, 200000, 500000, 1000000, 2000000};//级别18到3。 | 585 | double[] zooms = {50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000, 25000, 50000, 100000, 200000, 500000, 1000000, 2000000};//级别18到3。 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/StepUtil.java
| @@ -124,6 +124,12 @@ public class StepUtil { | @@ -124,6 +124,12 @@ public class StepUtil { | ||
| 124 | UserStepEntity entity = getUserStepData(context, uid); | 124 | UserStepEntity entity = getUserStepData(context, uid); |
| 125 | entity.setFenceId(fenceId); | 125 | entity.setFenceId(fenceId); |
| 126 | updateStepData(context, entity); | 126 | updateStepData(context, entity); |
| 127 | + } else { | ||
| 128 | + DbCore.init(context, dbName); | ||
| 129 | + UserStepEntity userStepEntity = new UserStepEntity(); | ||
| 130 | + userStepEntity.setUserId(uid); | ||
| 131 | + userStepEntity.setFenceId(fenceId); | ||
| 132 | + DbCore.getDaoSession().getUserStepEntityDao().insert(userStepEntity); | ||
| 127 | } | 133 | } |
| 128 | } | 134 | } |
| 129 | 135 |
moudle_pedometer/src/main/res/layout/fragment_finish_run_map.xml
| @@ -127,6 +127,8 @@ | @@ -127,6 +127,8 @@ | ||
| 127 | android:id="@+id/loading" | 127 | android:id="@+id/loading" |
| 128 | android:layout_width="20dp" | 128 | android:layout_width="20dp" |
| 129 | android:layout_height="20dp" | 129 | android:layout_height="20dp" |
| 130 | + android:clickable="false" | ||
| 131 | + android:focusableInTouchMode="false" | ||
| 130 | app:indicatorColor="@color/white" | 132 | app:indicatorColor="@color/white" |
| 131 | app:indicatorName="BallSpinFadeLoaderIndicator" /> | 133 | app:indicatorName="BallSpinFadeLoaderIndicator" /> |
| 132 | 134 | ||
| @@ -136,6 +138,8 @@ | @@ -136,6 +138,8 @@ | ||
| 136 | android:layout_height="wrap_content" | 138 | android:layout_height="wrap_content" |
| 137 | android:layout_centerInParent="true" | 139 | android:layout_centerInParent="true" |
| 138 | android:layout_marginLeft="5dp" | 140 | android:layout_marginLeft="5dp" |
| 141 | + android:clickable="false" | ||
| 142 | + android:focusableInTouchMode="false" | ||
| 139 | android:tag="0" | 143 | android:tag="0" |
| 140 | android:text="保存中" | 144 | android:text="保存中" |
| 141 | android:textColor="@color/white" | 145 | android:textColor="@color/white" |
moudle_pedometer/src/main/res/layout/item_race_record.xml
| @@ -4,6 +4,7 @@ | @@ -4,6 +4,7 @@ | ||
| 4 | <data> | 4 | <data> |
| 5 | 5 | ||
| 6 | </data> | 6 | </data> |
| 7 | + | ||
| 7 | <RelativeLayout | 8 | <RelativeLayout |
| 8 | android:id="@+id/ry_re" | 9 | android:id="@+id/ry_re" |
| 9 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
| @@ -14,19 +15,19 @@ | @@ -14,19 +15,19 @@ | ||
| 14 | android:id="@+id/record_time_day" | 15 | android:id="@+id/record_time_day" |
| 15 | android:layout_width="wrap_content" | 16 | android:layout_width="wrap_content" |
| 16 | android:layout_height="wrap_content" | 17 | android:layout_height="wrap_content" |
| 18 | + android:text="--" | ||
| 17 | android:textColor="#333333" | 19 | android:textColor="#333333" |
| 18 | - android:textSize="14sp" | ||
| 19 | - android:text="5月1日" /> | 20 | + android:textSize="14sp" /> |
| 20 | 21 | ||
| 21 | <TextView | 22 | <TextView |
| 22 | android:id="@+id/record_time" | 23 | android:id="@+id/record_time" |
| 23 | android:layout_width="wrap_content" | 24 | android:layout_width="wrap_content" |
| 24 | android:layout_height="wrap_content" | 25 | android:layout_height="wrap_content" |
| 25 | - android:layout_toRightOf="@id/record_time_day" | ||
| 26 | android:layout_marginLeft="15dp" | 26 | android:layout_marginLeft="15dp" |
| 27 | + android:layout_toRightOf="@id/record_time_day" | ||
| 28 | + android:text="--" | ||
| 27 | android:textColor="#999999" | 29 | android:textColor="#999999" |
| 28 | - android:textSize="14sp" | ||
| 29 | - android:text="15:30" /> | 30 | + android:textSize="14sp" /> |
| 30 | 31 | ||
| 31 | <LinearLayout | 32 | <LinearLayout |
| 32 | android:layout_width="match_parent" | 33 | android:layout_width="match_parent" |
| @@ -53,31 +54,31 @@ | @@ -53,31 +54,31 @@ | ||
| 53 | android:layout_width="wrap_content" | 54 | android:layout_width="wrap_content" |
| 54 | android:layout_height="wrap_content" | 55 | android:layout_height="wrap_content" |
| 55 | android:singleLine="true" | 56 | android:singleLine="true" |
| 56 | - android:textSize="12sp" | ||
| 57 | - android:textColor="#333333"/> | 57 | + android:textColor="#333333" |
| 58 | + android:textSize="12sp" /> | ||
| 58 | 59 | ||
| 59 | <LinearLayout | 60 | <LinearLayout |
| 60 | android:layout_width="wrap_content" | 61 | android:layout_width="wrap_content" |
| 61 | android:layout_height="wrap_content" | 62 | android:layout_height="wrap_content" |
| 62 | android:layout_centerVertical="true" | 63 | android:layout_centerVertical="true" |
| 63 | android:orientation="horizontal"> | 64 | android:orientation="horizontal"> |
| 65 | + | ||
| 64 | <TextView | 66 | <TextView |
| 65 | android:id="@+id/kilometer_num" | 67 | android:id="@+id/kilometer_num" |
| 66 | android:layout_width="wrap_content" | 68 | android:layout_width="wrap_content" |
| 67 | android:layout_height="wrap_content" | 69 | android:layout_height="wrap_content" |
| 68 | - android:textColor="#333333" | ||
| 69 | - android:textSize="30sp" | ||
| 70 | android:layout_centerVertical="true" | 70 | android:layout_centerVertical="true" |
| 71 | - /> | 71 | + android:textColor="#333333" |
| 72 | + android:textSize="30sp" /> | ||
| 72 | 73 | ||
| 73 | <TextView | 74 | <TextView |
| 74 | android:layout_width="wrap_content" | 75 | android:layout_width="wrap_content" |
| 75 | android:layout_height="wrap_content" | 76 | android:layout_height="wrap_content" |
| 76 | android:layout_centerVertical="true" | 77 | android:layout_centerVertical="true" |
| 78 | + android:layout_marginLeft="5dp" | ||
| 77 | android:text="@string/kilometer" | 79 | android:text="@string/kilometer" |
| 78 | android:textColor="#333333" | 80 | android:textColor="#333333" |
| 79 | - android:textSize="12sp" | ||
| 80 | - android:layout_marginLeft="5dp"/> | 81 | + android:textSize="12sp" /> |
| 81 | </LinearLayout> | 82 | </LinearLayout> |
| 82 | 83 | ||
| 83 | 84 | ||
| @@ -119,7 +120,7 @@ | @@ -119,7 +120,7 @@ | ||
| 119 | <View | 120 | <View |
| 120 | android:layout_width="match_parent" | 121 | android:layout_width="match_parent" |
| 121 | android:layout_height="1dp" | 122 | android:layout_height="1dp" |
| 122 | - android:background="@color/line" | ||
| 123 | - android:layout_alignParentBottom="true"/> | 123 | + android:layout_alignParentBottom="true" |
| 124 | + android:background="@color/line" /> | ||
| 124 | </RelativeLayout> | 125 | </RelativeLayout> |
| 125 | </layout> | 126 | </layout> |
moudle_pedometer/src/main/res/values/ids.xml
| @@ -10,5 +10,7 @@ | @@ -10,5 +10,7 @@ | ||
| 10 | <item name="fragment_start_collect_trace" type="id" /> | 10 | <item name="fragment_start_collect_trace" type="id" /> |
| 11 | <!--上传失败--> | 11 | <!--上传失败--> |
| 12 | <item name="fragment_upload_fail" type="id" /> | 12 | <item name="fragment_upload_fail" type="id" /> |
| 13 | + <!--全部成绩详情页--> | ||
| 14 | + <item name="fragment_all_score_detail" type="id" /> | ||
| 13 | 15 | ||
| 14 | </resources> | 16 | </resources> |