Commit 78194573068a8259550e67ca9033cf25ceab3530
Merge branch 'master' of bj.gitlab.cnlive.com:cnlive-team/ModulePedometer
Showing
49 changed files
with
1291 additions
and
461 deletions
.idea/gradle.xml
| @@ -3,9 +3,6 @@ | @@ -3,9 +3,6 @@ | ||
| 3 | <component name="GradleSettings"> | 3 | <component name="GradleSettings"> |
| 4 | <option name="linkedExternalProjectsSettings"> | 4 | <option name="linkedExternalProjectsSettings"> |
| 5 | <GradleProjectSettings> | 5 | <GradleProjectSettings> |
| 6 | - <compositeConfiguration> | ||
| 7 | - <compositeBuild compositeDefinitionSource="SCRIPT" /> | ||
| 8 | - </compositeConfiguration> | ||
| 9 | <option name="distributionType" value="DEFAULT_WRAPPED" /> | 6 | <option name="distributionType" value="DEFAULT_WRAPPED" /> |
| 10 | <option name="externalProjectPath" value="$PROJECT_DIR$" /> | 7 | <option name="externalProjectPath" value="$PROJECT_DIR$" /> |
| 11 | <option name="modules"> | 8 | <option name="modules"> |
app/src/main/java/com/example/modulepedometer/MainActivity.java
| @@ -10,6 +10,7 @@ import com.cnlive.moudle.collectionTrace.ui.activity.RaceListActivity; | @@ -10,6 +10,7 @@ import com.cnlive.moudle.collectionTrace.ui.activity.RaceListActivity; | ||
| 10 | import com.cnlive.moudle.collectionTrace.ui.activity.RaceNameListActivity; | 10 | import com.cnlive.moudle.collectionTrace.ui.activity.RaceNameListActivity; |
| 11 | import com.cnlive.moudle.pedometer.ui.activity.MyRecordActivity; | 11 | import com.cnlive.moudle.pedometer.ui.activity.MyRecordActivity; |
| 12 | import com.cnlive.moudle.pedometer.ui.activity.RunLineActivity; | 12 | import com.cnlive.moudle.pedometer.ui.activity.RunLineActivity; |
| 13 | +import com.cnlive.moudle.pedometer.ui.activity.SelfRecordActivity; | ||
| 13 | 14 | ||
| 14 | 15 | ||
| 15 | public class MainActivity extends AppCompatActivity { | 16 | public class MainActivity extends AppCompatActivity { |
| @@ -33,6 +34,13 @@ public class MainActivity extends AppCompatActivity { | @@ -33,6 +34,13 @@ public class MainActivity extends AppCompatActivity { | ||
| 33 | startActivity(intent); | 34 | startActivity(intent); |
| 34 | } | 35 | } |
| 35 | }); | 36 | }); |
| 37 | + findViewById(R.id.tool2).setOnClickListener(new View.OnClickListener() { | ||
| 38 | + @Override | ||
| 39 | + public void onClick(View v) { | ||
| 40 | + SelfRecordActivity.newInstance(MainActivity.this, "10513196",null,null,null); | ||
| 41 | +// startActivity(intent); | ||
| 42 | + } | ||
| 43 | + }); | ||
| 36 | 44 | ||
| 37 | // RunLineActivity.newInstance(this,null,null,null); | 45 | // RunLineActivity.newInstance(this,null,null,null); |
| 38 | // Intent intent = new Intent(this, CollRunRaceDetailActivity.class); | 46 | // Intent intent = new Intent(this, CollRunRaceDetailActivity.class); |
app/src/main/res/layout/activity_main.xml
| @@ -12,15 +12,19 @@ | @@ -12,15 +12,19 @@ | ||
| 12 | android:layout_width="match_parent" | 12 | android:layout_width="match_parent" |
| 13 | android:layout_height="wrap_content" | 13 | android:layout_height="wrap_content" |
| 14 | android:layout_margin="10dp" | 14 | android:layout_margin="10dp" |
| 15 | - android:text="体育活动" | ||
| 16 | - /> | 15 | + android:text="体育活动" /> |
| 17 | 16 | ||
| 18 | <Button | 17 | <Button |
| 19 | android:id="@+id/tooll" | 18 | android:id="@+id/tooll" |
| 20 | android:layout_width="match_parent" | 19 | android:layout_width="match_parent" |
| 21 | android:layout_height="wrap_content" | 20 | android:layout_height="wrap_content" |
| 22 | android:layout_margin="10dp" | 21 | android:layout_margin="10dp" |
| 23 | - android:text="路径工具" | ||
| 24 | - /> | 22 | + android:text="路径工具" /> |
| 25 | 23 | ||
| 24 | + <Button | ||
| 25 | + android:id="@+id/tool2" | ||
| 26 | + android:layout_width="match_parent" | ||
| 27 | + android:layout_height="wrap_content" | ||
| 28 | + android:layout_margin="10dp" | ||
| 29 | + android:text="我的记录" /> | ||
| 26 | </LinearLayout> | 30 | </LinearLayout> |
| 27 | \ No newline at end of file | 31 | \ No newline at end of file |
moudle_pedometer/build.gradle
| @@ -121,4 +121,6 @@ dependencies { | @@ -121,4 +121,6 @@ dependencies { | ||
| 121 | } | 121 | } |
| 122 | implementation "com.cnlive.libs:mediapicker:$rootProject.libMediaPicker" | 122 | implementation "com.cnlive.libs:mediapicker:$rootProject.libMediaPicker" |
| 123 | implementation 'org.apache.httpcomponents:httpcore:4.4.2' | 123 | implementation 'org.apache.httpcomponents:httpcore:4.4.2' |
| 124 | + //气泡提醒 | ||
| 125 | + implementation 'q.rorbin:badgeview:1.1.3' | ||
| 124 | } | 126 | } |
moudle_pedometer/src/main/AndroidManifest.xml
| @@ -131,7 +131,13 @@ | @@ -131,7 +131,13 @@ | ||
| 131 | android:process=":step" /> | 131 | android:process=":step" /> |
| 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:process=":step" /> <!-- 路径工具 --> | 134 | + android:launchMode="singleTask" |
| 135 | + android:process=":step" /> | ||
| 136 | + <activity | ||
| 137 | + android:name="com.cnlive.moudle.pedometer.ui.activity.UploadFailDetailActivity" | ||
| 138 | + android:launchMode="singleTask" | ||
| 139 | + android:process=":step" /> | ||
| 140 | + <!--************************************************路径工具**********************************************--> | ||
| 135 | <service | 141 | <service |
| 136 | android:name="com.cnlive.moudle.collectionTrace.service.CollKeepLiveService" | 142 | android:name="com.cnlive.moudle.collectionTrace.service.CollKeepLiveService" |
| 137 | android:enabled="true" | 143 | android:enabled="true" |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/commonInfo/CommonInfo.java
| @@ -25,23 +25,6 @@ public class CommonInfo { | @@ -25,23 +25,6 @@ public class CommonInfo { | ||
| 25 | // return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getLong("stepStartTime", 0); | 25 | // return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getLong("stepStartTime", 0); |
| 26 | // } | 26 | // } |
| 27 | 27 | ||
| 28 | - /** | ||
| 29 | - * 设置计步完成时间 | ||
| 30 | - * | ||
| 31 | - * @param context | ||
| 32 | - */ | ||
| 33 | - public static void setStepEndTime(Context context, long currentTime) { | ||
| 34 | - MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).putLong("stepEndTime", currentTime); | ||
| 35 | - } | ||
| 36 | - | ||
| 37 | - /** | ||
| 38 | - * 获取计步完成时间 | ||
| 39 | - * | ||
| 40 | - * @param context | ||
| 41 | - */ | ||
| 42 | - public static long getStepEndTime(Context context) { | ||
| 43 | - return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getLong("stepEndTime", 0); | ||
| 44 | - } | ||
| 45 | 28 | ||
| 46 | /** | 29 | /** |
| 47 | * 是否允许写入步数 | 30 | * 是否允许写入步数 |
| @@ -295,67 +278,10 @@ public class CommonInfo { | @@ -295,67 +278,10 @@ public class CommonInfo { | ||
| 295 | return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getBoolean("runIsPauseState", false); | 278 | return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getBoolean("runIsPauseState", false); |
| 296 | } | 279 | } |
| 297 | 280 | ||
| 298 | - /** | ||
| 299 | - * 设置轨迹查询开始时间 | ||
| 300 | - * | ||
| 301 | - * @param context | ||
| 302 | - * @param startTime | ||
| 303 | - */ | ||
| 304 | - public static void setQueryTraceStartTime(Context context, long startTime) { | ||
| 305 | - MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).putLong("runQueryTraceStartTime", startTime); | ||
| 306 | - | ||
| 307 | - } | ||
| 308 | - | ||
| 309 | - /** | ||
| 310 | - * 互殴轨迹查询开始时间 | ||
| 311 | - * | ||
| 312 | - * @param context | ||
| 313 | - */ | ||
| 314 | - public static long getQueryTraceStartTime(Context context) { | ||
| 315 | - return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getLong("runQueryTraceStartTime", 0); | ||
| 316 | - | ||
| 317 | - } | ||
| 318 | - | ||
| 319 | - /** | ||
| 320 | - * 设置轨迹查询结束时间 | ||
| 321 | - * | ||
| 322 | - * @param context | ||
| 323 | - * @param startTime | ||
| 324 | - */ | ||
| 325 | - public static void setQueryTraceEndTime(Context context, long startTime) { | ||
| 326 | - MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).putLong("runQueryTraceEndTime", startTime); | ||
| 327 | 281 | ||
| 328 | - } | ||
| 329 | 282 | ||
| 330 | - /** | ||
| 331 | - * 互殴轨迹查询开始时间 | ||
| 332 | - * | ||
| 333 | - * @param context | ||
| 334 | - */ | ||
| 335 | - public static long getQueryTraceEndTime(Context context) { | ||
| 336 | - return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getLong("runQueryTraceEndTime", 0); | ||
| 337 | 283 | ||
| 338 | - } | ||
| 339 | 284 | ||
| 340 | - /** | ||
| 341 | - * 设置轨迹查询实体名称 | ||
| 342 | - * | ||
| 343 | - * @param context | ||
| 344 | - */ | ||
| 345 | - public static void setQueryEntityName(Context context, String entityName) { | ||
| 346 | - MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).putString("runQueryEntityName", entityName); | ||
| 347 | - | ||
| 348 | - } | ||
| 349 | - | ||
| 350 | - /** | ||
| 351 | - * 互殴轨迹查询\的实体名称 | ||
| 352 | - * | ||
| 353 | - * @param context | ||
| 354 | - */ | ||
| 355 | - public static String getQueryQueryEntityName(Context context) { | ||
| 356 | - return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getString("runQueryEntityName", ""); | ||
| 357 | - | ||
| 358 | - } | ||
| 359 | 285 | ||
| 360 | 286 | ||
| 361 | /*重置 | 287 | /*重置 |
| @@ -373,9 +299,7 @@ public class CommonInfo { | @@ -373,9 +299,7 @@ public class CommonInfo { | ||
| 373 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("FenceId"); | 299 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("FenceId"); |
| 374 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("IsFirstShowTimeTip"); | 300 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("IsFirstShowTimeTip"); |
| 375 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("runIsPauseState"); | 301 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("runIsPauseState"); |
| 376 | -// MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("runQueryTraceStartTime"); | ||
| 377 | -// MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("runQueryTraceEndTime"); | ||
| 378 | -// MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("runQueryEntityName"); | 302 | + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("runStreetTitle"); |
| 379 | 303 | ||
| 380 | 304 | ||
| 381 | } | 305 | } |
| @@ -391,5 +315,7 @@ public class CommonInfo { | @@ -391,5 +315,7 @@ public class CommonInfo { | ||
| 391 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("RunBaiduTraceService"); | 315 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("RunBaiduTraceService"); |
| 392 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("FirstStepSendTraceTip"); | 316 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("FirstStepSendTraceTip"); |
| 393 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("IsFirstShowTimeTip"); | 317 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("IsFirstShowTimeTip"); |
| 318 | + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("runIsPauseState"); | ||
| 319 | + | ||
| 394 | } | 320 | } |
| 395 | } | 321 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/LineUpAgainPresenter.java
| @@ -7,7 +7,4 @@ import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; | @@ -7,7 +7,4 @@ import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; | ||
| 7 | * Created by hanyayun 019/06/20. | 7 | * Created by hanyayun 019/06/20. |
| 8 | */ | 8 | */ |
| 9 | public class LineUpAgainPresenter extends MvpBasePresenter<LineUpAgainView> { | 9 | public class LineUpAgainPresenter extends MvpBasePresenter<LineUpAgainView> { |
| 10 | - public void getData(){ | ||
| 11 | - getView().setData(); | ||
| 12 | - } | ||
| 13 | } | 10 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/RunningFinishFragmetPresenter.java
| 1 | package com.cnlive.moudle.pedometer.frame.presenter; | 1 | package com.cnlive.moudle.pedometer.frame.presenter; |
| 2 | 2 | ||
| 3 | +import android.app.Activity; | ||
| 3 | import android.content.Context; | 4 | import android.content.Context; |
| 4 | import android.graphics.Bitmap; | 5 | import android.graphics.Bitmap; |
| 5 | import android.os.Handler; | 6 | import android.os.Handler; |
| @@ -21,13 +22,16 @@ import com.cnlive.libs.base.logic.callback.SuccessCallback; | @@ -21,13 +22,16 @@ import com.cnlive.libs.base.logic.callback.SuccessCallback; | ||
| 21 | import com.cnlive.libs.base.util.ToastUtil; | 22 | import com.cnlive.libs.base.util.ToastUtil; |
| 22 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | 23 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 23 | import com.cnlive.moudle.pedometer.frame.view.RunningFinishFragmentView; | 24 | import com.cnlive.moudle.pedometer.frame.view.RunningFinishFragmentView; |
| 25 | +import com.cnlive.moudle.pedometer.model.Constant; | ||
| 24 | import com.cnlive.moudle.pedometer.model.RunningFinishBean; | 26 | import com.cnlive.moudle.pedometer.model.RunningFinishBean; |
| 25 | import com.cnlive.moudle.pedometer.net.ApiServiceRunLin; | 27 | import com.cnlive.moudle.pedometer.net.ApiServiceRunLin; |
| 26 | import com.cnlive.moudle.pedometer.net.SubscriptionRequest; | 28 | import com.cnlive.moudle.pedometer.net.SubscriptionRequest; |
| 27 | import com.cnlive.moudle.pedometer.net.bean.BaseInfo; | 29 | import com.cnlive.moudle.pedometer.net.bean.BaseInfo; |
| 28 | import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; | 30 | import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; |
| 29 | import com.cnlive.moudle.pedometer.service.StepService; | 31 | import com.cnlive.moudle.pedometer.service.StepService; |
| 32 | +import com.cnlive.moudle.pedometer.sql.entity.FailedEntity; | ||
| 30 | import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; | 33 | import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; |
| 34 | +import com.cnlive.moudle.pedometer.ui.activity.LineUpAgainActivity; | ||
| 31 | import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; | 35 | import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; |
| 32 | import com.cnlive.moudle.pedometer.ui.widget.TipDialog; | 36 | import com.cnlive.moudle.pedometer.ui.widget.TipDialog; |
| 33 | import com.cnlive.moudle.pedometer.upload.UploadLogic; | 37 | import com.cnlive.moudle.pedometer.upload.UploadLogic; |
| @@ -55,9 +59,12 @@ import static com.cnlive.libs.base.logic.Config.STATE_LOAD; | @@ -55,9 +59,12 @@ import static com.cnlive.libs.base.logic.Config.STATE_LOAD; | ||
| 55 | 59 | ||
| 56 | public class RunningFinishFragmetPresenter extends MvpBasePresenter<RunningFinishFragmentView> { | 60 | public class RunningFinishFragmetPresenter extends MvpBasePresenter<RunningFinishFragmentView> { |
| 57 | private LBSTraceClient mClient = null; | 61 | private LBSTraceClient mClient = null; |
| 58 | - private String imports = "[{\"latitude\":39.93395837223,\"latitudeE6\":3.993395837223E7,\"longitude\":116.30855458458,\"longitudeE6\":1.1630855458457999E8},{\"latitude\":39.93396326228,\"latitudeE6\":3.993396326228E7,\"longitude\":116.30861833018,\"longitudeE6\":1.1630861833017999E8},{\"latitude\":39.934156956749995,\"latitudeE6\":3.993415695675E7,\"longitude\":116.30869672329999,\"longitudeE6\":1.163086967233E8},{\"latitude\":39.934220163784,\"latitudeE6\":3.9934220163784E7,\"longitude\":116.3087100148,\"longitudeE6\":1.163087100148E8},{\"latitude\":39.934285263072,\"latitudeE6\":3.9934285263072E7,\"longitude\":116.30866498582,\"longitudeE6\":1.1630866498582E8},{\"latitude\":39.934351994321,\"latitudeE6\":3.9934351994320996E7,\"longitude\":116.30865820422,\"longitudeE6\":1.1630865820422E8},{\"latitude\":39.934393506188,\"latitudeE6\":3.9934393506188005E7,\"longitude\":116.3087268324,\"longitudeE6\":1.163087268324E8},{\"latitude\":39.934515310648,\"latitudeE6\":3.9934515310648E7,\"longitude\":116.30877023341,\"longitudeE6\":1.1630877023341E8},{\"latitude\":39.934576888398,\"latitudeE6\":3.9934576888398E7,\"longitude\":116.30876860572,\"longitudeE6\":1.1630876860572E8},{\"latitude\":39.934641987882,\"latitudeE6\":3.9934641987882E7,\"longitude\":116.30872520428,\"longitudeE6\":1.1630872520427999E8},{\"latitude\":39.934720386354,\"latitudeE6\":3.9934720386354E7,\"longitude\":116.30874175083,\"longitudeE6\":1.1630874175083E8},{\"latitude\":39.934703845843,\"latitudeE6\":3.9934703845843E7,\"longitude\":116.30880197017,\"longitudeE6\":1.1630880197016999E8},{\"latitude\":39.934719055573,\"latitudeE6\":3.9934719055573E7,\"longitude\":116.30896553874,\"longitudeE6\":1.1630896553874E8},{\"latitude\":39.93482461107,\"latitudeE6\":3.993482461107E7,\"longitude\":116.30924466304002,\"longitudeE6\":1.1630924466304001E8},{\"latitude\":39.934804821527,\"latitudeE6\":3.9934804821527004E7,\"longitude\":116.30935804892,\"longitudeE6\":1.1630935804892E8},{\"latitude\":39.934856643274,\"latitudeE6\":3.9934856643274E7,\"longitude\":116.30943996874,\"longitudeE6\":1.1630943996874E8},{\"latitude\":39.934844987999,\"latitudeE6\":3.9934844987999E7,\"longitude\":116.30952026112,\"longitudeE6\":1.1630952026112E8},{\"latitude\":39.934722121282,\"latitudeE6\":3.9934722121282004E7,\"longitude\":116.30967542086,\"longitudeE6\":1.1630967542086E8},{\"latitude\":39.934828721701,\"latitudeE6\":3.9934828721701E7,\"longitude\":116.30960516489,\"longitudeE6\":1.1630960516489E8},{\"latitude\":39.934408798988,\"latitudeE6\":3.9934408798988E7,\"longitude\":116.30961357453,\"longitudeE6\":1.1630961357453E8},{\"latitude\":39.934345321571,\"latitudeE6\":3.9934345321571E7,\"longitude\":116.30960842073,\"longitudeE6\":1.1630960842073E8},{\"latitude\":39.93436159016,\"latitudeE6\":3.9934361590160005E7,\"longitude\":116.30954331882,\"longitudeE6\":1.1630954331882E8},{\"latitude\":39.934295133241,\"latitudeE6\":3.9934295133241E7,\"longitude\":116.30957668364,\"longitudeE6\":1.1630957668364E8},{\"latitude\":39.934188525341,\"latitudeE6\":3.9934188525341E7,\"longitude\":116.30958183769,\"longitudeE6\":1.1630958183769001E8},{\"latitude\":39.933976660469,\"latitudeE6\":3.9933976660469E7,\"longitude\":116.30954494693,\"longitudeE6\":1.1630954494693E8},{\"latitude\":39.933993190121,\"latitudeE6\":3.9933993190121E7,\"longitude\":116.30939114375,\"longitudeE6\":1.1630939114375001E8},{\"latitude\":39.933938115564,\"latitudeE6\":3.9933938115563996E7,\"longitude\":116.30932956832,\"longitudeE6\":1.1630932956831999E8},{\"latitude\":39.933916130555,\"latitudeE6\":3.9933916130555E7,\"longitude\":116.30922269279,\"longitudeE6\":1.1630922269279E8},{\"latitude\":39.933836097011,\"latitudeE6\":3.9933836097011E7,\"longitude\":116.30914077307,\"longitudeE6\":1.1630914077307E8}]\n"; | 62 | + private List<LatLng> importPoints; |
| 63 | + private SelectDialog uploadFailDialog; | ||
| 64 | + private SelectDialog failTraceDialog; | ||
| 59 | 65 | ||
| 60 | - public void saveRouteData(Context context, UserStepEntity userStepEntity, RunningFinishBean runningFinishBean) { | 66 | + public void saveRouteData(Activity context, UserStepEntity userStepEntity, RunningFinishBean runningFinishBean) { |
| 67 | + QMUITipDialogUtil.loadingDialog(context, "正在上传数据", false); | ||
| 61 | // 赛事id | 68 | // 赛事id |
| 62 | String eventId = userStepEntity.getStreetId(); | 69 | String eventId = userStepEntity.getStreetId(); |
| 63 | //用户ID | 70 | //用户ID |
| @@ -80,6 +87,7 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter<RunningFinis | @@ -80,6 +87,7 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter<RunningFinis | ||
| 80 | } | 87 | } |
| 81 | // 路线图 | 88 | // 路线图 |
| 82 | String roadmap = runningFinishBean.getRoadmap(); | 89 | String roadmap = runningFinishBean.getRoadmap(); |
| 90 | + roadmap = ""; | ||
| 83 | //经纬度 | 91 | //经纬度 |
| 84 | String latLongitude = ""; | 92 | String latLongitude = ""; |
| 85 | // 开始时间 | 93 | // 开始时间 |
| @@ -124,18 +132,41 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter<RunningFinis | @@ -124,18 +132,41 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter<RunningFinis | ||
| 124 | .setFailureCallback(new FailureCallback() { | 132 | .setFailureCallback(new FailureCallback() { |
| 125 | @Override | 133 | @Override |
| 126 | public void onFailure(int code, String message) { | 134 | public void onFailure(int code, String message) { |
| 127 | - QMUITipDialogUtil.dismessDialog(); | ||
| 128 | if (getView() == null) { | 135 | if (getView() == null) { |
| 129 | return; | 136 | return; |
| 130 | } | 137 | } |
| 131 | Log.e("saveRouteData", "onFailure: " + message); | 138 | Log.e("saveRouteData", "onFailure: " + message); |
| 132 | -// getView().hideLoadingView(); | ||
| 133 | -// getView().showRetryView(code, new View.OnClickListener() { | ||
| 134 | -// @Override | ||
| 135 | -// public void onClick(View view) { | ||
| 136 | -// getRunRaceDetailInfo(context, id, userId,state); | ||
| 137 | -// } | ||
| 138 | -// }); | 139 | + QMUITipDialogUtil.dismessDialog(); |
| 140 | + if (uploadFailDialog == null) { | ||
| 141 | + uploadFailDialog = new SelectDialog(context, "上传数据失败,是否重试?", "重试", new SelectDialog.DialogInterface() { | ||
| 142 | + @Override | ||
| 143 | + public void onClick(SelectDialog dialog) { | ||
| 144 | + dialog.dismiss(); | ||
| 145 | + saveRouteData(context, userStepEntity, runningFinishBean); | ||
| 146 | + } | ||
| 147 | + }, "暂存", new SelectDialog.DialogInterface() { | ||
| 148 | + @Override | ||
| 149 | + public void onClick(SelectDialog dialog) { | ||
| 150 | + dialog.dismiss(); | ||
| 151 | + StepUtil.clearRunData(context, CommonInfo.getUserId(context)); | ||
| 152 | + CommonInfo.reset(context); | ||
| 153 | + //跳转到上传失败列表 | ||
| 154 | + LineUpAgainActivity.newInstance(context); | ||
| 155 | + //关闭当前窗口 | ||
| 156 | + context.finish(); | ||
| 157 | + | ||
| 158 | + } | ||
| 159 | + }); | ||
| 160 | + uploadFailDialog.setCanceledOnTouchOutside(false); | ||
| 161 | + uploadFailDialog.setCancelable(false); | ||
| 162 | + if (!uploadFailDialog.isShowing()) { | ||
| 163 | + uploadFailDialog.show(); | ||
| 164 | + } | ||
| 165 | + } else { | ||
| 166 | + if (!uploadFailDialog.isShowing()) { | ||
| 167 | + uploadFailDialog.show(); | ||
| 168 | + } | ||
| 169 | + } | ||
| 139 | } | 170 | } |
| 140 | }).setSuccessCallback(new SuccessCallback<BaseInfo>() { | 171 | }).setSuccessCallback(new SuccessCallback<BaseInfo>() { |
| 141 | @Override | 172 | @Override |
| @@ -143,10 +174,15 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter<RunningFinis | @@ -143,10 +174,15 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter<RunningFinis | ||
| 143 | if (getView() == null) { | 174 | if (getView() == null) { |
| 144 | return; | 175 | return; |
| 145 | } | 176 | } |
| 146 | - Log.e("saveRouteData", "onSuccess: "); | ||
| 147 | - | ||
| 148 | QMUITipDialogUtil.dismessDialog(); | 177 | QMUITipDialogUtil.dismessDialog(); |
| 149 | getView().updataIsFinish(runningFinishBean); | 178 | getView().updataIsFinish(runningFinishBean); |
| 179 | + //删除暂存数据 | ||
| 180 | + FailedEntity entity = StepUtil.getTempSaveFailData(context, CommonInfo.getUserId(context), userStepEntity.getStartTimeStamp()); | ||
| 181 | + if (entity != null) { | ||
| 182 | + //删除 | ||
| 183 | + StepUtil.deleteTempSaveFailData(context, entity); | ||
| 184 | + } | ||
| 185 | + //删除当前跑步数据 | ||
| 150 | StepUtil.clearRunData(context, CommonInfo.getUserId(context)); | 186 | StepUtil.clearRunData(context, CommonInfo.getUserId(context)); |
| 151 | CommonInfo.reset(context); | 187 | CommonInfo.reset(context); |
| 152 | 188 | ||
| @@ -157,17 +193,19 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter<RunningFinis | @@ -157,17 +193,19 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter<RunningFinis | ||
| 157 | /** | 193 | /** |
| 158 | * 查询当前用户历史轨迹 | 194 | * 查询当前用户历史轨迹 |
| 159 | */ | 195 | */ |
| 160 | - public void queryHistoryTrace(Context context, UserStepEntity userStepEntity, RunningFinishBean runningFinishBean) { | 196 | + public void queryHistoryTrace(Activity context, UserStepEntity userStepEntity, RunningFinishBean runningFinishBean) { |
| 197 | + QMUITipDialogUtil.loadingDialog(context, "正在获取轨迹信息,请稍后", false); | ||
| 161 | //查询当前用户的历史轨迹 | 198 | //查询当前用户的历史轨迹 |
| 162 | long startTime = userStepEntity.getStartTimeStamp(); | 199 | long startTime = userStepEntity.getStartTimeStamp(); |
| 163 | //获取当前的时间戳(秒) | 200 | //获取当前的时间戳(秒) |
| 164 | long endTime = userStepEntity.getFinishTimeStamp(); | 201 | long endTime = userStepEntity.getFinishTimeStamp(); |
| 165 | //获取当前的实体名称 | 202 | //获取当前的实体名称 |
| 166 | String entityName = CommonInfo.getUserId(context); | 203 | String entityName = CommonInfo.getUserId(context); |
| 167 | - //路线全程里数 | ||
| 168 | - | ||
| 169 | //打的重要点 | 204 | //打的重要点 |
| 170 | - List<LatLng> importPoints = GsonUtil.jsonToList(imports, LatLng.class); | 205 | + importPoints = null; |
| 206 | + if (!TextUtils.isEmpty(userStepEntity.getImportPoint())) { | ||
| 207 | + importPoints = GsonUtil.jsonToList(userStepEntity.getImportPoint(), LatLng.class); | ||
| 208 | + } | ||
| 171 | if (mClient == null) { | 209 | if (mClient == null) { |
| 172 | mClient = new LBSTraceClient(context); | 210 | mClient = new LBSTraceClient(context); |
| 173 | } | 211 | } |
| @@ -175,10 +213,11 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter<RunningFinis | @@ -175,10 +213,11 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter<RunningFinis | ||
| 175 | @Override | 213 | @Override |
| 176 | public void success(List<LatLng> resultPoints) { | 214 | public void success(List<LatLng> resultPoints) { |
| 177 | if (resultPoints != null) { | 215 | if (resultPoints != null) { |
| 178 | - if (getView() != null && resultPoints != null) { | ||
| 179 | - if (importPoints != null && resultPoints != null) { | 216 | + if (getView() != null) { |
| 217 | + QMUITipDialogUtil.dismessDialog(); | ||
| 218 | + if (importPoints != null) { | ||
| 180 | //判断是否完成 | 219 | //判断是否完成 |
| 181 | - boolean isFinish = MyMapUtil.checkIsFinishTrace(importPoints, resultPoints, 0.6); | 220 | + boolean isFinish = MyMapUtil.checkIsFinishTrace(importPoints, resultPoints, Constant.PASS_RATE); |
| 182 | if (isFinish) { | 221 | if (isFinish) { |
| 183 | Toast.makeText(context, "完成", Toast.LENGTH_LONG).show(); | 222 | Toast.makeText(context, "完成", Toast.LENGTH_LONG).show(); |
| 184 | runningFinishBean.setIsFinish("1"); | 223 | runningFinishBean.setIsFinish("1"); |
| @@ -187,87 +226,51 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter<RunningFinis | @@ -187,87 +226,51 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter<RunningFinis | ||
| 187 | runningFinishBean.setIsFinish("0"); | 226 | runningFinishBean.setIsFinish("0"); |
| 188 | } | 227 | } |
| 189 | MyMapUtil.drawHistoryTrack(context, getView().baiduMap, resultPoints, SortType.asc, R.color.red, R.drawable.icon_start, R.drawable.icon_end); | 228 | MyMapUtil.drawHistoryTrack(context, getView().baiduMap, resultPoints, SortType.asc, R.color.red, R.drawable.icon_start, R.drawable.icon_end); |
| 190 | - new Handler().postDelayed(new Runnable() { | ||
| 191 | - @Override | ||
| 192 | - public void run() { | ||
| 193 | - //开始截图 | ||
| 194 | - getView().baiduMap.snapshot(new BaiduMap.SnapshotReadyCallback() { | ||
| 195 | - @Override | ||
| 196 | - public void onSnapshotReady(Bitmap bitmap) { | ||
| 197 | - if (context == null) { | ||
| 198 | - return; | ||
| 199 | - } | ||
| 200 | - if (null == bitmap) { | ||
| 201 | - return; | ||
| 202 | - } | ||
| 203 | - //开始保存截屏 | ||
| 204 | - try { | ||
| 205 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); | ||
| 206 | - File image = new File(context.getExternalCacheDir() + "/location_screenshot_" + sdf.format(new Date()) + ".jpeg"); | ||
| 207 | - FileOutputStream fos = new FileOutputStream(image); | ||
| 208 | - boolean b = bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos); | ||
| 209 | - fos.flush(); | ||
| 210 | - fos.close(); | ||
| 211 | - String mapImagePath = image.getAbsolutePath(); | ||
| 212 | - if (!TextUtils.isEmpty(mapImagePath)) { | ||
| 213 | - QMUITipDialogUtil.loadingDialog(context, "正在上传数据", false); | ||
| 214 | - //开始上传7牛 | ||
| 215 | - List<String> imagePaths = new ArrayList<>(); | ||
| 216 | - imagePaths.add(mapImagePath); | ||
| 217 | - UploadLogic.uploadAddressPicInfo(getView().getContext(), imagePaths, new Event<String>() | ||
| 218 | - .setFailureCallback(new FailureCallback() { | ||
| 219 | - @Override | ||
| 220 | - public void onFailure(int i, String s) { | ||
| 221 | - QMUITipDialogUtil.dismessDialog(); | ||
| 222 | - } | ||
| 223 | - }) | ||
| 224 | - .setSuccessCallback(new SuccessCallback<String>() { | ||
| 225 | - @Override | ||
| 226 | - public void onSuccess(String data) { | ||
| 227 | - //设置截图 | ||
| 228 | - runningFinishBean.setRoadmap(data); | ||
| 229 | - //开始向服务器传数据 | ||
| 230 | - saveRouteData(context, userStepEntity, runningFinishBean); | ||
| 231 | - } | ||
| 232 | - }) | ||
| 233 | - ); | ||
| 234 | - } | ||
| 235 | - } catch (Exception e) { | ||
| 236 | - e.printStackTrace(); | ||
| 237 | - } | ||
| 238 | - } | ||
| 239 | - }); | ||
| 240 | -// | ||
| 241 | - } | ||
| 242 | - }, 2000); | ||
| 243 | - // | 229 | + saveRouteData(context, userStepEntity, runningFinishBean); |
| 244 | } | 230 | } |
| 245 | } | 231 | } |
| 246 | } | 232 | } |
| 247 | //查询失败 | 233 | //查询失败 |
| 248 | else { | 234 | else { |
| 249 | QMUITipDialogUtil.dismessDialog(); | 235 | QMUITipDialogUtil.dismessDialog(); |
| 250 | - SelectDialog selectDialog = new SelectDialog(context, "获取轨迹失败,是否重试?", "重试", new SelectDialog.DialogInterface() { | ||
| 251 | - @Override | ||
| 252 | - public void onClick(SelectDialog dialog) { | ||
| 253 | - dialog.dismiss(); | ||
| 254 | - queryHistoryTrace(context, userStepEntity, runningFinishBean); | 236 | + if (failTraceDialog == null) { |
| 237 | + failTraceDialog = new SelectDialog(context, "获取轨迹失败,是否重试?", "重试", new SelectDialog.DialogInterface() { | ||
| 238 | + @Override | ||
| 239 | + public void onClick(SelectDialog dialog) { | ||
| 240 | + dialog.dismiss(); | ||
| 241 | + queryHistoryTrace(context, userStepEntity, runningFinishBean); | ||
| 242 | + } | ||
| 243 | + }, "暂存", new SelectDialog.DialogInterface() { | ||
| 244 | + @Override | ||
| 245 | + public void onClick(SelectDialog dialog) { | ||
| 246 | + dialog.dismiss(); | ||
| 247 | + StepUtil.clearRunData(context, CommonInfo.getUserId(context)); | ||
| 248 | + CommonInfo.reset(context); | ||
| 249 | + //跳转到上传失败列表 | ||
| 250 | + LineUpAgainActivity.newInstance(context); | ||
| 251 | + //关闭当前窗口 | ||
| 252 | + context.finish(); | ||
| 253 | + | ||
| 254 | + } | ||
| 255 | + }); | ||
| 256 | + failTraceDialog.setCanceledOnTouchOutside(false); | ||
| 257 | + failTraceDialog.setCancelable(false); | ||
| 258 | + if (!failTraceDialog.isShowing()) { | ||
| 259 | + failTraceDialog.show(); | ||
| 255 | } | 260 | } |
| 256 | - }, "暂存", new SelectDialog.DialogInterface() { | ||
| 257 | - @Override | ||
| 258 | - public void onClick(SelectDialog dialog) { | ||
| 259 | - dialog.dismiss(); | 261 | + |
| 262 | + } else { | ||
| 263 | + if (!failTraceDialog.isShowing()) { | ||
| 264 | + failTraceDialog.show(); | ||
| 260 | } | 265 | } |
| 261 | - }); | ||
| 262 | - selectDialog.setCanceledOnTouchOutside(false); | ||
| 263 | - selectDialog.setCancelable(false); | ||
| 264 | - selectDialog.show(); | 266 | + } |
| 265 | } | 267 | } |
| 266 | } | 268 | } |
| 267 | }); | 269 | }); |
| 268 | 270 | ||
| 269 | } | 271 | } |
| 270 | 272 | ||
| 273 | + | ||
| 271 | /** | 274 | /** |
| 272 | * 查询运营人员踩得轨迹 | 275 | * 查询运营人员踩得轨迹 |
| 273 | * | 276 | * |
| @@ -298,4 +301,60 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter<RunningFinis | @@ -298,4 +301,60 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter<RunningFinis | ||
| 298 | } | 301 | } |
| 299 | 302 | ||
| 300 | } | 303 | } |
| 304 | + | ||
| 305 | + | ||
| 306 | +// new Handler().postDelayed(new Runnable() { | ||
| 307 | +// @Override | ||
| 308 | +// public void run() { | ||
| 309 | +// //开始截图 | ||
| 310 | +// getView().baiduMap.snapshot(new BaiduMap.SnapshotReadyCallback() { | ||
| 311 | +// @Override | ||
| 312 | +// public void onSnapshotReady(Bitmap bitmap) { | ||
| 313 | +// if (context == null) { | ||
| 314 | +// return; | ||
| 315 | +// } | ||
| 316 | +// if (null == bitmap) { | ||
| 317 | +// return; | ||
| 318 | +// } | ||
| 319 | +// //开始保存截屏 | ||
| 320 | +// try { | ||
| 321 | +// SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); | ||
| 322 | +// File image = new File(context.getExternalCacheDir() + "/location_screenshot_" + sdf.format(new Date()) + ".jpeg"); | ||
| 323 | +// FileOutputStream fos = new FileOutputStream(image); | ||
| 324 | +// boolean b = bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos); | ||
| 325 | +// fos.flush(); | ||
| 326 | +// fos.close(); | ||
| 327 | +// String mapImagePath = image.getAbsolutePath(); | ||
| 328 | +// if (!TextUtils.isEmpty(mapImagePath)) { | ||
| 329 | +// QMUITipDialogUtil.loadingDialog(context, "正在上传数据", false); | ||
| 330 | +// //开始上传7牛 | ||
| 331 | +// List<String> imagePaths = new ArrayList<>(); | ||
| 332 | +// imagePaths.add(mapImagePath); | ||
| 333 | +// UploadLogic.uploadAddressPicInfo(getView().getContext(), imagePaths, new Event<String>() | ||
| 334 | +// .setFailureCallback(new FailureCallback() { | ||
| 335 | +// @Override | ||
| 336 | +// public void onFailure(int i, String s) { | ||
| 337 | +// QMUITipDialogUtil.dismessDialog(); | ||
| 338 | +// } | ||
| 339 | +// }) | ||
| 340 | +// .setSuccessCallback(new SuccessCallback<String>() { | ||
| 341 | +// @Override | ||
| 342 | +// public void onSuccess(String data) { | ||
| 343 | +// //设置截图 | ||
| 344 | +// runningFinishBean.setRoadmap(data); | ||
| 345 | +// //开始向服务器传数据 | ||
| 346 | +// saveRouteData(context, userStepEntity, runningFinishBean); | ||
| 347 | +// } | ||
| 348 | +// }) | ||
| 349 | +// ); | ||
| 350 | +// } | ||
| 351 | +// } catch (Exception e) { | ||
| 352 | +// e.printStackTrace(); | ||
| 353 | +// } | ||
| 354 | +// } | ||
| 355 | +// }); | ||
| 356 | +//// | ||
| 357 | +// } | ||
| 358 | +// }, 2000); | ||
| 359 | + // | ||
| 301 | } | 360 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/UploadFailDetailFragmentPresenter.java
0 → 100644
| 1 | +package com.cnlive.moudle.pedometer.frame.presenter; | ||
| 2 | + | ||
| 3 | +import com.cnlive.moudle.pedometer.frame.view.UploadFailDetailFragmentView; | ||
| 4 | +import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; | ||
| 5 | + | ||
| 6 | +public class UploadFailDetailFragmentPresenter extends MvpBasePresenter<UploadFailDetailFragmentView> { | ||
| 7 | +} |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/LineUpAgainView.java
| 1 | package com.cnlive.moudle.pedometer.frame.view; | 1 | package com.cnlive.moudle.pedometer.frame.view; |
| 2 | 2 | ||
| 3 | import android.support.v7.widget.LinearLayoutManager; | 3 | import android.support.v7.widget.LinearLayoutManager; |
| 4 | +import android.view.View; | ||
| 4 | 5 | ||
| 6 | +import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | ||
| 7 | +import com.cnlive.moudle.pedometer.sql.entity.FailedEntity; | ||
| 8 | +import com.cnlive.moudle.pedometer.ui.activity.UploadFailDetailActivity; | ||
| 5 | import com.cnlive.moudle.pedometer.ui.adapter.LineUpAgainAdapter; | 9 | import com.cnlive.moudle.pedometer.ui.adapter.LineUpAgainAdapter; |
| 6 | import com.cnlive.moudle.pedometer.ui.fragment.LineUpAgainFragment; | 10 | import com.cnlive.moudle.pedometer.ui.fragment.LineUpAgainFragment; |
| 11 | +import com.cnlive.moudle.pedometer.utils.StepUtil; | ||
| 7 | import com.example.moudle_pedometer.R; | 12 | import com.example.moudle_pedometer.R; |
| 8 | import com.hannesdorfmann.mosby3.mvp.MvpView; | 13 | import com.hannesdorfmann.mosby3.mvp.MvpView; |
| 9 | import com.scwang.smartrefresh.layout.footer.ClassicsFooter; | 14 | import com.scwang.smartrefresh.layout.footer.ClassicsFooter; |
| @@ -19,30 +24,31 @@ import java.util.List; | @@ -19,30 +24,31 @@ import java.util.List; | ||
| 19 | public class LineUpAgainView implements MvpView { | 24 | public class LineUpAgainView implements MvpView { |
| 20 | 25 | ||
| 21 | private LineUpAgainFragment fragment; | 26 | private LineUpAgainFragment fragment; |
| 27 | + private LineUpAgainAdapter againAdapter; | ||
| 22 | 28 | ||
| 23 | public LineUpAgainView(LineUpAgainFragment fragment) { | 29 | public LineUpAgainView(LineUpAgainFragment fragment) { |
| 24 | this.fragment = fragment; | 30 | this.fragment = fragment; |
| 25 | } | 31 | } |
| 26 | 32 | ||
| 27 | - public void initView(){ | 33 | + public void initView() { |
| 28 | fragment.binding.topbar.addLeftImageButton(R.drawable.top_back_black, R.id.fragment_back).setOnClickListener(v -> { | 34 | fragment.binding.topbar.addLeftImageButton(R.drawable.top_back_black, R.id.fragment_back).setOnClickListener(v -> { |
| 29 | fragment.getActivity().finish(); | 35 | fragment.getActivity().finish(); |
| 30 | }); | 36 | }); |
| 31 | fragment.binding.topbar.setTitle("重新上传"); | 37 | fragment.binding.topbar.setTitle("重新上传"); |
| 32 | - | 38 | + //获取上传失败的数据 |
| 33 | // fragment.binding.refreshLayout.setRefreshHeader(new ClassicsHeader(fragment.getActivity())); | 39 | // fragment.binding.refreshLayout.setRefreshHeader(new ClassicsHeader(fragment.getActivity())); |
| 34 | // fragment.binding.refreshLayout.setRefreshFooter(new ClassicsFooter(fragment.getActivity())); | 40 | // fragment.binding.refreshLayout.setRefreshFooter(new ClassicsFooter(fragment.getActivity())); |
| 35 | fragment.binding.recycler.setLayoutManager(new LinearLayoutManager(fragment.getActivity())); | 41 | fragment.binding.recycler.setLayoutManager(new LinearLayoutManager(fragment.getActivity())); |
| 36 | } | 42 | } |
| 37 | 43 | ||
| 38 | - public void setData(){ | ||
| 39 | - List<String> list = new ArrayList<>(); | ||
| 40 | - list.add("fffff"); | ||
| 41 | - list.add("fffff"); | ||
| 42 | - list.add("fffff"); | ||
| 43 | - list.add("fffff"); | ||
| 44 | - list.add("fffff"); | ||
| 45 | - LineUpAgainAdapter againAdapter = new LineUpAgainAdapter(list,fragment.getActivity()); | 44 | + public void setData(List<FailedEntity> failedEntities) { |
| 45 | + againAdapter = new LineUpAgainAdapter(failedEntities, fragment.getActivity()); | ||
| 46 | fragment.binding.recycler.setAdapter(againAdapter); | 46 | fragment.binding.recycler.setAdapter(againAdapter); |
| 47 | + againAdapter.setOnClickListener(new LineUpAgainAdapter.OnClickListener() { | ||
| 48 | + @Override | ||
| 49 | + public void onClickListener(FailedEntity bean, int position) { | ||
| 50 | + UploadFailDetailActivity.startActivity(fragment.getActivity(), bean); | ||
| 51 | + } | ||
| 52 | + }); | ||
| 47 | } | 53 | } |
| 48 | } | 54 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunMainFragmentView.java
| 1 | package com.cnlive.moudle.pedometer.frame.view; | 1 | package com.cnlive.moudle.pedometer.frame.view; |
| 2 | 2 | ||
| 3 | +import android.app.Activity; | ||
| 3 | import android.content.Context; | 4 | import android.content.Context; |
| 4 | import android.content.Intent; | 5 | import android.content.Intent; |
| 5 | import android.os.Handler; | 6 | import android.os.Handler; |
| @@ -25,9 +26,12 @@ import com.cnlive.moudle.pedometer.model.RunningFinishBean; | @@ -25,9 +26,12 @@ import com.cnlive.moudle.pedometer.model.RunningFinishBean; | ||
| 25 | import com.cnlive.moudle.pedometer.model.RunningMapBean; | 26 | import com.cnlive.moudle.pedometer.model.RunningMapBean; |
| 26 | import com.cnlive.moudle.pedometer.model.Constant; | 27 | import com.cnlive.moudle.pedometer.model.Constant; |
| 27 | import com.cnlive.moudle.pedometer.model.MessageEvent; | 28 | import com.cnlive.moudle.pedometer.model.MessageEvent; |
| 29 | +import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; | ||
| 28 | import com.cnlive.moudle.pedometer.service.KeepLiveService; | 30 | import com.cnlive.moudle.pedometer.service.KeepLiveService; |
| 29 | import com.cnlive.moudle.pedometer.service.StepService; | 31 | import com.cnlive.moudle.pedometer.service.StepService; |
| 32 | +import com.cnlive.moudle.pedometer.sql.entity.FailedEntity; | ||
| 30 | import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; | 33 | import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; |
| 34 | +import com.cnlive.moudle.pedometer.ui.activity.LineUpAgainActivity; | ||
| 31 | import com.cnlive.moudle.pedometer.ui.activity.RunRaceDetailActivity; | 35 | import com.cnlive.moudle.pedometer.ui.activity.RunRaceDetailActivity; |
| 32 | import com.cnlive.moudle.pedometer.ui.activity.RunningFinishActivity; | 36 | import com.cnlive.moudle.pedometer.ui.activity.RunningFinishActivity; |
| 33 | import com.cnlive.moudle.pedometer.ui.activity.RunningMapActivity; | 37 | import com.cnlive.moudle.pedometer.ui.activity.RunningMapActivity; |
| @@ -64,6 +68,7 @@ public class RunMainFragmentView implements MvpView { | @@ -64,6 +68,7 @@ public class RunMainFragmentView implements MvpView { | ||
| 64 | // 定位相关 | 68 | // 定位相关 |
| 65 | private LocationClient mLocClient; | 69 | private LocationClient mLocClient; |
| 66 | public MyLocationListenner myListener = new MyLocationListenner(); | 70 | public MyLocationListenner myListener = new MyLocationListenner(); |
| 71 | + private String employTime = ""; | ||
| 67 | 72 | ||
| 68 | public RunMainFragmentView(RunMainFragment fragment) { | 73 | public RunMainFragmentView(RunMainFragment fragment) { |
| 69 | this.fragment = fragment; | 74 | this.fragment = fragment; |
| @@ -116,10 +121,27 @@ public class RunMainFragmentView implements MvpView { | @@ -116,10 +121,27 @@ public class RunMainFragmentView implements MvpView { | ||
| 116 | /** | 121 | /** |
| 117 | * 初始化相关视图 | 122 | * 初始化相关视图 |
| 118 | */ | 123 | */ |
| 119 | - public void initView() { | 124 | + public void initView(RunRaceDetailInfo runRaceDetailInfo) { |
| 120 | Log.e(TAG, "initView: +时间" + SystemClock.elapsedRealtime()); | 125 | Log.e(TAG, "initView: +时间" + SystemClock.elapsedRealtime()); |
| 121 | uid = CommonInfo.getUserId(getContext()); | 126 | uid = CommonInfo.getUserId(getContext()); |
| 122 | userStepEntity = StepUtil.getUserStepData(getContext(), uid); | 127 | userStepEntity = StepUtil.getUserStepData(getContext(), uid); |
| 128 | + //设置数据 | ||
| 129 | + if (userStepEntity != null) { | ||
| 130 | + //设置赛事标题 | ||
| 131 | + if (TextUtils.isEmpty(userStepEntity.getStreetTitle())) { | ||
| 132 | + StepUtil.setStreetTitle(getContext(), CommonInfo.getUserId(getContext()), runRaceDetailInfo.getTitle()); | ||
| 133 | + } | ||
| 134 | + //设置实体名字 | ||
| 135 | + if (TextUtils.isEmpty(userStepEntity.getQueryEntityName())) { | ||
| 136 | + long startTime = Long.parseLong(runRaceDetailInfo.getStartTime()); | ||
| 137 | + long endTime = Long.parseLong(runRaceDetailInfo.getEndTime()); | ||
| 138 | + StepUtil.setQueryTraceTime(getContext(), CommonInfo.getUserId(getContext()), startTime, endTime, runRaceDetailInfo.getEntityName()); | ||
| 139 | + } | ||
| 140 | + //设置重要点 | ||
| 141 | + if (TextUtils.isEmpty(userStepEntity.getImportPoint())){ | ||
| 142 | + StepUtil.setImportPoints(getContext(),CommonInfo.getUserId(getContext()),runRaceDetailInfo.getLatLongitude()); | ||
| 143 | + } | ||
| 144 | + } | ||
| 123 | initLocationClient(); | 145 | initLocationClient(); |
| 124 | fragment.binding.llRunMainRoot.setVisibility(View.GONE); | 146 | fragment.binding.llRunMainRoot.setVisibility(View.GONE); |
| 125 | ButtonAnimUtil.startAnimation(fragment.binding.llStartTimeTip, false); | 147 | ButtonAnimUtil.startAnimation(fragment.binding.llStartTimeTip, false); |
| @@ -167,6 +189,7 @@ public class RunMainFragmentView implements MvpView { | @@ -167,6 +189,7 @@ public class RunMainFragmentView implements MvpView { | ||
| 167 | int hour = (int) ((SystemClock.elapsedRealtime() - chronometer.getBase()) / 1000 / 60 / 60); | 189 | int hour = (int) ((SystemClock.elapsedRealtime() - chronometer.getBase()) / 1000 / 60 / 60); |
| 168 | int minute = (int) ((SystemClock.elapsedRealtime() - chronometer.getBase()) / 1000 / 60) % 60; | 190 | int minute = (int) ((SystemClock.elapsedRealtime() - chronometer.getBase()) / 1000 / 60) % 60; |
| 169 | int second = (int) ((SystemClock.elapsedRealtime() - chronometer.getBase()) / 1000) % 60; | 191 | int second = (int) ((SystemClock.elapsedRealtime() - chronometer.getBase()) / 1000) % 60; |
| 192 | + employTime = (hour * 3600 + minute * 60 + second) + ""; | ||
| 170 | if (hour < 1) { | 193 | if (hour < 1) { |
| 171 | if (minute == 59 && second == 59) { | 194 | if (minute == 59 && second == 59) { |
| 172 | chronometer.setFormat("0" + "%s"); | 195 | chronometer.setFormat("0" + "%s"); |
| @@ -181,6 +204,7 @@ public class RunMainFragmentView implements MvpView { | @@ -181,6 +204,7 @@ public class RunMainFragmentView implements MvpView { | ||
| 181 | 204 | ||
| 182 | } | 205 | } |
| 183 | }); | 206 | }); |
| 207 | + | ||
| 184 | boolean isFirstShowTime = CommonInfo.getIsFirstShowTimeTip(getContext()); | 208 | boolean isFirstShowTime = CommonInfo.getIsFirstShowTimeTip(getContext()); |
| 185 | //当前用户已经在运动 | 209 | //当前用户已经在运动 |
| 186 | if (isFirstShowTime) { | 210 | if (isFirstShowTime) { |
| @@ -210,7 +234,7 @@ public class RunMainFragmentView implements MvpView { | @@ -210,7 +234,7 @@ public class RunMainFragmentView implements MvpView { | ||
| 210 | fragment.binding.chronometer.setBase(SystemClock.elapsedRealtime()); | 234 | fragment.binding.chronometer.setBase(SystemClock.elapsedRealtime()); |
| 211 | } | 235 | } |
| 212 | //设置继续运动时间 | 236 | //设置继续运动时间 |
| 213 | - StepUtil.setContinueTime(getContext(),uid,TimeUtil.getNowTimeStamp()); | 237 | + StepUtil.setContinueTime(getContext(), uid, TimeUtil.getNowTimeStamp()); |
| 214 | //因为进来以后就运动了,所以需要改变状态 | 238 | //因为进来以后就运动了,所以需要改变状态 |
| 215 | CommonInfo.setIsPauseState(getContext(), false); | 239 | CommonInfo.setIsPauseState(getContext(), false); |
| 216 | //重新设置开始时间 | 240 | //重新设置开始时间 |
| @@ -263,7 +287,7 @@ public class RunMainFragmentView implements MvpView { | @@ -263,7 +287,7 @@ public class RunMainFragmentView implements MvpView { | ||
| 263 | @Override | 287 | @Override |
| 264 | public void onClick(View view) { | 288 | public void onClick(View view) { |
| 265 | //设置继续运动时间 | 289 | //设置继续运动时间 |
| 266 | - StepUtil.setContinueTime(getContext(),uid,TimeUtil.getNowTimeStamp()); | 290 | + StepUtil.setContinueTime(getContext(), uid, TimeUtil.getNowTimeStamp()); |
| 267 | //设置继续标志 | 291 | //设置继续标志 |
| 268 | CommonInfo.setIsPauseState(getContext(), false); | 292 | CommonInfo.setIsPauseState(getContext(), false); |
| 269 | //继续记录轨迹 | 293 | //继续记录轨迹 |
| @@ -330,11 +354,12 @@ public class RunMainFragmentView implements MvpView { | @@ -330,11 +354,12 @@ public class RunMainFragmentView implements MvpView { | ||
| 330 | SelectDialog selectDialog = new SelectDialog(fragment.getActivity(), "确定结束运动吗?", "确定", new SelectDialog.DialogInterface() { | 354 | SelectDialog selectDialog = new SelectDialog(fragment.getActivity(), "确定结束运动吗?", "确定", new SelectDialog.DialogInterface() { |
| 331 | @Override | 355 | @Override |
| 332 | public void onClick(SelectDialog dialog) { | 356 | public void onClick(SelectDialog dialog) { |
| 357 | + //停止计时 | ||
| 358 | + fragment.binding.chronometer.stop(); | ||
| 333 | //设置状态标志位 | 359 | //设置状态标志位 |
| 334 | setStopStartFlag(); | 360 | setStopStartFlag(); |
| 335 | //设置运动结束时间戳 | 361 | //设置运动结束时间戳 |
| 336 | StepUtil.setUserFinishTimeStamp(getContext(), uid); | 362 | StepUtil.setUserFinishTimeStamp(getContext(), uid); |
| 337 | - CommonInfo.setStepEndTime(getContext(), TimeUtil.getNowTimeStamp()); | ||
| 338 | fragment.binding.cpCurrent.setVisibility(View.GONE); | 363 | fragment.binding.cpCurrent.setVisibility(View.GONE); |
| 339 | ButtonAnimUtil.setViewDefault(fragment.binding.flStop); | 364 | ButtonAnimUtil.setViewDefault(fragment.binding.flStop); |
| 340 | dialog.dismiss(); | 365 | dialog.dismiss(); |
| @@ -345,11 +370,20 @@ public class RunMainFragmentView implements MvpView { | @@ -345,11 +370,20 @@ public class RunMainFragmentView implements MvpView { | ||
| 345 | runningFinishBean.setSpeed(fragment.binding.tvSpeed.getText().toString()); | 370 | runningFinishBean.setSpeed(fragment.binding.tvSpeed.getText().toString()); |
| 346 | runningFinishBean.setStep(fragment.binding.tvStepCount.getText().toString()); | 371 | runningFinishBean.setStep(fragment.binding.tvStepCount.getText().toString()); |
| 347 | runningFinishBean.setTime(fragment.binding.chronometer.getText().toString()); | 372 | runningFinishBean.setTime(fragment.binding.chronometer.getText().toString()); |
| 348 | - runningFinishBean.setDate(TimeUtil.getFormatNowTime()); | 373 | + runningFinishBean.setDate(TimeUtil.getStampToTime(userStepEntity.getFinishTimeStamp()*1000,"yyyy/MM/dd HH:mm")); |
| 374 | + runningFinishBean.setStreetTitle(userStepEntity.getStreetTitle()); | ||
| 349 | //设置用时 | 375 | //设置用时 |
| 350 | - runningFinishBean.setEmployTime(TimeUtil.getChronometerSeconds(fragment.binding.chronometer)); | ||
| 351 | - RunningFinishActivity.startActivity(fragment.getActivity(), runningFinishBean); | ||
| 352 | - fragment.getActivity().finish(); | 376 | + runningFinishBean.setEmployTime(employTime); |
| 377 | + | ||
| 378 | + //先将失败数据保存起来 | ||
| 379 | + if (runningFinishBean != null && userStepEntity != null) { | ||
| 380 | + setFailData(getContext(), userStepEntity, runningFinishBean); | ||
| 381 | + } | ||
| 382 | + FailedEntity failedEntity = StepUtil.getTempSaveFailData(getContext(), CommonInfo.getUserId(getContext()), userStepEntity.getStartTimeStamp()); | ||
| 383 | + if (failedEntity != null) { | ||
| 384 | + RunningFinishActivity.startActivity(fragment.getActivity(), runningFinishBean); | ||
| 385 | + fragment.getActivity().finish(); | ||
| 386 | + } | ||
| 353 | } | 387 | } |
| 354 | }, "取消", new SelectDialog.DialogInterface() { | 388 | }, "取消", new SelectDialog.DialogInterface() { |
| 355 | @Override | 389 | @Override |
| @@ -482,6 +516,8 @@ public class RunMainFragmentView implements MvpView { | @@ -482,6 +516,8 @@ public class RunMainFragmentView implements MvpView { | ||
| 482 | * 暂停按钮 | 516 | * 暂停按钮 |
| 483 | */ | 517 | */ |
| 484 | public void onBtnPause() { | 518 | public void onBtnPause() { |
| 519 | + //暂停计步 | ||
| 520 | + EventBus.getDefault().post(new MessageEvent(Constant.SERVICE_STEP_COUNT_PAUSE, "")); | ||
| 485 | //将当前计时器时间戳写入数据库 | 521 | //将当前计时器时间戳写入数据库 |
| 486 | setSQLPauseTime(uid); | 522 | setSQLPauseTime(uid); |
| 487 | //设置暂停标志 | 523 | //设置暂停标志 |
| @@ -533,8 +569,7 @@ public class RunMainFragmentView implements MvpView { | @@ -533,8 +569,7 @@ public class RunMainFragmentView implements MvpView { | ||
| 533 | //停止计时 | 569 | //停止计时 |
| 534 | fragment.binding.chronometer.stop(); | 570 | fragment.binding.chronometer.stop(); |
| 535 | mRecordTime = SystemClock.elapsedRealtime(); | 571 | mRecordTime = SystemClock.elapsedRealtime(); |
| 536 | - //暂停计步 | ||
| 537 | - EventBus.getDefault().post(new MessageEvent(Constant.SERVICE_STEP_COUNT_PAUSE, "")); | 572 | + |
| 538 | } | 573 | } |
| 539 | } | 574 | } |
| 540 | 575 | ||
| @@ -688,6 +723,80 @@ public class RunMainFragmentView implements MvpView { | @@ -688,6 +723,80 @@ public class RunMainFragmentView implements MvpView { | ||
| 688 | mLocClient.stop(); | 723 | mLocClient.stop(); |
| 689 | } | 724 | } |
| 690 | } | 725 | } |
| 726 | + | ||
| 727 | + /** | ||
| 728 | + * 暂存失败数据 | ||
| 729 | + * | ||
| 730 | + * @param context | ||
| 731 | + * @param userStepEntity | ||
| 732 | + * @param runningFinishBean | ||
| 733 | + */ | ||
| 734 | + public void setFailData(Context context, UserStepEntity userStepEntity, RunningFinishBean runningFinishBean) { | ||
| 735 | + if (userStepEntity == null || runningFinishBean == null || context == null) { | ||
| 736 | + return; | ||
| 737 | + } | ||
| 738 | + //设置数据 | ||
| 739 | + FailedEntity failedEntity = new FailedEntity(); | ||
| 740 | + //设置主键 | ||
| 741 | + failedEntity.setUuid(StepUtil.getUUID()); | ||
| 742 | + //设置用户id | ||
| 743 | + failedEntity.setUid(userStepEntity.getUserId()); | ||
| 744 | + //设置当前数据创建时间戳 | ||
| 745 | + failedEntity.setCreatTimeStamp(TimeUtil.getNowTimeStamp()); | ||
| 746 | + //设置是否暂停 | ||
| 747 | + if (userStepEntity.getPauseCount() > 1) { | ||
| 748 | + failedEntity.setIsPause(true); | ||
| 749 | + //设置暂停时间 | ||
| 750 | + failedEntity.setUserPauseTime(userStepEntity.getUserPauseTimeStamp()); | ||
| 751 | + //设置继续时间戳 | ||
| 752 | + failedEntity.setUsrContinueTime(userStepEntity.getContinueTime()); | ||
| 753 | + } else { | ||
| 754 | + failedEntity.setIsPause(false); | ||
| 755 | + } | ||
| 756 | + //设置用时 | ||
| 757 | + failedEntity.setTime(runningFinishBean.getEmployTime()); | ||
| 758 | + //设置配速 | ||
| 759 | + if ("--".equals(runningFinishBean.getSpeed())) { | ||
| 760 | + failedEntity.setSpeed("0"); | ||
| 761 | + } else { | ||
| 762 | + failedEntity.setSpeed(runningFinishBean.getSpeed()); | ||
| 763 | + } | ||
| 764 | + //设置步数 | ||
| 765 | + if ("--".equals(runningFinishBean.getStep())) { | ||
| 766 | + failedEntity.setStep("0"); | ||
| 767 | + } else { | ||
| 768 | + failedEntity.setStep(runningFinishBean.getStep()); | ||
| 769 | + } | ||
| 770 | + //设置距离 | ||
| 771 | + if ("--".equals(runningFinishBean.getRunDistance())) { | ||
| 772 | + failedEntity.setDistance("0"); | ||
| 773 | + } else { | ||
| 774 | + failedEntity.setDistance(runningFinishBean.getRunDistance()); | ||
| 775 | + } | ||
| 776 | + //设置开始地点 | ||
| 777 | + failedEntity.setStartPoint(userStepEntity.getStartPoint()); | ||
| 778 | + //设置结束地点 | ||
| 779 | + failedEntity.setEndPoint(userStepEntity.getEndPoint()); | ||
| 780 | + //设置赛道开始时间 | ||
| 781 | + failedEntity.setStreetTraceStartTime(userStepEntity.getQueryTraceStartTime()); | ||
| 782 | + //设置赛道结束时间 | ||
| 783 | + failedEntity.setStreetTraceEndTime(userStepEntity.getQueryTraceEndTime()); | ||
| 784 | + //设置赛道查询实体 | ||
| 785 | + failedEntity.setEntityName(userStepEntity.getQueryEntityName()); | ||
| 786 | + //设置用户开始时间 | ||
| 787 | + failedEntity.setUserStartTime(userStepEntity.getStartTimeStamp()); | ||
| 788 | + //设置用户完成时间 | ||
| 789 | + failedEntity.setUserEndTime(userStepEntity.getFinishTimeStamp()); | ||
| 790 | + //设置关键点 | ||
| 791 | + failedEntity.setImportPoint(userStepEntity.getImportPoint()); | ||
| 792 | + //设置赛事id | ||
| 793 | + failedEntity.setStreetId(userStepEntity.getStreetId()); | ||
| 794 | + //设置赛事标题 | ||
| 795 | + failedEntity.setStreetTitle(userStepEntity.getStreetTitle()); | ||
| 796 | + //设置数据 | ||
| 797 | + StepUtil.setFailData(context, failedEntity); | ||
| 798 | + | ||
| 799 | + } | ||
| 691 | } | 800 | } |
| 692 | 801 | ||
| 693 | 802 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunRaceDetailFragmentView.java
| @@ -131,7 +131,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -131,7 +131,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 131 | // 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}]"; | 131 | // 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}]"; |
| 132 | private LinkedList<LatLng> importLatLngs;//关键点 | 132 | private LinkedList<LatLng> importLatLngs;//关键点 |
| 133 | private LatLng startLatLng = new LatLng(39.934733, 116.308646);//起始点 | 133 | private LatLng startLatLng = new LatLng(39.934733, 116.308646);//起始点 |
| 134 | - private RunRaceDetailInfo runRaceDetailInfo; | 134 | + public RunRaceDetailInfo runRaceDetailInfo; |
| 135 | private UserStepEntity userStepEntity; | 135 | private UserStepEntity userStepEntity; |
| 136 | private boolean isDifferentStreet = false; | 136 | private boolean isDifferentStreet = false; |
| 137 | private LBSTraceClient mClient = null; | 137 | private LBSTraceClient mClient = null; |
| @@ -148,7 +148,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -148,7 +148,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 148 | 148 | ||
| 149 | 149 | ||
| 150 | public void initView(RunRaceDetailInfo runRaceDetailInfo) { | 150 | public void initView(RunRaceDetailInfo runRaceDetailInfo) { |
| 151 | - | 151 | + Log.e(TAG, "initView: " + TimeUtil.getNowTimeStamp()); |
| 152 | // new Handler().postDelayed(new Runnable() { | 152 | // new Handler().postDelayed(new Runnable() { |
| 153 | // @Override | 153 | // @Override |
| 154 | // public void run() { | 154 | // public void run() { |
| @@ -203,7 +203,6 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -203,7 +203,6 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 203 | // //初始化地图点位 | 203 | // //初始化地图点位 |
| 204 | if (runRaceDetailInfo.getLatLongitude() != null) { | 204 | if (runRaceDetailInfo.getLatLongitude() != null) { |
| 205 | importStreetPoints = GsonUtil.jsonToList(runRaceDetailInfo.getLatLongitude().trim(), LatLng.class); | 205 | importStreetPoints = GsonUtil.jsonToList(runRaceDetailInfo.getLatLongitude().trim(), LatLng.class); |
| 206 | - Log.e(TAG, "importStreetPoints点数量" + importStreetPoints.size()); | ||
| 207 | } | 206 | } |
| 208 | //轨迹开始时间 | 207 | //轨迹开始时间 |
| 209 | long startTime = 0; | 208 | long startTime = 0; |
| @@ -213,12 +212,6 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -213,12 +212,6 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 213 | startTime = Long.parseLong(runRaceDetailInfo.getStartTime()); | 212 | startTime = Long.parseLong(runRaceDetailInfo.getStartTime()); |
| 214 | endTime = Long.parseLong(runRaceDetailInfo.getEndTime()); | 213 | endTime = Long.parseLong(runRaceDetailInfo.getEndTime()); |
| 215 | //todo 注意后续查询历史轨迹的时候,必须查数据库中的时间,因为涉及到历史运动恢复,所以不能用这个sp文件中的,这里设置,只是为了在服务启动成功后, | 214 | //todo 注意后续查询历史轨迹的时候,必须查数据库中的时间,因为涉及到历史运动恢复,所以不能用这个sp文件中的,这里设置,只是为了在服务启动成功后, |
| 216 | - //设置轨迹查询实体名称 | ||
| 217 | - CommonInfo.setQueryEntityName(getContext(), runRaceDetailInfo.getEntityName()); | ||
| 218 | - //设置轨迹查询开始时间 | ||
| 219 | - CommonInfo.setQueryTraceStartTime(getContext(), startTime); | ||
| 220 | - //设置轨迹查询结束时间 | ||
| 221 | - CommonInfo.setQueryTraceEndTime(getContext(), endTime); | ||
| 222 | 215 | ||
| 223 | mClient = new LBSTraceClient(getContext()); | 216 | mClient = new LBSTraceClient(getContext()); |
| 224 | //获取轨迹 | 217 | //获取轨迹 |
| @@ -574,10 +567,10 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -574,10 +567,10 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 574 | stopStepService(); | 567 | stopStepService(); |
| 575 | startStepService(getContext()); | 568 | startStepService(getContext()); |
| 576 | } else { | 569 | } else { |
| 577 | - PedometerMainActivity.startActivity(fragment.getActivity(), runRaceDetailInfo.getStartLocation(), runRaceDetailInfo.getEndLocation(),importStreetPoints); | 570 | + PedometerMainActivity.startActivity(fragment.getActivity(), runRaceDetailInfo); |
| 578 | } | 571 | } |
| 579 | } else { | 572 | } else { |
| 580 | - PedometerMainActivity.startActivity(fragment.getActivity(), runRaceDetailInfo.getStartLocation(), runRaceDetailInfo.getEndLocation(),importStreetPoints); | 573 | + PedometerMainActivity.startActivity(fragment.getActivity(), runRaceDetailInfo); |
| 581 | } | 574 | } |
| 582 | } | 575 | } |
| 583 | 576 | ||
| @@ -913,16 +906,9 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -913,16 +906,9 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 913 | } | 906 | } |
| 914 | //todo 防止停止后,再次开始,无法获取到赛道的轨迹 | 907 | //todo 防止停止后,再次开始,无法获取到赛道的轨迹 |
| 915 | if (runRaceDetailInfo != null) { | 908 | if (runRaceDetailInfo != null) { |
| 916 | - if (!TextUtils.isEmpty(runRaceDetailInfo.getStartTime()) && !TextUtils.isEmpty(runRaceDetailInfo.getEndTime()) && !TextUtils.isEmpty(runRaceDetailInfo.getEntityName())) { | ||
| 917 | - long startTime = Long.parseLong(runRaceDetailInfo.getStartTime()); | ||
| 918 | - long endTime = Long.parseLong(runRaceDetailInfo.getEndTime()); | ||
| 919 | - //todo 注意后续查询历史轨迹的时候,必须查数据库中的时间,因为涉及到历史运动恢复,所以不能用这个sp文件中的,这里设置,只是为了在服务启动成功后, | ||
| 920 | - //设置轨迹查询实体名称 | ||
| 921 | - CommonInfo.setQueryEntityName(getContext(), runRaceDetailInfo.getEntityName()); | ||
| 922 | - //设置轨迹查询开始时间 | ||
| 923 | - CommonInfo.setQueryTraceStartTime(getContext(), startTime); | ||
| 924 | - //设置轨迹查询结束时间 | ||
| 925 | - CommonInfo.setQueryTraceEndTime(getContext(), endTime); | 909 | + if (runRaceDetailInfo.getFenceId() != null) { |
| 910 | + //设置围栏ID | ||
| 911 | + CommonInfo.setFenceId(getContext(), Integer.parseInt(runRaceDetailInfo.getFenceId())); | ||
| 926 | } | 912 | } |
| 927 | } | 913 | } |
| 928 | 914 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunningFinishFragmentView.java
| @@ -42,6 +42,10 @@ public class RunningFinishFragmentView implements MvpView { | @@ -42,6 +42,10 @@ public class RunningFinishFragmentView implements MvpView { | ||
| 42 | public void initView(RunningFinishBean runningFinishBean) { | 42 | public void initView(RunningFinishBean runningFinishBean) { |
| 43 | this.mMapView = fragment.binding.mapView; | 43 | this.mMapView = fragment.binding.mapView; |
| 44 | initMap(); | 44 | initMap(); |
| 45 | + //设置赛事标题 | ||
| 46 | + if (!TextUtils.isEmpty(runningFinishBean.getStreetTitle())) { | ||
| 47 | + fragment.binding.includeFinishUserInfo.tvStreetName.setText(runningFinishBean.getStreetTitle()); | ||
| 48 | + } | ||
| 45 | //设置用户头像 | 49 | //设置用户头像 |
| 46 | String faceUrl = CommonInfo.getUserIcon(getContext()); | 50 | String faceUrl = CommonInfo.getUserIcon(getContext()); |
| 47 | if (!TextUtils.isEmpty(faceUrl)) { | 51 | if (!TextUtils.isEmpty(faceUrl)) { |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/SelfRecordView.java
| 1 | package com.cnlive.moudle.pedometer.frame.view; | 1 | package com.cnlive.moudle.pedometer.frame.view; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | +import android.content.Context; | ||
| 4 | import android.content.Intent; | 5 | import android.content.Intent; |
| 5 | import android.support.v7.widget.LinearLayoutManager; | 6 | import android.support.v7.widget.LinearLayoutManager; |
| 6 | import android.view.View; | 7 | import android.view.View; |
| @@ -12,10 +13,12 @@ import com.cnlive.moudle.pedometer.model.RunningFinishBean; | @@ -12,10 +13,12 @@ import com.cnlive.moudle.pedometer.model.RunningFinishBean; | ||
| 12 | import com.cnlive.moudle.pedometer.net.bean.BaseInfo; | 13 | import com.cnlive.moudle.pedometer.net.bean.BaseInfo; |
| 13 | import com.cnlive.moudle.pedometer.net.bean.EventRouteRecordBeanVoListBean; | 14 | import com.cnlive.moudle.pedometer.net.bean.EventRouteRecordBeanVoListBean; |
| 14 | import com.cnlive.moudle.pedometer.net.bean.SelfRecordInfo; | 15 | import com.cnlive.moudle.pedometer.net.bean.SelfRecordInfo; |
| 16 | +import com.cnlive.moudle.pedometer.sql.entity.FailedEntity; | ||
| 15 | import com.cnlive.moudle.pedometer.ui.activity.LineUpAgainActivity; | 17 | import com.cnlive.moudle.pedometer.ui.activity.LineUpAgainActivity; |
| 16 | import com.cnlive.moudle.pedometer.ui.activity.RunLineActivity; | 18 | import com.cnlive.moudle.pedometer.ui.activity.RunLineActivity; |
| 17 | import com.cnlive.moudle.pedometer.ui.adapter.RaceRecordAdapter; | 19 | import com.cnlive.moudle.pedometer.ui.adapter.RaceRecordAdapter; |
| 18 | import com.cnlive.moudle.pedometer.ui.fragment.SelfRecordFragment; | 20 | import com.cnlive.moudle.pedometer.ui.fragment.SelfRecordFragment; |
| 21 | +import com.cnlive.moudle.pedometer.utils.StepUtil; | ||
| 19 | import com.example.moudle_pedometer.R; | 22 | import com.example.moudle_pedometer.R; |
| 20 | import com.hannesdorfmann.mosby3.mvp.MvpView; | 23 | import com.hannesdorfmann.mosby3.mvp.MvpView; |
| 21 | import com.qmuiteam.qmui.widget.dialog.QMUITipDialog; | 24 | import com.qmuiteam.qmui.widget.dialog.QMUITipDialog; |
| @@ -25,6 +28,8 @@ import com.scwang.smartrefresh.layout.header.ClassicsHeader; | @@ -25,6 +28,8 @@ import com.scwang.smartrefresh.layout.header.ClassicsHeader; | ||
| 25 | import java.util.ArrayList; | 28 | import java.util.ArrayList; |
| 26 | import java.util.List; | 29 | import java.util.List; |
| 27 | 30 | ||
| 31 | +import q.rorbin.badgeview.QBadgeView; | ||
| 32 | + | ||
| 28 | /** | 33 | /** |
| 29 | * Created by hanyayun 019/06/12. | 34 | * Created by hanyayun 019/06/12. |
| 30 | */ | 35 | */ |
| @@ -103,6 +108,7 @@ public class SelfRecordView implements MvpView { | @@ -103,6 +108,7 @@ public class SelfRecordView implements MvpView { | ||
| 103 | } | 108 | } |
| 104 | 109 | ||
| 105 | public void initView() { | 110 | public void initView() { |
| 111 | + | ||
| 106 | fragment.binding.back.setOnClickListener(v -> fragment.getActivity().finish()); | 112 | fragment.binding.back.setOnClickListener(v -> fragment.getActivity().finish()); |
| 107 | fragment.binding.refreshLayout.setRefreshHeader(new ClassicsHeader(fragment.getActivity())); | 113 | fragment.binding.refreshLayout.setRefreshHeader(new ClassicsHeader(fragment.getActivity())); |
| 108 | fragment.binding.refreshLayout.setRefreshFooter(new ClassicsFooter(fragment.getActivity())); | 114 | fragment.binding.refreshLayout.setRefreshFooter(new ClassicsFooter(fragment.getActivity())); |
| @@ -120,7 +126,7 @@ public class SelfRecordView implements MvpView { | @@ -120,7 +126,7 @@ public class SelfRecordView implements MvpView { | ||
| 120 | fragment.binding.finishNum.setText("0"); | 126 | fragment.binding.finishNum.setText("0"); |
| 121 | fragment.binding.allTime.setText("00:00:00"); | 127 | fragment.binding.allTime.setText("00:00:00"); |
| 122 | fragment.binding.checkAllLine.setOnClickListener(v -> { | 128 | fragment.binding.checkAllLine.setOnClickListener(v -> { |
| 123 | - RunLineActivity.newInstance(fragment.getActivity(),null,null,null,null); | 129 | + RunLineActivity.newInstance(fragment.getActivity(), null, null, null, null); |
| 124 | }); | 130 | }); |
| 125 | } | 131 | } |
| 126 | 132 | ||
| @@ -161,4 +167,6 @@ public class SelfRecordView implements MvpView { | @@ -161,4 +167,6 @@ public class SelfRecordView implements MvpView { | ||
| 161 | public void hideLoading() { | 167 | public void hideLoading() { |
| 162 | if (loadingDiaog != null) loadingDiaog.dismiss(); | 168 | if (loadingDiaog != null) loadingDiaog.dismiss(); |
| 163 | } | 169 | } |
| 170 | + | ||
| 171 | + | ||
| 164 | } | 172 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/UploadFailDetailFragmentView.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.bumptech.glide.Glide; | ||
| 8 | +import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | ||
| 9 | +import com.cnlive.moudle.pedometer.sql.entity.FailedEntity; | ||
| 10 | +import com.cnlive.moudle.pedometer.ui.fragment.UploadFailDetailFragment; | ||
| 11 | +import com.cnlive.moudle.pedometer.utils.TimeUtil; | ||
| 12 | +import com.hannesdorfmann.mosby3.mvp.MvpView; | ||
| 13 | + | ||
| 14 | +public class UploadFailDetailFragmentView implements MvpView { | ||
| 15 | + private UploadFailDetailFragment fragment; | ||
| 16 | + private FailedEntity failedEntity; | ||
| 17 | + | ||
| 18 | + public UploadFailDetailFragmentView(UploadFailDetailFragment fragment) { | ||
| 19 | + this.fragment = fragment; | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + public Context getContext() { | ||
| 23 | + return fragment == null ? null : fragment.getActivity(); | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + public void initView(FailedEntity failedEntity) { | ||
| 27 | + if (getContext() == null) { | ||
| 28 | + return; | ||
| 29 | + } | ||
| 30 | + if (failedEntity == null) { | ||
| 31 | + return; | ||
| 32 | + } | ||
| 33 | + this.failedEntity = failedEntity; | ||
| 34 | + //隐藏loading | ||
| 35 | + fragment.binding.loading.setVisibility(View.GONE); | ||
| 36 | + //设置提示文字为重新上传 | ||
| 37 | + fragment.binding.tvRunNow.setText("重新上传"); | ||
| 38 | + fragment.binding.rlScrollViewStartBtn.setTag("0"); | ||
| 39 | + //初始化相关数据 | ||
| 40 | + //设置用户昵称 | ||
| 41 | + String nickName = CommonInfo.getUserNickName(getContext()); | ||
| 42 | + if (!TextUtils.isEmpty(nickName)) { | ||
| 43 | + fragment.binding.includeFinishUserInfo.tvUserNickName.setText(nickName); | ||
| 44 | + } | ||
| 45 | + //设置用户头像 | ||
| 46 | + String faceUrl = CommonInfo.getUserIcon(getContext()); | ||
| 47 | + if (!TextUtils.isEmpty(faceUrl)) { | ||
| 48 | + Glide.with(getContext()).load(faceUrl).into(fragment.binding.includeFinishUserInfo.qmIvIcon); | ||
| 49 | + } | ||
| 50 | + //设置赛事标题 | ||
| 51 | + if (!TextUtils.isEmpty(failedEntity.getStreetTitle())) { | ||
| 52 | + fragment.binding.includeFinishUserInfo.tvStreetName.setText(failedEntity.getStreetTitle()); | ||
| 53 | + } | ||
| 54 | + //设置距离 | ||
| 55 | + fragment.binding.includeFinishUserInfo.tvDistance.setText(failedEntity.getDistance()); | ||
| 56 | + //设置配速 | ||
| 57 | + if ("--".equals(failedEntity.getSpeed())) { | ||
| 58 | + fragment.binding.includeFinishUserInfo.tvSpeed.setText("0"); | ||
| 59 | + } else { | ||
| 60 | + fragment.binding.includeFinishUserInfo.tvSpeed.setText(failedEntity.getSpeed()); | ||
| 61 | + } | ||
| 62 | + //设置用时 | ||
| 63 | + fragment.binding.includeFinishUserInfo.tvTimer.setText(TimeUtil.stampToChronometer(Long.parseLong(failedEntity.getTime()))); | ||
| 64 | + //设置日期 | ||
| 65 | + fragment.binding.includeFinishUserInfo.tvDate.setText(TimeUtil.getStampToTime(failedEntity.getUserEndTime() * 1000, "yyyy/MM/dd HH:mm")); | ||
| 66 | + //设置步数 | ||
| 67 | + if ("--".equals(failedEntity.getStep())) { | ||
| 68 | + fragment.binding.includeFinishStep.tvStep.setText("0"); | ||
| 69 | + } else { | ||
| 70 | + fragment.binding.includeFinishStep.tvStep.setText(failedEntity.getStep()); | ||
| 71 | + } | ||
| 72 | + //设置起点位置 | ||
| 73 | + fragment.binding.includeFinishRunRoute.tvStartPoint.setText(failedEntity.getStartPoint()); | ||
| 74 | + //设置终点位置 | ||
| 75 | + fragment.binding.includeFinishRunRoute.tvEndPoint.setText(failedEntity.getEndPoint()); | ||
| 76 | + //设置时间 | ||
| 77 | + fragment.binding.includeFinishRunRoute.tvTimer.setText(TimeUtil.stampToChronometer(Long.parseLong(failedEntity.getTime()))); | ||
| 78 | + //返回按钮点击事件 | ||
| 79 | + fragment.binding.flBack.setOnClickListener(new View.OnClickListener() { | ||
| 80 | + @Override | ||
| 81 | + public void onClick(View view) { | ||
| 82 | + if (fragment.getActivity() != null) { | ||
| 83 | + fragment.getActivity().finish(); | ||
| 84 | + } | ||
| 85 | + } | ||
| 86 | + }); | ||
| 87 | + //重新上传按钮点击事件 | ||
| 88 | + fragment.binding.rlScrollViewStartBtn.setOnClickListener(new View.OnClickListener() { | ||
| 89 | + @Override | ||
| 90 | + public void onClick(View view) { | ||
| 91 | + | ||
| 92 | + } | ||
| 93 | + }); | ||
| 94 | + } | ||
| 95 | +} |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/model/Constant.java
| @@ -3,7 +3,7 @@ package com.cnlive.moudle.pedometer.model; | @@ -3,7 +3,7 @@ package com.cnlive.moudle.pedometer.model; | ||
| 3 | public class Constant { | 3 | public class Constant { |
| 4 | public static final long SERVICE_ID = 213511; | 4 | public static final long SERVICE_ID = 213511; |
| 5 | public static final int TAG = 1; | 5 | public static final int TAG = 1; |
| 6 | - public static final int GATHER_INTERVAL =2;//位置采集周期 | 6 | + public static final int GATHER_INTERVAL = 2;//位置采集周期 |
| 7 | public static final int PACK_INTERVAL = 10;//位置采集周期 | 7 | public static final int PACK_INTERVAL = 10;//位置采集周期 |
| 8 | 8 | ||
| 9 | public static final int SERVICE_STEP_COUNT_UPDATE = 0;//步数更新 | 9 | public static final int SERVICE_STEP_COUNT_UPDATE = 0;//步数更新 |
| @@ -18,5 +18,6 @@ public class Constant { | @@ -18,5 +18,6 @@ public class Constant { | ||
| 18 | public static final int START_TRACE_GATHER_SUCCESS = 9;//启动轨迹服务成功(用户) | 18 | public static final int START_TRACE_GATHER_SUCCESS = 9;//启动轨迹服务成功(用户) |
| 19 | public static final int START_TRACE_GATHER_FAIL = 10;//启动轨迹服务失败(用户) | 19 | public static final int START_TRACE_GATHER_FAIL = 10;//启动轨迹服务失败(用户) |
| 20 | public static final int REGISTRATION_SUCCESS = 11;//用户报名成功 | 20 | public static final int REGISTRATION_SUCCESS = 11;//用户报名成功 |
| 21 | - | 21 | + public static final double PASS_RATE = 0.7;//通过率70% |
| 22 | + public static final int CHECK_ACCURACY = 50;//判断用户是否完成的精度范围 | ||
| 22 | } | 23 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/model/RunningFinishBean.java
| @@ -20,6 +20,15 @@ public class RunningFinishBean implements Serializable { | @@ -20,6 +20,15 @@ public class RunningFinishBean implements Serializable { | ||
| 20 | private String employTime; | 20 | private String employTime; |
| 21 | private String isFinish; | 21 | private String isFinish; |
| 22 | private String roadmap; | 22 | private String roadmap; |
| 23 | + private String streetTitle; | ||
| 24 | + | ||
| 25 | + public String getStreetTitle() { | ||
| 26 | + return streetTitle; | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + public void setStreetTitle(String streetTitle) { | ||
| 30 | + this.streetTitle = streetTitle; | ||
| 31 | + } | ||
| 23 | 32 | ||
| 24 | public String getRoadmap() { | 33 | public String getRoadmap() { |
| 25 | return roadmap; | 34 | return roadmap; |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/net/ApiServiceRunLin.java
| @@ -67,13 +67,6 @@ public interface ApiServiceRunLin { | @@ -67,13 +67,6 @@ public interface ApiServiceRunLin { | ||
| 67 | Observable<Result<BaseInfo<SelfRecordInfo>>> getSelfRecordInfo(@QueryMap() Map<String, String> maps); | 67 | Observable<Result<BaseInfo<SelfRecordInfo>>> getSelfRecordInfo(@QueryMap() Map<String, String> maps); |
| 68 | 68 | ||
| 69 | /** | 69 | /** |
| 70 | - * 保存个人约跑路线记录 | ||
| 71 | - */ | ||
| 72 | - @POST("Daren/event/routeRecord.action") | ||
| 73 | - Observable<Result<BaseInfo>> saveRouteData(@QueryMap() Map<String, String> maps); | ||
| 74 | - | ||
| 75 | - | ||
| 76 | - /** | ||
| 77 | * 踩点轨迹列表 | 70 | * 踩点轨迹列表 |
| 78 | */ | 71 | */ |
| 79 | @POST("Daren/event/getShoeLineList.action") | 72 | @POST("Daren/event/getShoeLineList.action") |
| @@ -91,5 +84,15 @@ public interface ApiServiceRunLin { | @@ -91,5 +84,15 @@ public interface ApiServiceRunLin { | ||
| 91 | @POST("Daren/event/bindingShoeLine.action") | 84 | @POST("Daren/event/bindingShoeLine.action") |
| 92 | Observable<Result<BaseInfo>> bindingShoeLineInfo(@QueryMap() Map<String, String> maps); | 85 | Observable<Result<BaseInfo>> bindingShoeLineInfo(@QueryMap() Map<String, String> maps); |
| 93 | 86 | ||
| 87 | + | ||
| 88 | + /** | ||
| 89 | + * 保存个人约跑路线记录 | ||
| 90 | + */ | ||
| 91 | + @POST("Daren/event/routeRecord.action") | ||
| 92 | + Observable<Result<BaseInfo>> saveRouteData(@QueryMap() Map<String, String> maps); | ||
| 93 | + | ||
| 94 | + | ||
| 95 | + | ||
| 96 | + | ||
| 94 | } | 97 | } |
| 95 | 98 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/net/bean/RunRaceDetailInfo.java
| 1 | package com.cnlive.moudle.pedometer.net.bean; | 1 | package com.cnlive.moudle.pedometer.net.bean; |
| 2 | 2 | ||
| 3 | +import java.io.Serializable; | ||
| 3 | import java.util.List; | 4 | import java.util.List; |
| 4 | 5 | ||
| 5 | /** | 6 | /** |
| @@ -7,7 +8,7 @@ import java.util.List; | @@ -7,7 +8,7 @@ import java.util.List; | ||
| 7 | * | 8 | * |
| 8 | * @author ShinnyYang | 9 | * @author ShinnyYang |
| 9 | */ | 10 | */ |
| 10 | -public class RunRaceDetailInfo { | 11 | +public class RunRaceDetailInfo implements Serializable { |
| 11 | 12 | ||
| 12 | 13 | ||
| 13 | /** | 14 | /** |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/service/StepService.java
| @@ -104,11 +104,11 @@ public class StepService extends Service implements SensorEventListener { | @@ -104,11 +104,11 @@ public class StepService extends Service implements SensorEventListener { | ||
| 104 | /** | 104 | /** |
| 105 | * 保存记步计时器 | 105 | * 保存记步计时器 |
| 106 | */ | 106 | */ |
| 107 | - private TimeCount time; | 107 | + private static TimeCount time; |
| 108 | /** | 108 | /** |
| 109 | * 当前所走的步数 | 109 | * 当前所走的步数 |
| 110 | */ | 110 | */ |
| 111 | - private int CURRENT_STEP; | 111 | + private int CURRENT_STEP = 0; |
| 112 | /** | 112 | /** |
| 113 | * 计步传感器类型 Sensor.TYPE_STEP_COUNTER或者Sensor.TYPE_STEP_DETECTOR | 113 | * 计步传感器类型 Sensor.TYPE_STEP_COUNTER或者Sensor.TYPE_STEP_DETECTOR |
| 114 | */ | 114 | */ |
| @@ -137,7 +137,7 @@ public class StepService extends Service implements SensorEventListener { | @@ -137,7 +137,7 @@ public class StepService extends Service implements SensorEventListener { | ||
| 137 | private Handler handler; | 137 | private Handler handler; |
| 138 | private Runnable speedRunnable; | 138 | private Runnable speedRunnable; |
| 139 | private final int NOTIFICATION_ID = 100; | 139 | private final int NOTIFICATION_ID = 100; |
| 140 | - private static int tempStep;//计步器临时保存步数 | 140 | + // private static int tempStep;//计步器临时保存步数 |
| 141 | private static boolean pauseFlag;//是否暂停 | 141 | private static boolean pauseFlag;//是否暂停 |
| 142 | private static int speedCurrentStep;//用于检测速度步数 | 142 | private static int speedCurrentStep;//用于检测速度步数 |
| 143 | private boolean updateSpeedStepFlag;//是否是已经更新速度 | 143 | private boolean updateSpeedStepFlag;//是否是已经更新速度 |
| @@ -255,15 +255,13 @@ public class StepService extends Service implements SensorEventListener { | @@ -255,15 +255,13 @@ public class StepService extends Service implements SensorEventListener { | ||
| 255 | if (userStepEntity == null) { | 255 | if (userStepEntity == null) { |
| 256 | StepUtil.setStepStartData(getApplicationContext(), userId, TimeUtil.getNowTimeStamp(), CommonInfo.getStreetId(getApplicationContext())); | 256 | StepUtil.setStepStartData(getApplicationContext(), userId, TimeUtil.getNowTimeStamp(), CommonInfo.getStreetId(getApplicationContext())); |
| 257 | //设置从服务器获取的时间(后续查询历史轨迹的时间,要从数据库中获取,因为涉及到现有运动恢复问题) | 257 | //设置从服务器获取的时间(后续查询历史轨迹的时间,要从数据库中获取,因为涉及到现有运动恢复问题) |
| 258 | - StepUtil.setQueryTraceTime(getApplicationContext(), userId, CommonInfo.getQueryTraceStartTime(getApplicationContext()), CommonInfo.getQueryTraceEndTime(getApplicationContext()), CommonInfo.getQueryQueryEntityName(getApplicationContext())); | ||
| 259 | int fenceId = CommonInfo.getFenceId(getApplicationContext()); | 258 | int fenceId = CommonInfo.getFenceId(getApplicationContext()); |
| 259 | + Log.e(TAG, "onStartTraceCallback: 保存的围栏id" + fenceId); | ||
| 260 | //设置围栏id | 260 | //设置围栏id |
| 261 | StepUtil.setFenceId(getApplicationContext(), CommonInfo.getUserId(getApplicationContext()), fenceId); | 261 | StepUtil.setFenceId(getApplicationContext(), CommonInfo.getUserId(getApplicationContext()), fenceId); |
| 262 | //清空临时保存的时间 | 262 | //清空临时保存的时间 |
| 263 | - CommonInfo.setQueryTraceEndTime(getApplicationContext(), 0); | ||
| 264 | - CommonInfo.setQueryTraceStartTime(getApplicationContext(), 0); | ||
| 265 | - CommonInfo.setQueryEntityName(getApplicationContext(), ""); | ||
| 266 | CommonInfo.setFenceId(getApplicationContext(), -1); | 263 | CommonInfo.setFenceId(getApplicationContext(), -1); |
| 264 | + | ||
| 267 | } | 265 | } |
| 268 | //开始设置围栏报警 | 266 | //开始设置围栏报警 |
| 269 | startQueryFence(); | 267 | startQueryFence(); |
| @@ -628,7 +626,15 @@ public class StepService extends Service implements SensorEventListener { | @@ -628,7 +626,15 @@ public class StepService extends Service implements SensorEventListener { | ||
| 628 | if (speedRunnable != null) { | 626 | if (speedRunnable != null) { |
| 629 | handler.removeCallbacks(speedRunnable); | 627 | handler.removeCallbacks(speedRunnable); |
| 630 | } | 628 | } |
| 631 | - Log.e("杀死", "MyTestService"); | 629 | +// Log.e("杀死", "MyTestService"); |
| 630 | + lastStep=0; | ||
| 631 | + hasStepCount = 0; | ||
| 632 | + hasRecord = false; | ||
| 633 | + CURRENT_STEP = 0; | ||
| 634 | + previousStepCount = 0; | ||
| 635 | + sensorManager = null; | ||
| 636 | + stepSensorType = -1; | ||
| 637 | + time=null; | ||
| 632 | } | 638 | } |
| 633 | 639 | ||
| 634 | //接收事件 | 640 | //接收事件 |
| @@ -699,6 +705,7 @@ public class StepService extends Service implements SensorEventListener { | @@ -699,6 +705,7 @@ public class StepService extends Service implements SensorEventListener { | ||
| 699 | CURRENT_STEP = Integer.parseInt(userStepEntity.getStepCount()); | 705 | CURRENT_STEP = Integer.parseInt(userStepEntity.getStepCount()); |
| 700 | } | 706 | } |
| 701 | } | 707 | } |
| 708 | + Log.e(TAG, "initTodayData: 初始化当前步数" + CURRENT_STEP); | ||
| 702 | if (mStepCount != null) { | 709 | if (mStepCount != null) { |
| 703 | mStepCount.setSteps(CURRENT_STEP); | 710 | mStepCount.setSteps(CURRENT_STEP); |
| 704 | } | 711 | } |
| @@ -706,6 +713,7 @@ public class StepService extends Service implements SensorEventListener { | @@ -706,6 +713,7 @@ public class StepService extends Service implements SensorEventListener { | ||
| 706 | } | 713 | } |
| 707 | 714 | ||
| 708 | private void updateNotification() { | 715 | private void updateNotification() { |
| 716 | + Log.e(TAG, "updateNotification: 当前步数:" + CURRENT_STEP); | ||
| 709 | EventBus.getDefault().post(new MessageEvent(Constant.SERVICE_STEP_COUNT_UPDATE, CURRENT_STEP)); | 717 | EventBus.getDefault().post(new MessageEvent(Constant.SERVICE_STEP_COUNT_UPDATE, CURRENT_STEP)); |
| 710 | updateSpeedStepFlag = false; | 718 | updateSpeedStepFlag = false; |
| 711 | // remoteViews = new RemoteViews(getPackageName(), R.layout.custom_step_notification); | 719 | // remoteViews = new RemoteViews(getPackageName(), R.layout.custom_step_notification); |
| @@ -1001,29 +1009,45 @@ public class StepService extends Service implements SensorEventListener { | @@ -1001,29 +1009,45 @@ public class StepService extends Service implements SensorEventListener { | ||
| 1001 | * | 1009 | * |
| 1002 | * @param event | 1010 | * @param event |
| 1003 | */ | 1011 | */ |
| 1012 | + private static int lastStep = 0;//有时候获取的是一样的 | ||
| 1013 | + | ||
| 1004 | @Override | 1014 | @Override |
| 1005 | public void onSensorChanged(SensorEvent event) { | 1015 | public void onSensorChanged(SensorEvent event) { |
| 1006 | //没有暂停 | 1016 | //没有暂停 |
| 1007 | if (stepSensorType == Sensor.TYPE_STEP_COUNTER) { | 1017 | if (stepSensorType == Sensor.TYPE_STEP_COUNTER) { |
| 1008 | //获取当前传感器返回的临时步数 | 1018 | //获取当前传感器返回的临时步数 |
| 1009 | - tempStep = (int) event.values[0]; | 1019 | + int tempStep = (int) event.values[0]; |
| 1020 | + Log.e(TAG, "onSensorChanged: 第一次,tempStep:" + tempStep + "lastStep:" + lastStep + ",previousStepCount" + previousStepCount + ",CURRENT_STEP" + CURRENT_STEP); | ||
| 1010 | //首次如果没有获取手机系统中已有的步数则获取一次系统中APP还未开始记步的步数 | 1021 | //首次如果没有获取手机系统中已有的步数则获取一次系统中APP还未开始记步的步数 |
| 1011 | if (!hasRecord) { | 1022 | if (!hasRecord) { |
| 1012 | hasRecord = true; | 1023 | hasRecord = true; |
| 1013 | hasStepCount = tempStep; | 1024 | hasStepCount = tempStep; |
| 1025 | + previousStepCount = 0; | ||
| 1014 | } else { | 1026 | } else { |
| 1015 | - //获取APP打开到现在的总步数=本次系统回调的总步数-APP打开之前已有的步数 | ||
| 1016 | - int thisStepCount = tempStep - hasStepCount; | ||
| 1017 | - //本次有效步数=(APP打开后所记录的总步数-上一次APP打开后所记录的总步数) | ||
| 1018 | - int thisStep = thisStepCount - previousStepCount; | ||
| 1019 | - //当用户点击暂停了 | ||
| 1020 | - if (pauseFlag) { | ||
| 1021 | - thisStep = 0; | 1027 | + if (tempStep > lastStep) { |
| 1028 | + //获取APP打开到现在的总步数=本次系统回调的总步数-APP打开之前已有的步数 | ||
| 1029 | + Log.e(TAG, "tempStep: " + tempStep + ",hasStepCount:" + hasStepCount); | ||
| 1030 | + int thisStepCount = tempStep - hasStepCount; | ||
| 1031 | + Log.e(TAG, "onSensorChanged: thisStepCount" + thisStepCount); | ||
| 1032 | + //本次有效步数=(APP打开后所记录的总步数-上一次APP打开后所记录的总步数) | ||
| 1033 | + int thisStep = thisStepCount - previousStepCount; | ||
| 1034 | + //记录最后一次APP打开到现在的总步数 | ||
| 1035 | + previousStepCount = thisStepCount; | ||
| 1036 | + Log.e(TAG, "本次有效步数: thisStep" + thisStep + ",previousStepCount:" + previousStepCount); | ||
| 1037 | + //当用户点击暂停了 | ||
| 1038 | + if (pauseFlag) { | ||
| 1039 | + thisStep = 0; | ||
| 1040 | + Log.e(TAG, "修改: thisStepCount" + thisStep); | ||
| 1041 | + } | ||
| 1042 | + Log.e(TAG, "onSensorChanged: CURRENT_STEP" + CURRENT_STEP); | ||
| 1043 | + if (CURRENT_STEP < 0) { | ||
| 1044 | + CURRENT_STEP = -CURRENT_STEP; | ||
| 1045 | + } | ||
| 1046 | + //总步数=现有的步数+本次有效步数 | ||
| 1047 | + CURRENT_STEP += (thisStep); | ||
| 1048 | + Log.e(TAG, "onSensorChanged: 加了以后" + CURRENT_STEP); | ||
| 1049 | + lastStep = tempStep; | ||
| 1022 | } | 1050 | } |
| 1023 | - //总步数=现有的步数+本次有效步数 | ||
| 1024 | - CURRENT_STEP += (thisStep); | ||
| 1025 | - //记录最后一次APP打开到现在的总步数 | ||
| 1026 | - previousStepCount = thisStepCount; | ||
| 1027 | } | 1051 | } |
| 1028 | } else if (stepSensorType == Sensor.TYPE_STEP_DETECTOR) { | 1052 | } else if (stepSensorType == Sensor.TYPE_STEP_DETECTOR) { |
| 1029 | if (event.values[0] == 1.0) { | 1053 | if (event.values[0] == 1.0) { |
| @@ -1049,10 +1073,10 @@ public class StepService extends Service implements SensorEventListener { | @@ -1049,10 +1073,10 @@ public class StepService extends Service implements SensorEventListener { | ||
| 1049 | * 保存记步数据 | 1073 | * 保存记步数据 |
| 1050 | */ | 1074 | */ |
| 1051 | private void save() { | 1075 | private void save() { |
| 1052 | - boolean isWriteUserStep = CommonInfo.getIsWriteUserStep(getApplicationContext()); | ||
| 1053 | - if (!isWriteUserStep) { | ||
| 1054 | - return; | ||
| 1055 | - } | 1076 | +// boolean isWriteUserStep = CommonInfo.getIsWriteUserStep(getApplicationContext()); |
| 1077 | +// if (!isWriteUserStep) { | ||
| 1078 | +// return; | ||
| 1079 | +// } | ||
| 1056 | int tempStep = CURRENT_STEP; | 1080 | int tempStep = CURRENT_STEP; |
| 1057 | UserStepEntity userStepEntity = StepUtil.getUserStepData(getApplicationContext(), CommonInfo.getUserId(getApplicationContext())); | 1081 | UserStepEntity userStepEntity = StepUtil.getUserStepData(getApplicationContext(), CommonInfo.getUserId(getApplicationContext())); |
| 1058 | if (userStepEntity == null) { | 1082 | if (userStepEntity == null) { |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/sql/dao/DaoMaster.java
| @@ -22,12 +22,14 @@ public class DaoMaster extends AbstractDaoMaster { | @@ -22,12 +22,14 @@ public class DaoMaster extends AbstractDaoMaster { | ||
| 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 | CollUserStepEntityDao.createTable(db, ifNotExists); | 24 | CollUserStepEntityDao.createTable(db, ifNotExists); |
| 25 | + FailedEntityDao.createTable(db, ifNotExists); | ||
| 25 | UserStepEntityDao.createTable(db, ifNotExists); | 26 | UserStepEntityDao.createTable(db, ifNotExists); |
| 26 | } | 27 | } |
| 27 | 28 | ||
| 28 | /** Drops underlying database table using DAOs. */ | 29 | /** Drops underlying database table using DAOs. */ |
| 29 | public static void dropAllTables(Database db, boolean ifExists) { | 30 | public static void dropAllTables(Database db, boolean ifExists) { |
| 30 | CollUserStepEntityDao.dropTable(db, ifExists); | 31 | CollUserStepEntityDao.dropTable(db, ifExists); |
| 32 | + FailedEntityDao.dropTable(db, ifExists); | ||
| 31 | UserStepEntityDao.dropTable(db, ifExists); | 33 | UserStepEntityDao.dropTable(db, ifExists); |
| 32 | } | 34 | } |
| 33 | 35 | ||
| @@ -48,6 +50,7 @@ public class DaoMaster extends AbstractDaoMaster { | @@ -48,6 +50,7 @@ public class DaoMaster extends AbstractDaoMaster { | ||
| 48 | public DaoMaster(Database db) { | 50 | public DaoMaster(Database db) { |
| 49 | super(db, SCHEMA_VERSION); | 51 | super(db, SCHEMA_VERSION); |
| 50 | registerDaoClass(CollUserStepEntityDao.class); | 52 | registerDaoClass(CollUserStepEntityDao.class); |
| 53 | + registerDaoClass(FailedEntityDao.class); | ||
| 51 | registerDaoClass(UserStepEntityDao.class); | 54 | registerDaoClass(UserStepEntityDao.class); |
| 52 | } | 55 | } |
| 53 | 56 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/sql/dao/DaoSession.java
| @@ -9,9 +9,11 @@ import org.greenrobot.greendao.identityscope.IdentityScopeType; | @@ -9,9 +9,11 @@ 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.CollUserStepEntity; | 11 | import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity; |
| 12 | +import com.cnlive.moudle.pedometer.sql.entity.FailedEntity; | ||
| 12 | import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; | 13 | import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; |
| 13 | 14 | ||
| 14 | import com.cnlive.moudle.pedometer.sql.dao.CollUserStepEntityDao; | 15 | import com.cnlive.moudle.pedometer.sql.dao.CollUserStepEntityDao; |
| 16 | +import com.cnlive.moudle.pedometer.sql.dao.FailedEntityDao; | ||
| 15 | import com.cnlive.moudle.pedometer.sql.dao.UserStepEntityDao; | 17 | import com.cnlive.moudle.pedometer.sql.dao.UserStepEntityDao; |
| 16 | 18 | ||
| 17 | // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. | 19 | // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. |
| @@ -24,9 +26,11 @@ import com.cnlive.moudle.pedometer.sql.dao.UserStepEntityDao; | @@ -24,9 +26,11 @@ import com.cnlive.moudle.pedometer.sql.dao.UserStepEntityDao; | ||
| 24 | public class DaoSession extends AbstractDaoSession { | 26 | public class DaoSession extends AbstractDaoSession { |
| 25 | 27 | ||
| 26 | private final DaoConfig collUserStepEntityDaoConfig; | 28 | private final DaoConfig collUserStepEntityDaoConfig; |
| 29 | + private final DaoConfig failedEntityDaoConfig; | ||
| 27 | private final DaoConfig userStepEntityDaoConfig; | 30 | private final DaoConfig userStepEntityDaoConfig; |
| 28 | 31 | ||
| 29 | private final CollUserStepEntityDao collUserStepEntityDao; | 32 | private final CollUserStepEntityDao collUserStepEntityDao; |
| 33 | + private final FailedEntityDao failedEntityDao; | ||
| 30 | private final UserStepEntityDao userStepEntityDao; | 34 | private final UserStepEntityDao userStepEntityDao; |
| 31 | 35 | ||
| 32 | public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig> | 36 | public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig> |
| @@ -36,18 +40,24 @@ public class DaoSession extends AbstractDaoSession { | @@ -36,18 +40,24 @@ public class DaoSession extends AbstractDaoSession { | ||
| 36 | collUserStepEntityDaoConfig = daoConfigMap.get(CollUserStepEntityDao.class).clone(); | 40 | collUserStepEntityDaoConfig = daoConfigMap.get(CollUserStepEntityDao.class).clone(); |
| 37 | collUserStepEntityDaoConfig.initIdentityScope(type); | 41 | collUserStepEntityDaoConfig.initIdentityScope(type); |
| 38 | 42 | ||
| 43 | + failedEntityDaoConfig = daoConfigMap.get(FailedEntityDao.class).clone(); | ||
| 44 | + failedEntityDaoConfig.initIdentityScope(type); | ||
| 45 | + | ||
| 39 | userStepEntityDaoConfig = daoConfigMap.get(UserStepEntityDao.class).clone(); | 46 | userStepEntityDaoConfig = daoConfigMap.get(UserStepEntityDao.class).clone(); |
| 40 | userStepEntityDaoConfig.initIdentityScope(type); | 47 | userStepEntityDaoConfig.initIdentityScope(type); |
| 41 | 48 | ||
| 42 | collUserStepEntityDao = new CollUserStepEntityDao(collUserStepEntityDaoConfig, this); | 49 | collUserStepEntityDao = new CollUserStepEntityDao(collUserStepEntityDaoConfig, this); |
| 50 | + failedEntityDao = new FailedEntityDao(failedEntityDaoConfig, this); | ||
| 43 | userStepEntityDao = new UserStepEntityDao(userStepEntityDaoConfig, this); | 51 | userStepEntityDao = new UserStepEntityDao(userStepEntityDaoConfig, this); |
| 44 | 52 | ||
| 45 | registerDao(CollUserStepEntity.class, collUserStepEntityDao); | 53 | registerDao(CollUserStepEntity.class, collUserStepEntityDao); |
| 54 | + registerDao(FailedEntity.class, failedEntityDao); | ||
| 46 | registerDao(UserStepEntity.class, userStepEntityDao); | 55 | registerDao(UserStepEntity.class, userStepEntityDao); |
| 47 | } | 56 | } |
| 48 | 57 | ||
| 49 | public void clear() { | 58 | public void clear() { |
| 50 | collUserStepEntityDaoConfig.clearIdentityScope(); | 59 | collUserStepEntityDaoConfig.clearIdentityScope(); |
| 60 | + failedEntityDaoConfig.clearIdentityScope(); | ||
| 51 | userStepEntityDaoConfig.clearIdentityScope(); | 61 | userStepEntityDaoConfig.clearIdentityScope(); |
| 52 | } | 62 | } |
| 53 | 63 | ||
| @@ -55,6 +65,10 @@ public class DaoSession extends AbstractDaoSession { | @@ -55,6 +65,10 @@ public class DaoSession extends AbstractDaoSession { | ||
| 55 | return collUserStepEntityDao; | 65 | return collUserStepEntityDao; |
| 56 | } | 66 | } |
| 57 | 67 | ||
| 68 | + public FailedEntityDao getFailedEntityDao() { | ||
| 69 | + return failedEntityDao; | ||
| 70 | + } | ||
| 71 | + | ||
| 58 | public UserStepEntityDao getUserStepEntityDao() { | 72 | public UserStepEntityDao getUserStepEntityDao() { |
| 59 | return userStepEntityDao; | 73 | return userStepEntityDao; |
| 60 | } | 74 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/sql/dao/UserStepEntityDao.java
| @@ -45,6 +45,7 @@ public class UserStepEntityDao extends AbstractDao<UserStepEntity, String> { | @@ -45,6 +45,7 @@ public class UserStepEntityDao extends AbstractDao<UserStepEntity, String> { | ||
| 45 | public final static Property ContinueTime = new Property(18, long.class, "continueTime", false, "CONTINUE_TIME"); | 45 | public final static Property ContinueTime = new Property(18, long.class, "continueTime", false, "CONTINUE_TIME"); |
| 46 | public final static Property FenceId = new Property(19, long.class, "fenceId", false, "FENCE_ID"); | 46 | public final static Property FenceId = new Property(19, long.class, "fenceId", false, "FENCE_ID"); |
| 47 | public final static Property ImportPoint = new Property(20, String.class, "importPoint", false, "IMPORT_POINT"); | 47 | public final static Property ImportPoint = new Property(20, String.class, "importPoint", false, "IMPORT_POINT"); |
| 48 | + public final static Property StreetTitle = new Property(21, String.class, "streetTitle", false, "STREET_TITLE"); | ||
| 48 | } | 49 | } |
| 49 | 50 | ||
| 50 | 51 | ||
| @@ -80,7 +81,8 @@ public class UserStepEntityDao extends AbstractDao<UserStepEntity, String> { | @@ -80,7 +81,8 @@ public class UserStepEntityDao extends AbstractDao<UserStepEntity, String> { | ||
| 80 | "\"QUERY_ENTITY_NAME\" TEXT," + // 17: queryEntityName | 81 | "\"QUERY_ENTITY_NAME\" TEXT," + // 17: queryEntityName |
| 81 | "\"CONTINUE_TIME\" INTEGER NOT NULL ," + // 18: continueTime | 82 | "\"CONTINUE_TIME\" INTEGER NOT NULL ," + // 18: continueTime |
| 82 | "\"FENCE_ID\" INTEGER NOT NULL ," + // 19: fenceId | 83 | "\"FENCE_ID\" INTEGER NOT NULL ," + // 19: fenceId |
| 83 | - "\"IMPORT_POINT\" TEXT);"); // 20: importPoint | 84 | + "\"IMPORT_POINT\" TEXT," + // 20: importPoint |
| 85 | + "\"STREET_TITLE\" TEXT);"); // 21: streetTitle | ||
| 84 | } | 86 | } |
| 85 | 87 | ||
| 86 | /** Drops the underlying database table. */ | 88 | /** Drops the underlying database table. */ |
| @@ -149,6 +151,11 @@ public class UserStepEntityDao extends AbstractDao<UserStepEntity, String> { | @@ -149,6 +151,11 @@ public class UserStepEntityDao extends AbstractDao<UserStepEntity, String> { | ||
| 149 | if (importPoint != null) { | 151 | if (importPoint != null) { |
| 150 | stmt.bindString(21, importPoint); | 152 | stmt.bindString(21, importPoint); |
| 151 | } | 153 | } |
| 154 | + | ||
| 155 | + String streetTitle = entity.getStreetTitle(); | ||
| 156 | + if (streetTitle != null) { | ||
| 157 | + stmt.bindString(22, streetTitle); | ||
| 158 | + } | ||
| 152 | } | 159 | } |
| 153 | 160 | ||
| 154 | @Override | 161 | @Override |
| @@ -211,6 +218,11 @@ public class UserStepEntityDao extends AbstractDao<UserStepEntity, String> { | @@ -211,6 +218,11 @@ public class UserStepEntityDao extends AbstractDao<UserStepEntity, String> { | ||
| 211 | if (importPoint != null) { | 218 | if (importPoint != null) { |
| 212 | stmt.bindString(21, importPoint); | 219 | stmt.bindString(21, importPoint); |
| 213 | } | 220 | } |
| 221 | + | ||
| 222 | + String streetTitle = entity.getStreetTitle(); | ||
| 223 | + if (streetTitle != null) { | ||
| 224 | + stmt.bindString(22, streetTitle); | ||
| 225 | + } | ||
| 214 | } | 226 | } |
| 215 | 227 | ||
| 216 | @Override | 228 | @Override |
| @@ -241,7 +253,8 @@ public class UserStepEntityDao extends AbstractDao<UserStepEntity, String> { | @@ -241,7 +253,8 @@ public class UserStepEntityDao extends AbstractDao<UserStepEntity, String> { | ||
| 241 | cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // queryEntityName | 253 | cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // queryEntityName |
| 242 | cursor.getLong(offset + 18), // continueTime | 254 | cursor.getLong(offset + 18), // continueTime |
| 243 | cursor.getLong(offset + 19), // fenceId | 255 | cursor.getLong(offset + 19), // fenceId |
| 244 | - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20) // importPoint | 256 | + cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // importPoint |
| 257 | + cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21) // streetTitle | ||
| 245 | ); | 258 | ); |
| 246 | return entity; | 259 | return entity; |
| 247 | } | 260 | } |
| @@ -269,6 +282,7 @@ public class UserStepEntityDao extends AbstractDao<UserStepEntity, String> { | @@ -269,6 +282,7 @@ public class UserStepEntityDao extends AbstractDao<UserStepEntity, String> { | ||
| 269 | entity.setContinueTime(cursor.getLong(offset + 18)); | 282 | entity.setContinueTime(cursor.getLong(offset + 18)); |
| 270 | entity.setFenceId(cursor.getLong(offset + 19)); | 283 | entity.setFenceId(cursor.getLong(offset + 19)); |
| 271 | entity.setImportPoint(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); | 284 | entity.setImportPoint(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); |
| 285 | + entity.setStreetTitle(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); | ||
| 272 | } | 286 | } |
| 273 | 287 | ||
| 274 | @Override | 288 | @Override |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/sql/entity/FailedEntity.java
| 1 | package com.cnlive.moudle.pedometer.sql.entity; | 1 | package com.cnlive.moudle.pedometer.sql.entity; |
| 2 | 2 | ||
| 3 | +import org.greenrobot.greendao.annotation.Entity; | ||
| 4 | +import org.greenrobot.greendao.annotation.Id; | ||
| 5 | +import org.greenrobot.greendao.annotation.Generated; | ||
| 6 | + | ||
| 7 | +import java.io.Serializable; | ||
| 8 | + | ||
| 3 | /** | 9 | /** |
| 4 | * 上传失败列表 | 10 | * 上传失败列表 |
| 5 | * | 11 | * |
| 6 | * @author ShinnyYang | 12 | * @author ShinnyYang |
| 7 | */ | 13 | */ |
| 8 | -public class FailedEntity { | 14 | +@Entity |
| 15 | +public class FailedEntity implements Serializable { | ||
| 16 | + static final long serialVersionUID = 01L; | ||
| 17 | + @Id | ||
| 9 | private String uuid;//主键 | 18 | private String uuid;//主键 |
| 10 | private String uid;//用户id | 19 | private String uid;//用户id |
| 11 | - private String streetTitle;//赛道标题 | ||
| 12 | private boolean isPause;//是否暂停 | 20 | private boolean isPause;//是否暂停 |
| 21 | + private long userPauseTime;//用户暂停时间 | ||
| 22 | + private long usrContinueTime;//用户继续时间 | ||
| 13 | private String isFinish;//是否完成 | 23 | private String isFinish;//是否完成 |
| 14 | private String time;//用时 | 24 | private String time;//用时 |
| 15 | private String speed;//配速 | 25 | private String speed;//配速 |
| 16 | private String step;//步数 | 26 | private String step;//步数 |
| 27 | + private String distance;//距离 | ||
| 17 | private String startPoint;//开始地点 | 28 | private String startPoint;//开始地点 |
| 18 | private String endPoint;//结束地点 | 29 | private String endPoint;//结束地点 |
| 19 | private long streetTraceStartTime;//赛道开始时间 | 30 | private long streetTraceStartTime;//赛道开始时间 |
| @@ -23,5 +34,210 @@ public class FailedEntity { | @@ -23,5 +34,210 @@ public class FailedEntity { | ||
| 23 | private long userEndTime;//用户结束时间 | 34 | private long userEndTime;//用户结束时间 |
| 24 | private String importPoint;//关键点 | 35 | private String importPoint;//关键点 |
| 25 | private String streetId;//赛事id | 36 | private String streetId;//赛事id |
| 37 | + private String streetTitle;//赛道标题 | ||
| 38 | + private long creatTimeStamp;//数据创建的时间 | ||
| 39 | + | ||
| 40 | + @Generated(hash = 458367844) | ||
| 41 | + public FailedEntity(String uuid, String uid, boolean isPause, long userPauseTime, long usrContinueTime, | ||
| 42 | + String isFinish, String time, String speed, String step, String distance, String startPoint, | ||
| 43 | + String endPoint, long streetTraceStartTime, long streetTraceEndTime, String entityName, | ||
| 44 | + long userStartTime, long userEndTime, String importPoint, String streetId, String streetTitle, | ||
| 45 | + long creatTimeStamp) { | ||
| 46 | + this.uuid = uuid; | ||
| 47 | + this.uid = uid; | ||
| 48 | + this.isPause = isPause; | ||
| 49 | + this.userPauseTime = userPauseTime; | ||
| 50 | + this.usrContinueTime = usrContinueTime; | ||
| 51 | + this.isFinish = isFinish; | ||
| 52 | + this.time = time; | ||
| 53 | + this.speed = speed; | ||
| 54 | + this.step = step; | ||
| 55 | + this.distance = distance; | ||
| 56 | + this.startPoint = startPoint; | ||
| 57 | + this.endPoint = endPoint; | ||
| 58 | + this.streetTraceStartTime = streetTraceStartTime; | ||
| 59 | + this.streetTraceEndTime = streetTraceEndTime; | ||
| 60 | + this.entityName = entityName; | ||
| 61 | + this.userStartTime = userStartTime; | ||
| 62 | + this.userEndTime = userEndTime; | ||
| 63 | + this.importPoint = importPoint; | ||
| 64 | + this.streetId = streetId; | ||
| 65 | + this.streetTitle = streetTitle; | ||
| 66 | + this.creatTimeStamp = creatTimeStamp; | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + @Generated(hash = 1639581354) | ||
| 70 | + public FailedEntity() { | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + public String getUuid() { | ||
| 74 | + return this.uuid; | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + public void setUuid(String uuid) { | ||
| 78 | + this.uuid = uuid; | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + public String getUid() { | ||
| 82 | + return this.uid; | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + public void setUid(String uid) { | ||
| 86 | + this.uid = uid; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + public boolean getIsPause() { | ||
| 90 | + return this.isPause; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + public void setIsPause(boolean isPause) { | ||
| 94 | + this.isPause = isPause; | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + public long getUserPauseTime() { | ||
| 98 | + return this.userPauseTime; | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + public void setUserPauseTime(long userPauseTime) { | ||
| 102 | + this.userPauseTime = userPauseTime; | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + public long getUsrContinueTime() { | ||
| 106 | + return this.usrContinueTime; | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + public void setUsrContinueTime(long usrContinueTime) { | ||
| 110 | + this.usrContinueTime = usrContinueTime; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + public String getIsFinish() { | ||
| 114 | + return this.isFinish; | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + public void setIsFinish(String isFinish) { | ||
| 118 | + this.isFinish = isFinish; | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + public String getTime() { | ||
| 122 | + return this.time; | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + public void setTime(String time) { | ||
| 126 | + this.time = time; | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + public String getSpeed() { | ||
| 130 | + return this.speed; | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + public void setSpeed(String speed) { | ||
| 134 | + this.speed = speed; | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + public String getStep() { | ||
| 138 | + return this.step; | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + public void setStep(String step) { | ||
| 142 | + this.step = step; | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + public String getStartPoint() { | ||
| 146 | + return this.startPoint; | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + public void setStartPoint(String startPoint) { | ||
| 150 | + this.startPoint = startPoint; | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + public String getEndPoint() { | ||
| 154 | + return this.endPoint; | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + public void setEndPoint(String endPoint) { | ||
| 158 | + this.endPoint = endPoint; | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | + public long getStreetTraceStartTime() { | ||
| 162 | + return this.streetTraceStartTime; | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | + public void setStreetTraceStartTime(long streetTraceStartTime) { | ||
| 166 | + this.streetTraceStartTime = streetTraceStartTime; | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + public long getStreetTraceEndTime() { | ||
| 170 | + return this.streetTraceEndTime; | ||
| 171 | + } | ||
| 172 | + | ||
| 173 | + public void setStreetTraceEndTime(long streetTraceEndTime) { | ||
| 174 | + this.streetTraceEndTime = streetTraceEndTime; | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + public String getEntityName() { | ||
| 178 | + return this.entityName; | ||
| 179 | + } | ||
| 180 | + | ||
| 181 | + public void setEntityName(String entityName) { | ||
| 182 | + this.entityName = entityName; | ||
| 183 | + } | ||
| 184 | + | ||
| 185 | + public long getUserStartTime() { | ||
| 186 | + return this.userStartTime; | ||
| 187 | + } | ||
| 188 | + | ||
| 189 | + public void setUserStartTime(long userStartTime) { | ||
| 190 | + this.userStartTime = userStartTime; | ||
| 191 | + } | ||
| 192 | + | ||
| 193 | + public long getUserEndTime() { | ||
| 194 | + return this.userEndTime; | ||
| 195 | + } | ||
| 196 | + | ||
| 197 | + public void setUserEndTime(long userEndTime) { | ||
| 198 | + this.userEndTime = userEndTime; | ||
| 199 | + } | ||
| 200 | + | ||
| 201 | + public String getImportPoint() { | ||
| 202 | + return this.importPoint; | ||
| 203 | + } | ||
| 204 | + | ||
| 205 | + public void setImportPoint(String importPoint) { | ||
| 206 | + this.importPoint = importPoint; | ||
| 207 | + } | ||
| 208 | + | ||
| 209 | + public String getStreetId() { | ||
| 210 | + return this.streetId; | ||
| 211 | + } | ||
| 212 | + | ||
| 213 | + public void setStreetId(String streetId) { | ||
| 214 | + this.streetId = streetId; | ||
| 215 | + } | ||
| 216 | + | ||
| 217 | + public String getStreetTitle() { | ||
| 218 | + return this.streetTitle; | ||
| 219 | + } | ||
| 220 | + | ||
| 221 | + public void setStreetTitle(String streetTitle) { | ||
| 222 | + this.streetTitle = streetTitle; | ||
| 223 | + } | ||
| 224 | + | ||
| 225 | + public long getCreatTimeStamp() { | ||
| 226 | + return this.creatTimeStamp; | ||
| 227 | + } | ||
| 228 | + | ||
| 229 | + public void setCreatTimeStamp(long creatTimeStamp) { | ||
| 230 | + this.creatTimeStamp = creatTimeStamp; | ||
| 231 | + } | ||
| 232 | + | ||
| 233 | + public String getDistance() { | ||
| 234 | + return this.distance; | ||
| 235 | + } | ||
| 236 | + | ||
| 237 | + public void setDistance(String distance) { | ||
| 238 | + this.distance = distance; | ||
| 239 | + } | ||
| 240 | + | ||
| 241 | + | ||
| 26 | 242 | ||
| 27 | } | 243 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/sql/entity/UserStepEntity.java
| @@ -28,12 +28,12 @@ public class UserStepEntity { | @@ -28,12 +28,12 @@ public class UserStepEntity { | ||
| 28 | private long continueTime;//继续运动时间 | 28 | private long continueTime;//继续运动时间 |
| 29 | private long fenceId;//围栏id | 29 | private long fenceId;//围栏id |
| 30 | private String importPoint;//关键点 | 30 | private String importPoint;//关键点 |
| 31 | + private String streetTitle;//赛事标题 | ||
| 31 | 32 | ||
| 32 | - | ||
| 33 | - @Generated(hash = 24427970) | ||
| 34 | - public UserStepEntity(String userId, String date, String stepCount, long pauseTimeStamp, long recordTime, double caloriesCount, String serverTraceData, | ||
| 35 | - String startPoint, String endPoint, long startTimeStamp, long finishTimeStamp, String streetId, int pauseCount, long userPauseTimeStamp, | ||
| 36 | - long chronometerBase, long queryTraceStartTime, long queryTraceEndTime, String queryEntityName, long continueTime, long fenceId, String importPoint) { | 33 | + @Generated(hash = 1762072682) |
| 34 | + public UserStepEntity(String userId, String date, String stepCount, long pauseTimeStamp, long recordTime, double caloriesCount, String serverTraceData, String startPoint, | ||
| 35 | + String endPoint, long startTimeStamp, long finishTimeStamp, String streetId, int pauseCount, long userPauseTimeStamp, long chronometerBase, long queryTraceStartTime, | ||
| 36 | + long queryTraceEndTime, String queryEntityName, long continueTime, long fenceId, String importPoint, String streetTitle) { | ||
| 37 | this.userId = userId; | 37 | this.userId = userId; |
| 38 | this.date = date; | 38 | this.date = date; |
| 39 | this.stepCount = stepCount; | 39 | this.stepCount = stepCount; |
| @@ -55,6 +55,7 @@ public class UserStepEntity { | @@ -55,6 +55,7 @@ public class UserStepEntity { | ||
| 55 | this.continueTime = continueTime; | 55 | this.continueTime = continueTime; |
| 56 | this.fenceId = fenceId; | 56 | this.fenceId = fenceId; |
| 57 | this.importPoint = importPoint; | 57 | this.importPoint = importPoint; |
| 58 | + this.streetTitle = streetTitle; | ||
| 58 | } | 59 | } |
| 59 | 60 | ||
| 60 | @Generated(hash = 273857141) | 61 | @Generated(hash = 273857141) |
| @@ -229,5 +230,13 @@ public class UserStepEntity { | @@ -229,5 +230,13 @@ public class UserStepEntity { | ||
| 229 | this.importPoint = importPoint; | 230 | this.importPoint = importPoint; |
| 230 | } | 231 | } |
| 231 | 232 | ||
| 233 | + public String getStreetTitle() { | ||
| 234 | + return this.streetTitle; | ||
| 235 | + } | ||
| 236 | + | ||
| 237 | + public void setStreetTitle(String streetTitle) { | ||
| 238 | + this.streetTitle = streetTitle; | ||
| 239 | + } | ||
| 240 | + | ||
| 232 | 241 | ||
| 233 | } | 242 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/PedometerMainActivity.java
| @@ -2,31 +2,20 @@ package com.cnlive.moudle.pedometer.ui.activity; | @@ -2,31 +2,20 @@ package com.cnlive.moudle.pedometer.ui.activity; | ||
| 2 | 2 | ||
| 3 | import android.Manifest; | 3 | import android.Manifest; |
| 4 | import android.app.Activity; | 4 | import android.app.Activity; |
| 5 | -import android.content.Context; | ||
| 6 | import android.content.Intent; | 5 | import android.content.Intent; |
| 7 | -import android.content.pm.PackageInfo; | ||
| 8 | -import android.content.pm.PackageManager; | ||
| 9 | -import android.location.LocationManager; | ||
| 10 | import android.os.Build; | 6 | import android.os.Build; |
| 11 | import android.provider.Settings; | 7 | import android.provider.Settings; |
| 12 | import android.os.Bundle; | 8 | import android.os.Bundle; |
| 13 | import android.support.annotation.NonNull; | 9 | import android.support.annotation.NonNull; |
| 14 | import android.support.v4.app.NotificationManagerCompat; | 10 | import android.support.v4.app.NotificationManagerCompat; |
| 15 | -import android.support.v4.content.ContextCompat; | ||
| 16 | import android.text.TextUtils; | 11 | import android.text.TextUtils; |
| 17 | import android.util.Log; | 12 | import android.util.Log; |
| 18 | -import android.view.KeyEvent; | ||
| 19 | import android.widget.Toast; | 13 | import android.widget.Toast; |
| 20 | 14 | ||
| 21 | import com.alibaba.android.arouter.facade.annotation.Route; | 15 | import com.alibaba.android.arouter.facade.annotation.Route; |
| 22 | -import com.baidu.mapapi.CoordType; | ||
| 23 | -import com.baidu.mapapi.SDKInitializer; | ||
| 24 | import com.baidu.mapapi.model.LatLng; | 16 | import com.baidu.mapapi.model.LatLng; |
| 25 | -import com.cnlive.libs.base.ui.QMUIFragment; | ||
| 26 | import com.cnlive.libs.base.ui.QMUIFragmentActivity; | 17 | import com.cnlive.libs.base.ui.QMUIFragmentActivity; |
| 27 | -import com.cnlive.libs.base.util.StatusBarUtil; | ||
| 28 | -import com.cnlive.libs.base.util.StatusBarUtil2; | ||
| 29 | -import com.cnlive.moudle.collectionTrace.ui.activity.CollPedometerMainActivity; | 18 | +import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; |
| 30 | import com.cnlive.moudle.pedometer.ui.fragment.RunMainFragment; | 19 | import com.cnlive.moudle.pedometer.ui.fragment.RunMainFragment; |
| 31 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; | 20 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; |
| 32 | import com.cnlive.moudle.pedometer.utils.lib_permisshelper.PermissionsListener; | 21 | import com.cnlive.moudle.pedometer.utils.lib_permisshelper.PermissionsListener; |
| @@ -47,13 +36,11 @@ import static android.provider.Settings.EXTRA_APP_PACKAGE; | @@ -47,13 +36,11 @@ import static android.provider.Settings.EXTRA_APP_PACKAGE; | ||
| 47 | public class PedometerMainActivity extends QMUIFragmentActivity { | 36 | public class PedometerMainActivity extends QMUIFragmentActivity { |
| 48 | private static final String TAG = "PedometerMainActivity"; | 37 | private static final String TAG = "PedometerMainActivity"; |
| 49 | 38 | ||
| 50 | - private NotificationManagerCompat notificationManagerCompat; | ||
| 51 | - private boolean isOpen; | 39 | + |
| 52 | private PermissionsUtils mPermissionsUtils = new PermissionsUtils();//权限申请 | 40 | private PermissionsUtils mPermissionsUtils = new PermissionsUtils();//权限申请 |
| 53 | private RunMainFragment fragment; | 41 | private RunMainFragment fragment; |
| 54 | - private String startPointAdd; | ||
| 55 | - private String endPointAdd; | ||
| 56 | private List<LatLng> importStreetPoints; | 42 | private List<LatLng> importStreetPoints; |
| 43 | + private RunRaceDetailInfo runRaceDetailInfo; | ||
| 57 | 44 | ||
| 58 | @Override | 45 | @Override |
| 59 | protected int getContextViewId() { | 46 | protected int getContextViewId() { |
| @@ -63,9 +50,7 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | @@ -63,9 +50,7 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | ||
| 63 | @Override | 50 | @Override |
| 64 | protected void onCreate(Bundle savedInstanceState) { | 51 | protected void onCreate(Bundle savedInstanceState) { |
| 65 | super.onCreate(savedInstanceState); | 52 | super.onCreate(savedInstanceState); |
| 66 | - startPointAdd = getIntent().getExtras().getString("startPointAdd"); | ||
| 67 | - endPointAdd = getIntent().getExtras().getString("endPointAdd"); | ||
| 68 | - importStreetPoints = (List<LatLng>) getIntent().getExtras().getSerializable("importStreetPoints"); | 53 | + runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().get("runRaceDetailInfo"); |
| 69 | } | 54 | } |
| 70 | 55 | ||
| 71 | 56 | ||
| @@ -74,51 +59,10 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | @@ -74,51 +59,10 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | ||
| 74 | super.onDestroy(); | 59 | super.onDestroy(); |
| 75 | } | 60 | } |
| 76 | 61 | ||
| 77 | - private void check() { | ||
| 78 | - | ||
| 79 | - //监测通知权限是否打开 | ||
| 80 | - notificationManagerCompat = NotificationManagerCompat.from(this); | ||
| 81 | - isOpen = notificationManagerCompat.areNotificationsEnabled(); | ||
| 82 | - if (isOpen) { | ||
| 83 | - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | ||
| 84 | -// ContextCompat.startForegroundService(CollPedometerMainActivity.this, new Intent(CollPedometerMainActivity.this, CollStepService.class)); | ||
| 85 | - } | ||
| 86 | - } else { | ||
| 87 | - goToSettingNo(); | ||
| 88 | - } | 62 | + private void checkIsOpenNotifiction() { |
| 63 | + getPermissionsWithTip(); | ||
| 89 | } | 64 | } |
| 90 | 65 | ||
| 91 | - private void goToSettingNo() { | ||
| 92 | - Intent intent1 = new Intent(); | ||
| 93 | - try { | ||
| 94 | - // 根据isOpened结果,判断是否需要提醒用户跳转AppInfo页面,去打开App通知权限 | ||
| 95 | - intent1.setAction(Settings.ACTION_APP_NOTIFICATION_SETTINGS); | ||
| 96 | - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | ||
| 97 | - //这种方案适用于 API 26, 即8.0(含8.0)以上可以用 | ||
| 98 | - intent1.putExtra(EXTRA_APP_PACKAGE, getPackageName()); | ||
| 99 | - intent1.putExtra(EXTRA_CHANNEL_ID, getApplicationInfo().uid); | ||
| 100 | - } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { | ||
| 101 | - //这种方案适用于 API21——25,即 5.0——7.1 之间的版本可以使用 | ||
| 102 | - intent1.putExtra("app_package", getPackageName()); | ||
| 103 | - intent1.putExtra("app_uid", getApplicationInfo().uid); | ||
| 104 | - } | ||
| 105 | - | ||
| 106 | - // 小米6 -MIUI9.6-8.0.0系统,是个特例,通知设置界面只能控制"允许使用通知圆点"——然而这个玩意并没有卵用,我想对雷布斯说:I'm not ok!!! | ||
| 107 | - // if ("MI 6".equals(Build.MODEL)) { | ||
| 108 | - // intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); | ||
| 109 | - // Uri uri = Uri.fromParts("package", getPackageName(), null); | ||
| 110 | - // intent.setData(uri); | ||
| 111 | - // // intent.setAction("com.android.settings/.SubSettings"); | ||
| 112 | - // } | ||
| 113 | - startActivity(intent1); | ||
| 114 | - } catch (Exception e) { | ||
| 115 | - //其他低版本或者异常情况,走该节点。进入APP设置界面 | ||
| 116 | - intent1.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); | ||
| 117 | - intent1.putExtra("package", getPackageName()); | ||
| 118 | - startActivity(intent1); | ||
| 119 | - } | ||
| 120 | - Toast.makeText(getApplicationContext(), "您尚未开启通知权限,无法进行计步", Toast.LENGTH_LONG).show(); | ||
| 121 | - } | ||
| 122 | 66 | ||
| 123 | @Override | 67 | @Override |
| 124 | protected void onRestart() { | 68 | protected void onRestart() { |
| @@ -129,12 +73,11 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | @@ -129,12 +73,11 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | ||
| 129 | @Override | 73 | @Override |
| 130 | protected void onResume() { | 74 | protected void onResume() { |
| 131 | super.onResume(); | 75 | super.onResume(); |
| 132 | - check(); | ||
| 133 | - getPermissionsWithTip(); | 76 | + checkIsOpenNotifiction(); |
| 134 | } | 77 | } |
| 135 | 78 | ||
| 136 | - private void addFragment(String startPointAdd, String endPointAdd, List<LatLng> importStreetPoints) { | ||
| 137 | - fragment = RunMainFragment.newInstance(startPointAdd, endPointAdd, importStreetPoints); | 79 | + private void addFragment(RunRaceDetailInfo runRaceDetailInfo) { |
| 80 | + fragment = RunMainFragment.newInstance(runRaceDetailInfo); | ||
| 138 | getSupportFragmentManager().beginTransaction() | 81 | getSupportFragmentManager().beginTransaction() |
| 139 | .add(getContextViewId(), fragment, fragment.getClass().getSimpleName()) | 82 | .add(getContextViewId(), fragment, fragment.getClass().getSimpleName()) |
| 140 | .addToBackStack(fragment.getClass().getSimpleName()) | 83 | .addToBackStack(fragment.getClass().getSimpleName()) |
| @@ -165,8 +108,8 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | @@ -165,8 +108,8 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | ||
| 165 | Toast.makeText(getApplicationContext(), getString(R.string.open_gps_tip), Toast.LENGTH_LONG).show(); | 108 | Toast.makeText(getApplicationContext(), getString(R.string.open_gps_tip), Toast.LENGTH_LONG).show(); |
| 166 | } else { | 109 | } else { |
| 167 | if (getCurrentFragment() == null) { | 110 | if (getCurrentFragment() == null) { |
| 168 | - if (!TextUtils.isEmpty(startPointAdd) && !TextUtils.isEmpty(endPointAdd) && importStreetPoints != null) { | ||
| 169 | - addFragment(startPointAdd, endPointAdd, importStreetPoints); | 111 | + if (runRaceDetailInfo != null) { |
| 112 | + addFragment(runRaceDetailInfo); | ||
| 170 | } | 113 | } |
| 171 | } | 114 | } |
| 172 | } | 115 | } |
| @@ -213,11 +156,9 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | @@ -213,11 +156,9 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | ||
| 213 | return; | 156 | return; |
| 214 | } | 157 | } |
| 215 | 158 | ||
| 216 | - public static void startActivity(Activity activity, String startPointAdd, String endPointAdd, List<LatLng> importStreetPoints) { | 159 | + public static void startActivity(Activity activity, RunRaceDetailInfo runRaceDetailInfo) { |
| 217 | Intent intent = new Intent(activity, PedometerMainActivity.class); | 160 | Intent intent = new Intent(activity, PedometerMainActivity.class); |
| 218 | - intent.putExtra("startPointAdd", startPointAdd); | ||
| 219 | - intent.putExtra("endPointAdd", endPointAdd); | ||
| 220 | - intent.putExtra("importStreetPoints", (Serializable) importStreetPoints); | 161 | + intent.putExtra("runRaceDetailInfo", (Serializable) runRaceDetailInfo); |
| 221 | activity.startActivity(intent); | 162 | activity.startActivity(intent); |
| 222 | } | 163 | } |
| 223 | } | 164 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/RunRaceDetailActivity.java
| @@ -30,6 +30,7 @@ import com.cnlive.moudle.pedometer.ui.fragment.RunRaceDetailFragment; | @@ -30,6 +30,7 @@ import com.cnlive.moudle.pedometer.ui.fragment.RunRaceDetailFragment; | ||
| 30 | import com.cnlive.moudle.pedometer.ui.fragment.RunningMapFragment; | 30 | import com.cnlive.moudle.pedometer.ui.fragment.RunningMapFragment; |
| 31 | import com.cnlive.moudle.pedometer.ui.widget.FivePersonIconView; | 31 | import com.cnlive.moudle.pedometer.ui.widget.FivePersonIconView; |
| 32 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; | 32 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; |
| 33 | +import com.cnlive.moudle.pedometer.utils.NotificationUtil; | ||
| 33 | import com.cnlive.moudle.pedometer.utils.StepUtil; | 34 | import com.cnlive.moudle.pedometer.utils.StepUtil; |
| 34 | import com.cnlive.moudle.pedometer.utils.lib_permisshelper.PermissionsListener; | 35 | import com.cnlive.moudle.pedometer.utils.lib_permisshelper.PermissionsListener; |
| 35 | import com.cnlive.moudle.pedometer.utils.lib_permisshelper.PermissionsUtils; | 36 | import com.cnlive.moudle.pedometer.utils.lib_permisshelper.PermissionsUtils; |
| @@ -47,6 +48,7 @@ import java.util.List; | @@ -47,6 +48,7 @@ import java.util.List; | ||
| 47 | public class RunRaceDetailActivity extends QMUIFragmentActivity { | 48 | public class RunRaceDetailActivity extends QMUIFragmentActivity { |
| 48 | private QMUIFragment fragment; | 49 | private QMUIFragment fragment; |
| 49 | private PermissionsUtils mPermissionsUtils = new PermissionsUtils();//权限申请 | 50 | private PermissionsUtils mPermissionsUtils = new PermissionsUtils();//权限申请 |
| 51 | + private String eventId;//赛道id | ||
| 50 | 52 | ||
| 51 | public static void startActivity(Activity activity, String eventId, String userId, String userIcon, String userName, String userPhone) { | 53 | public static void startActivity(Activity activity, String eventId, String userId, String userIcon, String userName, String userPhone) { |
| 52 | Intent intent = new Intent(activity, RunRaceDetailActivity.class); | 54 | Intent intent = new Intent(activity, RunRaceDetailActivity.class); |
| @@ -55,7 +57,6 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | @@ -55,7 +57,6 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | ||
| 55 | intent.putExtra("userIcon", userIcon); | 57 | intent.putExtra("userIcon", userIcon); |
| 56 | intent.putExtra("userName", userName); | 58 | intent.putExtra("userName", userName); |
| 57 | intent.putExtra("userPhone", userPhone); | 59 | intent.putExtra("userPhone", userPhone); |
| 58 | - CommonInfo.setStreetId(activity, eventId); | ||
| 59 | activity.startActivity(intent); | 60 | activity.startActivity(intent); |
| 60 | } | 61 | } |
| 61 | 62 | ||
| @@ -67,12 +68,15 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | @@ -67,12 +68,15 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | ||
| 67 | @Override | 68 | @Override |
| 68 | protected void onCreate(Bundle savedInstanceState) { | 69 | protected void onCreate(Bundle savedInstanceState) { |
| 69 | super.onCreate(savedInstanceState); | 70 | super.onCreate(savedInstanceState); |
| 70 | - | 71 | + if (getIntent().getStringExtra("eventId") != null) { |
| 72 | + eventId = getIntent().getStringExtra("eventId"); | ||
| 73 | + } | ||
| 71 | if (getIntent().getStringExtra("userId") != null) { | 74 | if (getIntent().getStringExtra("userId") != null) { |
| 72 | CommonInfo.setUserId(this, getIntent().getStringExtra("userId")); | 75 | CommonInfo.setUserId(this, getIntent().getStringExtra("userId")); |
| 73 | CommonInfo.setUserNickName(this, getIntent().getStringExtra("userName")); | 76 | CommonInfo.setUserNickName(this, getIntent().getStringExtra("userName")); |
| 74 | CommonInfo.setUserIcon(this, getIntent().getStringExtra("userIcon")); | 77 | CommonInfo.setUserIcon(this, getIntent().getStringExtra("userIcon")); |
| 75 | CommonInfo.setUserPhone(this, getIntent().getStringExtra("userPhone")); | 78 | CommonInfo.setUserPhone(this, getIntent().getStringExtra("userPhone")); |
| 79 | + | ||
| 76 | } | 80 | } |
| 77 | //判断用户是否结束运动 | 81 | //判断用户是否结束运动 |
| 78 | // boolean isRunStep = CommonInfo.getIsRunStepService(this); | 82 | // boolean isRunStep = CommonInfo.getIsRunStepService(this); |
| @@ -90,7 +94,23 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | @@ -90,7 +94,23 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | ||
| 90 | @Override | 94 | @Override |
| 91 | protected void onResume() { | 95 | protected void onResume() { |
| 92 | super.onResume(); | 96 | super.onResume(); |
| 93 | - getPermissionsWithTip(); | 97 | + if (eventId != null) { |
| 98 | + CommonInfo.setStreetId(this, eventId); | ||
| 99 | + Log.e("设置全局eventId", "onResume: " + eventId); | ||
| 100 | + } | ||
| 101 | + boolean isOpen = NotificationUtil.isOpenNotification(this); | ||
| 102 | + if (isOpen) { | ||
| 103 | + //判断GPS是否开启 | ||
| 104 | + if (!MyMapUtil.isOPenGps(getApplicationContext())) { | ||
| 105 | + Toast.makeText(getApplicationContext(), getString(R.string.open_gps_tip), Toast.LENGTH_LONG).show(); | ||
| 106 | + //开启GPS | ||
| 107 | + Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); | ||
| 108 | + startActivityForResult(intent, 10); | ||
| 109 | + } else { | ||
| 110 | + getPermissionsWithTip(); | ||
| 111 | + } | ||
| 112 | + } | ||
| 113 | + | ||
| 94 | } | 114 | } |
| 95 | 115 | ||
| 96 | private void addFragment(QMUIFragment fragment) { | 116 | private void addFragment(QMUIFragment fragment) { |
| @@ -123,17 +143,9 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | @@ -123,17 +143,9 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | ||
| 123 | 143 | ||
| 124 | @Override | 144 | @Override |
| 125 | public void onGranted() { | 145 | public void onGranted() { |
| 126 | - //判断GPS是否开启 | ||
| 127 | - if (!MyMapUtil.isOPenGps(getApplicationContext())) { | ||
| 128 | - //开启GPS | ||
| 129 | - Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); | ||
| 130 | - startActivityForResult(intent, 10); | ||
| 131 | - Toast.makeText(getApplicationContext(), getString(R.string.open_gps_tip), Toast.LENGTH_LONG).show(); | ||
| 132 | - } else { | ||
| 133 | - if (getCurrentFragment() == null) { | ||
| 134 | - if (fragment != null) { | ||
| 135 | - addFragment(fragment); | ||
| 136 | - } | 146 | + if (getCurrentFragment() == null) { |
| 147 | + if (fragment != null) { | ||
| 148 | + addFragment(fragment); | ||
| 137 | } | 149 | } |
| 138 | } | 150 | } |
| 139 | } | 151 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/UploadFailDetailActivity.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.sql.entity.FailedEntity; | ||
| 10 | +import com.cnlive.moudle.pedometer.ui.fragment.UploadFailDetailFragment; | ||
| 11 | +import com.example.moudle_pedometer.R; | ||
| 12 | + | ||
| 13 | +import java.io.Serializable; | ||
| 14 | + | ||
| 15 | +public class UploadFailDetailActivity extends QMUIFragmentActivity { | ||
| 16 | + @Override | ||
| 17 | + protected int getContextViewId() { | ||
| 18 | + return R.id.fragment_upload_fail; | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + @Override | ||
| 22 | + protected void onCreate(Bundle savedInstanceState) { | ||
| 23 | + super.onCreate(savedInstanceState); | ||
| 24 | + FailedEntity failedEntity = (FailedEntity) getIntent().getExtras().getSerializable("failedEntity"); | ||
| 25 | + if (failedEntity != null) { | ||
| 26 | + addFragment(UploadFailDetailFragment.newInstance(failedEntity)); | ||
| 27 | + } | ||
| 28 | + } | ||
| 29 | + private void addFragment(QMUIFragment fragment) { | ||
| 30 | + getSupportFragmentManager().beginTransaction() | ||
| 31 | + .add(getContextViewId(), fragment, fragment.getClass().getSimpleName()) | ||
| 32 | + .addToBackStack(fragment.getClass().getSimpleName()) | ||
| 33 | + .commit(); | ||
| 34 | + } | ||
| 35 | + public static void startActivity(Activity activity, FailedEntity failedEntity) { | ||
| 36 | + Intent intent = new Intent(activity, UploadFailDetailActivity.class); | ||
| 37 | + intent.putExtra("failedEntity", (Serializable) failedEntity); | ||
| 38 | + activity.startActivity(intent); | ||
| 39 | + } | ||
| 40 | +} |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/adapter/LineUpAgainAdapter.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.util.Log; | ||
| 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; |
| @@ -12,6 +13,8 @@ import android.widget.RelativeLayout; | @@ -12,6 +13,8 @@ import android.widget.RelativeLayout; | ||
| 12 | import android.widget.TextView; | 13 | import android.widget.TextView; |
| 13 | 14 | ||
| 14 | import com.cnlive.moudle.pedometer.net.bean.EventRouteRecordBeanVoListBean; | 15 | import com.cnlive.moudle.pedometer.net.bean.EventRouteRecordBeanVoListBean; |
| 16 | +import com.cnlive.moudle.pedometer.sql.entity.FailedEntity; | ||
| 17 | +import com.cnlive.moudle.pedometer.utils.StepUtil; | ||
| 15 | import com.cnlive.moudle.pedometer.utils.TimeUtil; | 18 | import com.cnlive.moudle.pedometer.utils.TimeUtil; |
| 16 | import com.example.moudle_pedometer.R; | 19 | import com.example.moudle_pedometer.R; |
| 17 | 20 | ||
| @@ -22,7 +25,7 @@ import java.util.List; | @@ -22,7 +25,7 @@ import java.util.List; | ||
| 22 | */ | 25 | */ |
| 23 | public class LineUpAgainAdapter extends RecyclerView.Adapter<LineUpAgainAdapter.MyHolder> { | 26 | public class LineUpAgainAdapter extends RecyclerView.Adapter<LineUpAgainAdapter.MyHolder> { |
| 24 | 27 | ||
| 25 | - private List<String> list; | 28 | + private List<FailedEntity> list; |
| 26 | private Context context; | 29 | private Context context; |
| 27 | private OnClickListener onClickListener; | 30 | private OnClickListener onClickListener; |
| 28 | 31 | ||
| @@ -30,7 +33,7 @@ public class LineUpAgainAdapter extends RecyclerView.Adapter<LineUpAgainAdapter. | @@ -30,7 +33,7 @@ public class LineUpAgainAdapter extends RecyclerView.Adapter<LineUpAgainAdapter. | ||
| 30 | this.onClickListener = onClickListener; | 33 | this.onClickListener = onClickListener; |
| 31 | } | 34 | } |
| 32 | 35 | ||
| 33 | - public LineUpAgainAdapter(List<String> list, Context context) { | 36 | + public LineUpAgainAdapter(List<FailedEntity> list, Context context) { |
| 34 | this.list = list; | 37 | this.list = list; |
| 35 | this.context = context; | 38 | this.context = context; |
| 36 | } | 39 | } |
| @@ -38,15 +41,32 @@ public class LineUpAgainAdapter extends RecyclerView.Adapter<LineUpAgainAdapter. | @@ -38,15 +41,32 @@ public class LineUpAgainAdapter extends RecyclerView.Adapter<LineUpAgainAdapter. | ||
| 38 | @NonNull | 41 | @NonNull |
| 39 | @Override | 42 | @Override |
| 40 | public MyHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { | 43 | public MyHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { |
| 41 | - View view = LayoutInflater.from(context).inflate(R.layout.line_up__item_view,viewGroup,false); | 44 | + View view = LayoutInflater.from(context).inflate(R.layout.line_up__item_view, viewGroup, false); |
| 42 | return new MyHolder(view); | 45 | return new MyHolder(view); |
| 43 | } | 46 | } |
| 44 | 47 | ||
| 45 | @Override | 48 | @Override |
| 46 | public void onBindViewHolder(@NonNull MyHolder myHolder, int i) { | 49 | public void onBindViewHolder(@NonNull MyHolder myHolder, int i) { |
| 47 | 50 | ||
| 48 | -// myHolder.again_up.setOnClickListener(v -> ); | ||
| 49 | - if(onClickListener != null) myHolder.ry_re.setOnClickListener(v -> onClickListener.onClickListener(list.get(i),i)); | 51 | + if (onClickListener != null) { |
| 52 | + myHolder.ry_re.setOnClickListener(v -> onClickListener.onClickListener(list.get(i), i)); | ||
| 53 | + } | ||
| 54 | + //设置视图数据 | ||
| 55 | + if (myHolder != null) { | ||
| 56 | + //设置数据创建时间 | ||
| 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")); | ||
| 59 | + //设置赛道标题 | ||
| 60 | + myHolder.up_item_title.setText(list.get(i).getStreetTitle()); | ||
| 61 | + //设置公里 | ||
| 62 | + myHolder.up_kilometer_num.setText(list.get(i).getDistance()); | ||
| 63 | + //设置运动时间 | ||
| 64 | + myHolder.up_record_minit.setText(TimeUtil.stampToChronometer(Long.parseLong(list.get(i).getTime()))); | ||
| 65 | + //设置配速 | ||
| 66 | + myHolder.up_record_speed.setText(list.get(i).getSpeed()); | ||
| 67 | + //设置步数 | ||
| 68 | + myHolder.up_record_step.setText(list.get(i).getStep()); | ||
| 69 | + } | ||
| 50 | 70 | ||
| 51 | } | 71 | } |
| 52 | 72 | ||
| @@ -55,7 +75,7 @@ public class LineUpAgainAdapter extends RecyclerView.Adapter<LineUpAgainAdapter. | @@ -55,7 +75,7 @@ public class LineUpAgainAdapter extends RecyclerView.Adapter<LineUpAgainAdapter. | ||
| 55 | return list.size(); | 75 | return list.size(); |
| 56 | } | 76 | } |
| 57 | 77 | ||
| 58 | - class MyHolder extends RecyclerView.ViewHolder{ | 78 | + class MyHolder extends RecyclerView.ViewHolder { |
| 59 | 79 | ||
| 60 | TextView up_day; | 80 | TextView up_day; |
| 61 | TextView up_record_time; | 81 | TextView up_record_time; |
| @@ -84,7 +104,7 @@ public class LineUpAgainAdapter extends RecyclerView.Adapter<LineUpAgainAdapter. | @@ -84,7 +104,7 @@ public class LineUpAgainAdapter extends RecyclerView.Adapter<LineUpAgainAdapter. | ||
| 84 | } | 104 | } |
| 85 | 105 | ||
| 86 | 106 | ||
| 87 | - public interface OnClickListener{ | ||
| 88 | - void onClickListener(String bean, int position); | 107 | + public interface OnClickListener { |
| 108 | + void onClickListener(FailedEntity bean, int position); | ||
| 89 | } | 109 | } |
| 90 | } | 110 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/LineUpAgainFragment.java
| @@ -7,15 +7,20 @@ import android.support.annotation.Nullable; | @@ -7,15 +7,20 @@ import android.support.annotation.Nullable; | ||
| 7 | import android.view.View; | 7 | import android.view.View; |
| 8 | 8 | ||
| 9 | import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; | 9 | import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; |
| 10 | +import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | ||
| 10 | import com.cnlive.moudle.pedometer.frame.presenter.LineUpAgainPresenter; | 11 | import com.cnlive.moudle.pedometer.frame.presenter.LineUpAgainPresenter; |
| 11 | import com.cnlive.moudle.pedometer.frame.view.LineUpAgainView; | 12 | import com.cnlive.moudle.pedometer.frame.view.LineUpAgainView; |
| 13 | +import com.cnlive.moudle.pedometer.sql.entity.FailedEntity; | ||
| 14 | +import com.cnlive.moudle.pedometer.utils.StepUtil; | ||
| 12 | import com.example.moudle_pedometer.R; | 15 | import com.example.moudle_pedometer.R; |
| 13 | import com.example.moudle_pedometer.databinding.FragmentLineUpAgainBinding; | 16 | import com.example.moudle_pedometer.databinding.FragmentLineUpAgainBinding; |
| 14 | 17 | ||
| 18 | +import java.util.List; | ||
| 19 | + | ||
| 15 | /** | 20 | /** |
| 16 | * Created by hanyayun 019/06/20. | 21 | * Created by hanyayun 019/06/20. |
| 17 | */ | 22 | */ |
| 18 | -public class LineUpAgainFragment extends MvpBindingFragment<LineUpAgainView, LineUpAgainPresenter,Object,FragmentLineUpAgainBinding> { | 23 | +public class LineUpAgainFragment extends MvpBindingFragment<LineUpAgainView, LineUpAgainPresenter, Object, FragmentLineUpAgainBinding> { |
| 19 | 24 | ||
| 20 | 25 | ||
| 21 | public LineUpAgainFragment() { | 26 | public LineUpAgainFragment() { |
| @@ -31,8 +36,16 @@ public class LineUpAgainFragment extends MvpBindingFragment<LineUpAgainView, Lin | @@ -31,8 +36,16 @@ public class LineUpAgainFragment extends MvpBindingFragment<LineUpAgainView, Lin | ||
| 31 | @Override | 36 | @Override |
| 32 | public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | 37 | public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { |
| 33 | super.onViewCreated(view, savedInstanceState); | 38 | super.onViewCreated(view, savedInstanceState); |
| 34 | - if(getMvpView() != null) getMvpView().initView(); | ||
| 35 | - getPresenter().getData(); | 39 | + List<FailedEntity> failedEntities = StepUtil.getFailListData(getActivity(), CommonInfo.getUserId(getActivity())); |
| 40 | + | ||
| 41 | + if (getMvpView() != null) { | ||
| 42 | + getMvpView().initView(); | ||
| 43 | + if (failedEntities == null||failedEntities.size()<1) { | ||
| 44 | + binding.llNoFailTip.setVisibility(View.VISIBLE); | ||
| 45 | + } else { | ||
| 46 | + getMvpView().setData(failedEntities); | ||
| 47 | + } | ||
| 48 | + } | ||
| 36 | binding.refreshLayout.setEnableLoadMore(false); | 49 | binding.refreshLayout.setEnableLoadMore(false); |
| 37 | binding.refreshLayout.setEnableRefresh(false); | 50 | binding.refreshLayout.setEnableRefresh(false); |
| 38 | } | 51 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RunMainFragment.java
| @@ -16,6 +16,7 @@ import com.cnlive.moudle.pedometer.frame.presenter.RunMainFragmentPresenter; | @@ -16,6 +16,7 @@ import com.cnlive.moudle.pedometer.frame.presenter.RunMainFragmentPresenter; | ||
| 16 | import com.cnlive.moudle.pedometer.frame.view.RunMainFragmentView; | 16 | import com.cnlive.moudle.pedometer.frame.view.RunMainFragmentView; |
| 17 | import com.cnlive.moudle.pedometer.model.Constant; | 17 | import com.cnlive.moudle.pedometer.model.Constant; |
| 18 | import com.cnlive.moudle.pedometer.model.MessageEvent; | 18 | import com.cnlive.moudle.pedometer.model.MessageEvent; |
| 19 | +import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; | ||
| 19 | import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; | 20 | import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; |
| 20 | import com.cnlive.moudle.pedometer.utils.GsonUtil; | 21 | import com.cnlive.moudle.pedometer.utils.GsonUtil; |
| 21 | import com.cnlive.moudle.pedometer.utils.StepUtil; | 22 | import com.cnlive.moudle.pedometer.utils.StepUtil; |
| @@ -31,17 +32,12 @@ import java.io.Serializable; | @@ -31,17 +32,12 @@ import java.io.Serializable; | ||
| 31 | import java.util.List; | 32 | import java.util.List; |
| 32 | 33 | ||
| 33 | public class RunMainFragment extends QMUIFragment<RunMainFragmentView, RunMainFragmentPresenter, FragmentRunMainBinding> { | 34 | public class RunMainFragment extends QMUIFragment<RunMainFragmentView, RunMainFragmentPresenter, FragmentRunMainBinding> { |
| 34 | - private final String TAG = "CollRunMainFragment"; | ||
| 35 | - private String userId = "yangshuai"; | ||
| 36 | - private String startPointAdd; | ||
| 37 | - private String endPointAdd; | ||
| 38 | - private List<LatLng> importStreetPoints; | 35 | + private final String TAG = "RunMainFragment"; |
| 36 | + private RunRaceDetailInfo runRaceDetailInfo; | ||
| 39 | 37 | ||
| 40 | - public static RunMainFragment newInstance(String startPointAdd, String endPointAdd, List<LatLng> importStreetPoints) { | 38 | + public static RunMainFragment newInstance(RunRaceDetailInfo runRaceDetailInfo) { |
| 41 | Bundle bundle = new Bundle(); | 39 | Bundle bundle = new Bundle(); |
| 42 | - bundle.putString("startPointAdd", startPointAdd); | ||
| 43 | - bundle.putString("endPointAdd", endPointAdd); | ||
| 44 | - bundle.putSerializable("importStreetPoints", (Serializable) importStreetPoints); | 40 | + bundle.putSerializable("runRaceDetailInfo", (Serializable) runRaceDetailInfo); |
| 45 | RunMainFragment fragment = new RunMainFragment(); | 41 | RunMainFragment fragment = new RunMainFragment(); |
| 46 | fragment.setArguments(bundle); | 42 | fragment.setArguments(bundle); |
| 47 | return fragment; | 43 | return fragment; |
| @@ -54,30 +50,31 @@ public class RunMainFragment extends QMUIFragment<RunMainFragmentView, RunMainFr | @@ -54,30 +50,31 @@ public class RunMainFragment extends QMUIFragment<RunMainFragmentView, RunMainFr | ||
| 54 | StatusBarUtil2.setColor(getActivity(), getResources().getColor(R.color.run_main_bg), 0); | 50 | StatusBarUtil2.setColor(getActivity(), getResources().getColor(R.color.run_main_bg), 0); |
| 55 | EventBus.getDefault().register(this); | 51 | EventBus.getDefault().register(this); |
| 56 | if (getArguments() != null) { | 52 | if (getArguments() != null) { |
| 57 | - startPointAdd = getArguments().getString("startPointAdd"); | ||
| 58 | - endPointAdd = getArguments().getString("endPointAdd"); | ||
| 59 | - importStreetPoints = (List<LatLng>) getArguments().getSerializable("importStreetPoints"); | 53 | + runRaceDetailInfo = (RunRaceDetailInfo) getArguments().getSerializable("runRaceDetailInfo"); |
| 60 | UserStepEntity userStepEntity = StepUtil.getUserStepData(getActivity(), CommonInfo.getUserId(getActivity())); | 54 | UserStepEntity userStepEntity = StepUtil.getUserStepData(getActivity(), CommonInfo.getUserId(getActivity())); |
| 61 | if (userStepEntity != null) { | 55 | if (userStepEntity != null) { |
| 62 | - if (!TextUtils.isEmpty(startPointAdd) && !TextUtils.isEmpty(endPointAdd)) { | ||
| 63 | - userStepEntity.setStartPoint(startPointAdd); | ||
| 64 | - userStepEntity.setEndPoint(endPointAdd); | 56 | + if (runRaceDetailInfo != null) { |
| 57 | + userStepEntity.setStartPoint(runRaceDetailInfo.getStartLocation()); | ||
| 58 | + userStepEntity.setEndPoint(runRaceDetailInfo.getEndLocation()); | ||
| 65 | //更新数据 | 59 | //更新数据 |
| 66 | StepUtil.updateStepData(getActivity(), userStepEntity); | 60 | StepUtil.updateStepData(getActivity(), userStepEntity); |
| 61 | + //获取数据库中的重要点 | ||
| 62 | + String importStr = userStepEntity.getImportPoint(); | ||
| 63 | + if (TextUtils.isEmpty(runRaceDetailInfo.getLatLongitude())) { | ||
| 64 | + //设置重要点 | ||
| 65 | + StepUtil.setImportPoints(getActivity(), CommonInfo.getUserId(getActivity()), GsonUtil.GsonString(runRaceDetailInfo.getLatLongitude())); | ||
| 66 | + } | ||
| 67 | } | 67 | } |
| 68 | - //获取数据库中的重要点 | ||
| 69 | - String importStr = userStepEntity.getImportPoint(); | ||
| 70 | - if (TextUtils.isEmpty(importStr) && importStreetPoints != null) { | ||
| 71 | - //设置重要点 | ||
| 72 | - StepUtil.setImportPoints(getActivity(), CommonInfo.getUserId(getActivity()), GsonUtil.GsonString(importStreetPoints)); | ||
| 73 | - } | 68 | + |
| 74 | } | 69 | } |
| 75 | } | 70 | } |
| 76 | if (getMvpView() != null) { | 71 | if (getMvpView() != null) { |
| 77 | new Handler().postDelayed(new Runnable() { | 72 | new Handler().postDelayed(new Runnable() { |
| 78 | @Override | 73 | @Override |
| 79 | public void run() { | 74 | public void run() { |
| 80 | - getMvpView().initView(); | 75 | + if (runRaceDetailInfo != null) { |
| 76 | + getMvpView().initView(runRaceDetailInfo); | ||
| 77 | + } | ||
| 81 | } | 78 | } |
| 82 | }, 5); | 79 | }, 5); |
| 83 | } | 80 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RunRaceDetailFragment.java
| @@ -64,6 +64,7 @@ public class RunRaceDetailFragment extends QMUIFragment<RunRaceDetailFragmentVie | @@ -64,6 +64,7 @@ public class RunRaceDetailFragment extends QMUIFragment<RunRaceDetailFragmentVie | ||
| 64 | if (getMvpView() != null) { | 64 | if (getMvpView() != null) { |
| 65 | getMvpView().initMap(); | 65 | getMvpView().initMap(); |
| 66 | } | 66 | } |
| 67 | + | ||
| 67 | if (getPresenter() != null) { | 68 | if (getPresenter() != null) { |
| 68 | if (!TextUtils.isEmpty(CommonInfo.getStreetId(getActivity()))) { | 69 | if (!TextUtils.isEmpty(CommonInfo.getStreetId(getActivity()))) { |
| 69 | getPresenter().getRunRaceDetailInfo(getActivity(), CommonInfo.getStreetId(getActivity()), CommonInfo.getUserId(getActivity()), "0"); | 70 | getPresenter().getRunRaceDetailInfo(getActivity(), CommonInfo.getStreetId(getActivity()), CommonInfo.getUserId(getActivity()), "0"); |
| @@ -179,7 +180,7 @@ public class RunRaceDetailFragment extends QMUIFragment<RunRaceDetailFragmentVie | @@ -179,7 +180,7 @@ public class RunRaceDetailFragment extends QMUIFragment<RunRaceDetailFragmentVie | ||
| 179 | if (getMvpView() != null) { | 180 | if (getMvpView() != null) { |
| 180 | Log.e(TAG, "跳转: " + getMvpView().importStreetPoints.size()); | 181 | Log.e(TAG, "跳转: " + getMvpView().importStreetPoints.size()); |
| 181 | QMUITipDialogUtil.dismessDialog(); | 182 | QMUITipDialogUtil.dismessDialog(); |
| 182 | - PedometerMainActivity.startActivity(getActivity(), binding.includeStreet.tvStartAddr.getText().toString(), binding.includeStreet.tvEndAddr.getText().toString(), getMvpView().importStreetPoints); | 183 | + PedometerMainActivity.startActivity(getActivity(), getMvpView().runRaceDetailInfo); |
| 183 | } | 184 | } |
| 184 | } | 185 | } |
| 185 | //启动鹰眼失败 | 186 | //启动鹰眼失败 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RunningFinishFragment.java
| @@ -3,6 +3,7 @@ package com.cnlive.moudle.pedometer.ui.fragment; | @@ -3,6 +3,7 @@ package com.cnlive.moudle.pedometer.ui.fragment; | ||
| 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.Nullable; | 5 | import android.support.annotation.Nullable; |
| 6 | +import android.util.Log; | ||
| 6 | import android.view.View; | 7 | import android.view.View; |
| 7 | 8 | ||
| 8 | import com.cnlive.libs.base.ui.QMUIFragment; | 9 | import com.cnlive.libs.base.ui.QMUIFragment; |
| @@ -55,20 +56,13 @@ public class RunningFinishFragment extends QMUIFragment<RunningFinishFragmentVie | @@ -55,20 +56,13 @@ public class RunningFinishFragment extends QMUIFragment<RunningFinishFragmentVie | ||
| 55 | getMvpView().initView(runningFinishBean); | 56 | getMvpView().initView(runningFinishBean); |
| 56 | } | 57 | } |
| 57 | } | 58 | } |
| 59 | + UserStepEntity userStepEntity = StepUtil.getUserStepData(getActivity(), CommonInfo.getUserId(getActivity())); | ||
| 60 | + if (getMvpView() != null && userStepEntity != null) { | ||
| 61 | +// getPresenter().getServerStreetTrace(getActivity(), userStepEntity); | ||
| 62 | + getPresenter().queryHistoryTrace(getActivity(), userStepEntity, runningFinishBean); | ||
| 63 | + } | ||
| 58 | } | 64 | } |
| 59 | - UserStepEntity userStepEntity = StepUtil.getUserStepData(getActivity(), CommonInfo.getUserId(getActivity())); | ||
| 60 | - if (getMvpView() != null && userStepEntity != null) { | ||
| 61 | - QMUITipDialogUtil.loadingDialog(getContext(), "正在获取轨迹信息,请稍后", false); | ||
| 62 | - getPresenter().getServerStreetTrace(getActivity(), userStepEntity); | ||
| 63 | - new Handler().postDelayed(new Runnable() { | ||
| 64 | - @Override | ||
| 65 | - public void run() { | ||
| 66 | - getPresenter().queryHistoryTrace(getActivity(), userStepEntity, runningFinishBean); | ||
| 67 | - } | ||
| 68 | - },2000); | ||
| 69 | -// StepUtil.clearRunData(context, CommonInfo.getUserId(context)); | ||
| 70 | -// CommonInfo.reset(context); | ||
| 71 | - } | 65 | + |
| 72 | 66 | ||
| 73 | } | 67 | } |
| 74 | 68 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/SelfRecordFragment.java
| 1 | package com.cnlive.moudle.pedometer.ui.fragment; | 1 | package com.cnlive.moudle.pedometer.ui.fragment; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | +import android.content.Context; | ||
| 4 | import android.os.Bundle; | 5 | import android.os.Bundle; |
| 5 | import android.support.annotation.NonNull; | 6 | import android.support.annotation.NonNull; |
| 6 | import android.support.annotation.Nullable; | 7 | import android.support.annotation.Nullable; |
| @@ -10,21 +11,29 @@ import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; | @@ -10,21 +11,29 @@ import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; | ||
| 10 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | 11 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 11 | import com.cnlive.moudle.pedometer.frame.presenter.SelfRecordPresenter; | 12 | import com.cnlive.moudle.pedometer.frame.presenter.SelfRecordPresenter; |
| 12 | import com.cnlive.moudle.pedometer.frame.view.SelfRecordView; | 13 | import com.cnlive.moudle.pedometer.frame.view.SelfRecordView; |
| 14 | +import com.cnlive.moudle.pedometer.sql.entity.FailedEntity; | ||
| 15 | +import com.cnlive.moudle.pedometer.utils.StepUtil; | ||
| 13 | import com.example.moudle_pedometer.R; | 16 | import com.example.moudle_pedometer.R; |
| 14 | import com.example.moudle_pedometer.databinding.FragmentSelfRecordBinding; | 17 | import com.example.moudle_pedometer.databinding.FragmentSelfRecordBinding; |
| 15 | import com.scwang.smartrefresh.layout.api.RefreshLayout; | 18 | import com.scwang.smartrefresh.layout.api.RefreshLayout; |
| 16 | import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener; | 19 | import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener; |
| 17 | import com.scwang.smartrefresh.layout.listener.OnRefreshListener; | 20 | import com.scwang.smartrefresh.layout.listener.OnRefreshListener; |
| 18 | 21 | ||
| 22 | +import java.util.List; | ||
| 23 | + | ||
| 24 | +import q.rorbin.badgeview.QBadgeView; | ||
| 25 | + | ||
| 19 | /** | 26 | /** |
| 20 | * Created by hanyayun 019/06/12. | 27 | * Created by hanyayun 019/06/12. |
| 21 | */ | 28 | */ |
| 22 | -public class SelfRecordFragment extends MvpBindingFragment<SelfRecordView, SelfRecordPresenter,Object, FragmentSelfRecordBinding> { | 29 | +public class SelfRecordFragment extends MvpBindingFragment<SelfRecordView, SelfRecordPresenter, Object, FragmentSelfRecordBinding> { |
| 23 | 30 | ||
| 24 | 31 | ||
| 25 | public int currentPage = 1; | 32 | public int currentPage = 1; |
| 26 | public int pageSize = 10; | 33 | public int pageSize = 10; |
| 27 | public int completeStatus = 0; | 34 | public int completeStatus = 0; |
| 35 | + private QBadgeView qBadgeView; | ||
| 36 | + | ||
| 28 | public SelfRecordFragment() { | 37 | public SelfRecordFragment() { |
| 29 | // Required empty public constructor | 38 | // Required empty public constructor |
| 30 | } | 39 | } |
| @@ -33,7 +42,7 @@ public class SelfRecordFragment extends MvpBindingFragment<SelfRecordView, SelfR | @@ -33,7 +42,7 @@ public class SelfRecordFragment extends MvpBindingFragment<SelfRecordView, SelfR | ||
| 33 | @Override | 42 | @Override |
| 34 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | 43 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 35 | super.onViewCreated(view, savedInstanceState); | 44 | super.onViewCreated(view, savedInstanceState); |
| 36 | - if(getMvpView() != null) getMvpView().initView(); | 45 | + if (getMvpView() != null) getMvpView().initView(); |
| 37 | getData(-1); | 46 | getData(-1); |
| 38 | 47 | ||
| 39 | binding.hasFinish.setOnClickListener(v -> getData(0)); | 48 | binding.hasFinish.setOnClickListener(v -> getData(0)); |
| @@ -52,20 +61,22 @@ public class SelfRecordFragment extends MvpBindingFragment<SelfRecordView, SelfR | @@ -52,20 +61,22 @@ public class SelfRecordFragment extends MvpBindingFragment<SelfRecordView, SelfR | ||
| 52 | getData(-1); | 61 | getData(-1); |
| 53 | } | 62 | } |
| 54 | }); | 63 | }); |
| 64 | + | ||
| 65 | +// getMvpView().onCheckFailDataCount(getActivity()); | ||
| 55 | } | 66 | } |
| 56 | 67 | ||
| 57 | - private void getData(int completeStatus){ | ||
| 58 | - if(completeStatus == -1){ | ||
| 59 | - getPresenter().getData(getActivity(),CommonInfo.getUserId(getActivity()),completeStatus,currentPage,pageSize); | ||
| 60 | - }else { | 68 | + private void getData(int completeStatus) { |
| 69 | + if (completeStatus == -1) { | ||
| 70 | + getPresenter().getData(getActivity(), CommonInfo.getUserId(getActivity()), completeStatus, currentPage, pageSize); | ||
| 71 | + } else { | ||
| 61 | this.completeStatus = currentPage; | 72 | this.completeStatus = currentPage; |
| 62 | - getPresenter().getData(getActivity(), CommonInfo.getUserId(getActivity()),completeStatus,currentPage,pageSize); | ||
| 63 | - if(completeStatus == 0){ | 73 | + getPresenter().getData(getActivity(), CommonInfo.getUserId(getActivity()), completeStatus, currentPage, pageSize); |
| 74 | + if (completeStatus == 0) { | ||
| 64 | binding.hasFinish.setTextColor(getActivity().getResources().getColor(R.color.green_tx)); | 75 | binding.hasFinish.setTextColor(getActivity().getResources().getColor(R.color.green_tx)); |
| 65 | binding.hasFinish.setTextSize(18); | 76 | binding.hasFinish.setTextSize(18); |
| 66 | binding.noFinish.setTextColor(getActivity().getResources().getColor(R.color.text_black)); | 77 | binding.noFinish.setTextColor(getActivity().getResources().getColor(R.color.text_black)); |
| 67 | binding.noFinish.setTextSize(15); | 78 | binding.noFinish.setTextSize(15); |
| 68 | - }else { | 79 | + } else { |
| 69 | binding.hasFinish.setTextColor(getActivity().getResources().getColor(R.color.text_black)); | 80 | binding.hasFinish.setTextColor(getActivity().getResources().getColor(R.color.text_black)); |
| 70 | binding.hasFinish.setTextSize(15); | 81 | binding.hasFinish.setTextSize(15); |
| 71 | binding.noFinish.setTextColor(getActivity().getResources().getColor(R.color.green_tx)); | 82 | binding.noFinish.setTextColor(getActivity().getResources().getColor(R.color.green_tx)); |
| @@ -79,4 +90,28 @@ public class SelfRecordFragment extends MvpBindingFragment<SelfRecordView, SelfR | @@ -79,4 +90,28 @@ public class SelfRecordFragment extends MvpBindingFragment<SelfRecordView, SelfR | ||
| 79 | protected int getLayoutId() { | 90 | protected int getLayoutId() { |
| 80 | return R.layout.fragment_self_record; | 91 | return R.layout.fragment_self_record; |
| 81 | } | 92 | } |
| 93 | + | ||
| 94 | + @Override | ||
| 95 | + public void onResume() { | ||
| 96 | + super.onResume(); | ||
| 97 | + if (getMvpView() == null) { | ||
| 98 | + return; | ||
| 99 | + } | ||
| 100 | + onCheckFailDataCount(); | ||
| 101 | + | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + public void onCheckFailDataCount() { | ||
| 105 | + //初始化 | ||
| 106 | + if (qBadgeView == null) { | ||
| 107 | + qBadgeView = new QBadgeView(getActivity()); | ||
| 108 | + qBadgeView.bindTarget(binding.againUp); | ||
| 109 | + qBadgeView.setBadgeTextSize(10, true); | ||
| 110 | +// qBadgeView.setGravityOffset(0, -5, true); | ||
| 111 | + } | ||
| 112 | + List<FailedEntity> failedEntities = StepUtil.getFailListData(getActivity(), CommonInfo.getUserId(getActivity())); | ||
| 113 | + if (failedEntities != null) { | ||
| 114 | + qBadgeView.setBadgeNumber(failedEntities.size()); | ||
| 115 | + } | ||
| 116 | + } | ||
| 82 | } | 117 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/UploadFailDetailFragment.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.UploadFailDetailFragmentPresenter; | ||
| 10 | +import com.cnlive.moudle.pedometer.frame.view.UploadFailDetailFragmentView; | ||
| 11 | +import com.cnlive.moudle.pedometer.sql.entity.FailedEntity; | ||
| 12 | +import com.example.moudle_pedometer.R; | ||
| 13 | +import com.example.moudle_pedometer.databinding.FragmentFinishRunMapBinding; | ||
| 14 | + | ||
| 15 | +import java.io.Serializable; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * 重新 上传详情页面 | ||
| 19 | + * | ||
| 20 | + * @author ShinnyYang | ||
| 21 | + */ | ||
| 22 | +public class UploadFailDetailFragment extends QMUIFragment<UploadFailDetailFragmentView, UploadFailDetailFragmentPresenter, FragmentFinishRunMapBinding> { | ||
| 23 | + private FailedEntity failedEntity; | ||
| 24 | + | ||
| 25 | + @Override | ||
| 26 | + protected int getToolbarId() { | ||
| 27 | + return 0; | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + @Override | ||
| 31 | + public String getTitle() { | ||
| 32 | + return null; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + @Override | ||
| 36 | + protected int getLayoutId() { | ||
| 37 | + return R.layout.fragment_finish_run_map; | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + public static UploadFailDetailFragment newInstance(FailedEntity failedEntity) { | ||
| 41 | + UploadFailDetailFragment failDetailFragment = new UploadFailDetailFragment(); | ||
| 42 | + Bundle bundle = new Bundle(); | ||
| 43 | + bundle.putSerializable("failedEntity", (Serializable) failedEntity); | ||
| 44 | + failDetailFragment.setArguments(bundle); | ||
| 45 | + return failDetailFragment; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + @Override | ||
| 49 | + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | ||
| 50 | + super.onViewCreated(view, savedInstanceState); | ||
| 51 | + StatusBarUtil2.setColor(getActivity(), getResources().getColor(R.color.run_main_bg), 0); | ||
| 52 | + | ||
| 53 | + if (getArguments() != null) { | ||
| 54 | + failedEntity = (FailedEntity) getArguments().getSerializable("failedEntity"); | ||
| 55 | + if (failedEntity != null) { | ||
| 56 | + if (getMvpView() != null) { | ||
| 57 | + getMvpView().initView(failedEntity); | ||
| 58 | + } | ||
| 59 | + } | ||
| 60 | + } | ||
| 61 | + } | ||
| 62 | +} |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/GsonUtil.java
| @@ -66,13 +66,17 @@ public class GsonUtil { | @@ -66,13 +66,17 @@ public class GsonUtil { | ||
| 66 | * @return | 66 | * @return |
| 67 | */ | 67 | */ |
| 68 | public static <T> List<T> jsonToList(String json, Class<T> cls) { | 68 | public static <T> List<T> jsonToList(String json, Class<T> cls) { |
| 69 | - Gson gson = new Gson(); | ||
| 70 | - List<T> list = new ArrayList<T>(); | ||
| 71 | - JsonArray array = new JsonParser().parse(json).getAsJsonArray(); | ||
| 72 | - for (final JsonElement elem : array) { | ||
| 73 | - list.add(gson.fromJson(elem, cls)); | 69 | + try { |
| 70 | + Gson gson = new Gson(); | ||
| 71 | + List<T> list = new ArrayList<T>(); | ||
| 72 | + JsonArray array = new JsonParser().parse(json).getAsJsonArray(); | ||
| 73 | + for (final JsonElement elem : array) { | ||
| 74 | + list.add(gson.fromJson(elem, cls)); | ||
| 75 | + } | ||
| 76 | + return list; | ||
| 77 | + } catch (Exception e) { | ||
| 78 | + return null; | ||
| 74 | } | 79 | } |
| 75 | - return list; | ||
| 76 | } | 80 | } |
| 77 | 81 | ||
| 78 | 82 | ||
| @@ -89,9 +93,9 @@ public class GsonUtil { | @@ -89,9 +93,9 @@ public class GsonUtil { | ||
| 89 | new TypeToken<List<Map<String, String>>>() { | 93 | new TypeToken<List<Map<String, String>>>() { |
| 90 | }.getType()); | 94 | }.getType()); |
| 91 | } | 95 | } |
| 92 | - for(int i=0;i<list.size();i++){ | ||
| 93 | - for(Map.Entry<String, String> entry:list.get(i).entrySet()){ | ||
| 94 | - if(entry.getValue()==null) { | 96 | + for (int i = 0; i < list.size(); i++) { |
| 97 | + for (Map.Entry<String, String> entry : list.get(i).entrySet()) { | ||
| 98 | + if (entry.getValue() == null) { | ||
| 95 | entry.setValue(""); | 99 | entry.setValue(""); |
| 96 | } | 100 | } |
| 97 | } | 101 | } |
| @@ -100,7 +104,6 @@ public class GsonUtil { | @@ -100,7 +104,6 @@ public class GsonUtil { | ||
| 100 | } | 104 | } |
| 101 | 105 | ||
| 102 | 106 | ||
| 103 | - | ||
| 104 | /** | 107 | /** |
| 105 | * 转成map的 | 108 | * 转成map的 |
| 106 | * | 109 | * |
| @@ -118,31 +121,31 @@ public class GsonUtil { | @@ -118,31 +121,31 @@ public class GsonUtil { | ||
| 118 | 121 | ||
| 119 | /** | 122 | /** |
| 120 | * 过滤null | 123 | * 过滤null |
| 124 | + * | ||
| 121 | * @param jsonElement | 125 | * @param jsonElement |
| 122 | * @return | 126 | * @return |
| 123 | */ | 127 | */ |
| 124 | - public static String StrConver(JsonElement jsonElement){ | ||
| 125 | - if(jsonElement==null||jsonElement.isJsonNull()||jsonElement.equals("null")){ | 128 | + public static String StrConver(JsonElement jsonElement) { |
| 129 | + if (jsonElement == null || jsonElement.isJsonNull() || jsonElement.equals("null")) { | ||
| 126 | return ""; | 130 | return ""; |
| 127 | - } | ||
| 128 | - else { | 131 | + } else { |
| 129 | return jsonElement.getAsString(); | 132 | return jsonElement.getAsString(); |
| 130 | } | 133 | } |
| 131 | } | 134 | } |
| 132 | - public static int IntConver(JsonElement jsonElement){ | ||
| 133 | - if(jsonElement.isJsonNull()){ | 135 | + |
| 136 | + public static int IntConver(JsonElement jsonElement) { | ||
| 137 | + if (jsonElement.isJsonNull()) { | ||
| 134 | return 0; | 138 | return 0; |
| 135 | - } | ||
| 136 | - else { | 139 | + } else { |
| 137 | return jsonElement.getAsInt(); | 140 | return jsonElement.getAsInt(); |
| 138 | } | 141 | } |
| 139 | } | 142 | } |
| 140 | 143 | ||
| 141 | - public static JsonObject toJsonObject(String str){ | 144 | + public static JsonObject toJsonObject(String str) { |
| 142 | return new JsonParser().parse(str).getAsJsonObject(); | 145 | return new JsonParser().parse(str).getAsJsonObject(); |
| 143 | } | 146 | } |
| 144 | 147 | ||
| 145 | - public static JsonArray toJsonArray(String str){ | 148 | + public static JsonArray toJsonArray(String str) { |
| 146 | return new JsonParser().parse(str).getAsJsonArray(); | 149 | return new JsonParser().parse(str).getAsJsonArray(); |
| 147 | } | 150 | } |
| 148 | 151 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/MyMapUtil.java
| @@ -92,7 +92,7 @@ public class MyMapUtil { | @@ -92,7 +92,7 @@ public class MyMapUtil { | ||
| 92 | LatLng importLatLng = importPoints.get(i); | 92 | LatLng importLatLng = importPoints.get(i); |
| 93 | for (int j = index; j < trackPoints.size(); j++) { | 93 | for (int j = index; j < trackPoints.size(); j++) { |
| 94 | double distance = DistanceUtil.getDistance(importLatLng, trackPoints.get(j)); | 94 | double distance = DistanceUtil.getDistance(importLatLng, trackPoints.get(j)); |
| 95 | - if (distance < 50) { | 95 | + if (distance < Constant.CHECK_ACCURACY) { |
| 96 | importHash.put(i, true); | 96 | importHash.put(i, true); |
| 97 | index = j; | 97 | index = j; |
| 98 | } | 98 | } |
| @@ -168,21 +168,23 @@ public class MyMapUtil { | @@ -168,21 +168,23 @@ public class MyMapUtil { | ||
| 168 | Log.e(TAG, "onHistoryTrackCallback: " + response.getMessage()); | 168 | Log.e(TAG, "onHistoryTrackCallback: " + response.getMessage()); |
| 169 | if (StatusCodes.SUCCESS != response.getStatus()) { | 169 | if (StatusCodes.SUCCESS != response.getStatus()) { |
| 170 | // if (response.getStatus() == 14004) { | 170 | // if (response.getStatus() == 14004) { |
| 171 | - //给3次重新查询的机会 | ||
| 172 | - if (queryNum < 4) { | ||
| 173 | - //重新查询 | 171 | + //给3次重新查询的机会 |
| 172 | + if (queryNum < 4) { | ||
| 173 | + //重新查询 | ||
| 174 | // new Handler().postDelayed(new Runnable() { | 174 | // new Handler().postDelayed(new Runnable() { |
| 175 | // @Override | 175 | // @Override |
| 176 | // public void run() { | 176 | // public void run() { |
| 177 | // //间隔3秒查一次 | 177 | // //间隔3秒查一次 |
| 178 | - queryHistoryTrace(context, mClient, entityName, startTime, endTime, callBack); | ||
| 179 | - queryNum++; | 178 | + queryHistoryTrace(context, mClient, entityName, startTime, endTime, callBack); |
| 179 | + queryNum++; | ||
| 180 | // } | 180 | // } |
| 181 | // }, 1000); | 181 | // }, 1000); |
| 182 | 182 | ||
| 183 | - } else { | 183 | + } else { |
| 184 | + if (callBack != null) { | ||
| 184 | callBack.success(null); | 185 | callBack.success(null); |
| 185 | } | 186 | } |
| 187 | + } | ||
| 186 | 188 | ||
| 187 | // } else { | 189 | // } else { |
| 188 | // Toast.makeText(context, "获取轨迹失败!" + response.getMessage() + "," + response.getStatus(), Toast.LENGTH_SHORT).show(); | 190 | // Toast.makeText(context, "获取轨迹失败!" + response.getMessage() + "," + response.getStatus(), Toast.LENGTH_SHORT).show(); |
| @@ -207,17 +209,17 @@ public class MyMapUtil { | @@ -207,17 +209,17 @@ public class MyMapUtil { | ||
| 207 | } | 209 | } |
| 208 | } | 210 | } |
| 209 | } | 211 | } |
| 210 | - } | ||
| 211 | - if (total > pageSize * pageIndex) { | ||
| 212 | - historyTrackRequest.setPageIndex(++pageIndex); | ||
| 213 | - queryHistoryTrace(context, mClient, entityName, startTime, endTime, callBack); | ||
| 214 | - } else { | ||
| 215 | - if (callBack != null) { | ||
| 216 | - callBack.success(trackPoints); | ||
| 217 | - trackPoints.clear(); | 212 | + |
| 213 | + if (total > pageSize * pageIndex) { | ||
| 214 | + historyTrackRequest.setPageIndex(++pageIndex); | ||
| 215 | + queryHistoryTrace(context, mClient, entityName, startTime, endTime, callBack); | ||
| 216 | + } else { | ||
| 217 | + if (callBack != null) { | ||
| 218 | + callBack.success(trackPoints); | ||
| 219 | + trackPoints.clear(); | ||
| 220 | + } | ||
| 218 | } | 221 | } |
| 219 | } | 222 | } |
| 220 | - | ||
| 221 | } | 223 | } |
| 222 | }; | 224 | }; |
| 223 | //开始查询历史轨迹 | 225 | //开始查询历史轨迹 |
| @@ -355,9 +357,11 @@ public class MyMapUtil { | @@ -355,9 +357,11 @@ public class MyMapUtil { | ||
| 355 | startPoint = points.get(points.size() - 1); | 357 | startPoint = points.get(points.size() - 1); |
| 356 | endPoint = points.get(0); | 358 | endPoint = points.get(0); |
| 357 | } | 359 | } |
| 358 | - | ||
| 359 | // 添加起点图标 | 360 | // 添加起点图标 |
| 360 | - Bitmap startPointBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), startIconRes), 24, 30); | 361 | + Bitmap startPointBitmap = null; |
| 362 | + if (null != context.getResources()) { | ||
| 363 | + startPointBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), startIconRes), 24, 30); | ||
| 364 | + } | ||
| 361 | OverlayOptions startOptions = null; | 365 | OverlayOptions startOptions = null; |
| 362 | if (startPointBitmap != null) { | 366 | if (startPointBitmap != null) { |
| 363 | startOptions = new MarkerOptions() | 367 | startOptions = new MarkerOptions() |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/NotificationUtil.java
0 → 100644
| 1 | +package com.cnlive.moudle.pedometer.utils; | ||
| 2 | + | ||
| 3 | +import android.app.Activity; | ||
| 4 | +import android.content.Intent; | ||
| 5 | +import android.os.Build; | ||
| 6 | +import android.provider.Settings; | ||
| 7 | +import android.support.v4.app.NotificationManagerCompat; | ||
| 8 | +import android.widget.Toast; | ||
| 9 | + | ||
| 10 | +import static android.app.Notification.EXTRA_CHANNEL_ID; | ||
| 11 | +import static android.provider.Settings.EXTRA_APP_PACKAGE; | ||
| 12 | + | ||
| 13 | +public class NotificationUtil { | ||
| 14 | + private static boolean isOpen; | ||
| 15 | + private static NotificationManagerCompat notificationManagerCompat; | ||
| 16 | + | ||
| 17 | + public static boolean isOpenNotification(Activity activity) { | ||
| 18 | + //监测通知权限是否打开 | ||
| 19 | + notificationManagerCompat = NotificationManagerCompat.from(activity); | ||
| 20 | + isOpen = notificationManagerCompat.areNotificationsEnabled(); | ||
| 21 | + if (!isOpen) { | ||
| 22 | + goToSettingNo(activity); | ||
| 23 | + } | ||
| 24 | + return isOpen; | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + private static void goToSettingNo(Activity activity) { | ||
| 28 | + Toast.makeText(activity, "您尚未开启通知权限,无法进行计步", Toast.LENGTH_LONG).show(); | ||
| 29 | + Intent intent1 = new Intent(); | ||
| 30 | + try { | ||
| 31 | + // 根据isOpened结果,判断是否需要提醒用户跳转AppInfo页面,去打开App通知权限 | ||
| 32 | + intent1.setAction(Settings.ACTION_APP_NOTIFICATION_SETTINGS); | ||
| 33 | + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | ||
| 34 | + //这种方案适用于 API 26, 即8.0(含8.0)以上可以用 | ||
| 35 | + intent1.putExtra(EXTRA_APP_PACKAGE, activity.getPackageName()); | ||
| 36 | + intent1.putExtra(EXTRA_CHANNEL_ID, activity.getApplicationInfo().uid); | ||
| 37 | + } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { | ||
| 38 | + //这种方案适用于 API21——25,即 5.0——7.1 之间的版本可以使用 | ||
| 39 | + intent1.putExtra("app_package", activity.getPackageName()); | ||
| 40 | + intent1.putExtra("app_uid", activity.getApplicationInfo().uid); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + // 小米6 -MIUI9.6-8.0.0系统,是个特例,通知设置界面只能控制"允许使用通知圆点"——然而这个玩意并没有卵用,我想对雷布斯说:I'm not ok!!! | ||
| 44 | + // if ("MI 6".equals(Build.MODEL)) { | ||
| 45 | + // intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); | ||
| 46 | + // Uri uri = Uri.fromParts("package", getPackageName(), null); | ||
| 47 | + // intent.setData(uri); | ||
| 48 | + // // intent.setAction("com.android.settings/.SubSettings"); | ||
| 49 | + // } | ||
| 50 | + activity.startActivity(intent1); | ||
| 51 | + } catch (Exception e) { | ||
| 52 | + //其他低版本或者异常情况,走该节点。进入APP设置界面 | ||
| 53 | + intent1.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); | ||
| 54 | + intent1.putExtra("package", activity.getPackageName()); | ||
| 55 | + activity.startActivity(intent1); | ||
| 56 | + } | ||
| 57 | + } | ||
| 58 | +} |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/StepUtil.java
| @@ -6,13 +6,16 @@ import android.util.Log; | @@ -6,13 +6,16 @@ import android.util.Log; | ||
| 6 | 6 | ||
| 7 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | 7 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 8 | import com.cnlive.moudle.pedometer.model.Constant; | 8 | import com.cnlive.moudle.pedometer.model.Constant; |
| 9 | +import com.cnlive.moudle.pedometer.sql.dao.FailedEntityDao; | ||
| 9 | import com.cnlive.moudle.pedometer.sql.dao.UserStepEntityDao; | 10 | import com.cnlive.moudle.pedometer.sql.dao.UserStepEntityDao; |
| 10 | import com.cnlive.moudle.pedometer.sql.db.DbCore; | 11 | import com.cnlive.moudle.pedometer.sql.db.DbCore; |
| 12 | +import com.cnlive.moudle.pedometer.sql.entity.FailedEntity; | ||
| 11 | import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; | 13 | import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; |
| 12 | 14 | ||
| 13 | import java.text.SimpleDateFormat; | 15 | import java.text.SimpleDateFormat; |
| 14 | import java.util.Date; | 16 | import java.util.Date; |
| 15 | import java.util.List; | 17 | import java.util.List; |
| 18 | +import java.util.UUID; | ||
| 16 | 19 | ||
| 17 | import static android.support.constraint.Constraints.TAG; | 20 | import static android.support.constraint.Constraints.TAG; |
| 18 | 21 | ||
| @@ -25,6 +28,81 @@ public class StepUtil { | @@ -25,6 +28,81 @@ public class StepUtil { | ||
| 25 | private static final String TAG = "StepUtil"; | 28 | private static final String TAG = "StepUtil"; |
| 26 | private static final String dbName = "Step.db"; | 29 | private static final String dbName = "Step.db"; |
| 27 | 30 | ||
| 31 | + public static String getUUID() { | ||
| 32 | + return UUID.randomUUID().toString().replace("-", ""); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * 删除临时保存数据 | ||
| 37 | + * | ||
| 38 | + * @param context | ||
| 39 | + * @param entity | ||
| 40 | + */ | ||
| 41 | + public static void deleteTempSaveFailData(Context context, FailedEntity entity) { | ||
| 42 | + DbCore.init(context, dbName); | ||
| 43 | + if (entity != null && !TextUtils.isEmpty(entity.getUuid())) { | ||
| 44 | + DbCore.getDaoSession().getFailedEntityDao().deleteByKey(entity.getUuid()); | ||
| 45 | + Log.e(TAG, "deleteTempSaveFailData: 删除临时保存数据"); | ||
| 46 | + } | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + /** | ||
| 50 | + * 获取暂存的失败数据 | ||
| 51 | + * | ||
| 52 | + * @param context | ||
| 53 | + * @param uid | ||
| 54 | + * @param userStartTime | ||
| 55 | + * @return | ||
| 56 | + */ | ||
| 57 | + public static FailedEntity getTempSaveFailData(Context context, String uid, long userStartTime) { | ||
| 58 | + DbCore.init(context, dbName); | ||
| 59 | + List<FailedEntity> list = DbCore.getDaoSession().getFailedEntityDao().queryBuilder().where(FailedEntityDao.Properties.Uid.eq(uid), FailedEntityDao.Properties.UserStartTime.eq(userStartTime)).list(); | ||
| 60 | + if (list != null && list.size() > 0) { | ||
| 61 | + if (list.get(0) == null) { | ||
| 62 | + return null; | ||
| 63 | + } else { | ||
| 64 | + return list.get(0); | ||
| 65 | + } | ||
| 66 | + } | ||
| 67 | + return null; | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + //获取上传失败列表 | ||
| 71 | + public static List<FailedEntity> getFailListData(Context context, String uid) { | ||
| 72 | + DbCore.init(context, dbName); | ||
| 73 | + List<FailedEntity> list = DbCore.getDaoSession().getFailedEntityDao().queryBuilder().where(FailedEntityDao.Properties.Uid.eq(uid)).list(); | ||
| 74 | + return list; | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + //设置失败数据 | ||
| 78 | + public static void setFailData(Context context, FailedEntity failedEntity) { | ||
| 79 | + DbCore.init(context, dbName); | ||
| 80 | + DbCore.getDaoSession().getFailedEntityDao().insert(failedEntity); | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + /** | ||
| 84 | + * 设置赛事标题 | ||
| 85 | + * | ||
| 86 | + * @param context | ||
| 87 | + * @param uid | ||
| 88 | + * @param streetTitle | ||
| 89 | + */ | ||
| 90 | + public static void setStreetTitle(Context context, String uid, String streetTitle) { | ||
| 91 | + if (getUserStepData(context, uid) != null) { | ||
| 92 | + UserStepEntity entity = getUserStepData(context, uid); | ||
| 93 | + entity.setStreetTitle(streetTitle); | ||
| 94 | + //更新数据 | ||
| 95 | + updateStepData(context, entity); | ||
| 96 | + } | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + /** | ||
| 100 | + * 设置重要点 | ||
| 101 | + * | ||
| 102 | + * @param context | ||
| 103 | + * @param uid | ||
| 104 | + * @param importStr | ||
| 105 | + */ | ||
| 28 | public static void setImportPoints(Context context, String uid, String importStr) { | 106 | public static void setImportPoints(Context context, String uid, String importStr) { |
| 29 | if (getUserStepData(context, uid) != null) { | 107 | if (getUserStepData(context, uid) != null) { |
| 30 | UserStepEntity entity = getUserStepData(context, uid); | 108 | UserStepEntity entity = getUserStepData(context, uid); |
| @@ -151,7 +229,7 @@ public class StepUtil { | @@ -151,7 +229,7 @@ public class StepUtil { | ||
| 151 | DbCore.init(context, dbName); | 229 | DbCore.init(context, dbName); |
| 152 | List<UserStepEntity> list = DbCore.getDaoSession().getUserStepEntityDao().queryBuilder().where(UserStepEntityDao.Properties.UserId.eq(uid)).list(); | 230 | List<UserStepEntity> list = DbCore.getDaoSession().getUserStepEntityDao().queryBuilder().where(UserStepEntityDao.Properties.UserId.eq(uid)).list(); |
| 153 | if (list != null && list.size() > 0) { | 231 | if (list != null && list.size() > 0) { |
| 154 | - Log.e(TAG, "clearRunData: " + list.size()); | 232 | + Log.e(TAG, "clearRunData:删除用户逻辑数据 " + list.size()); |
| 155 | DbCore.getDaoSession().getUserStepEntityDao().delete(list.get(0)); | 233 | DbCore.getDaoSession().getUserStepEntityDao().delete(list.get(0)); |
| 156 | DbCore.getDaoSession().getUserStepEntityDao().detachAll(); | 234 | DbCore.getDaoSession().getUserStepEntityDao().detachAll(); |
| 157 | } | 235 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/TimeUtil.java
| @@ -11,6 +11,37 @@ import java.util.Date; | @@ -11,6 +11,37 @@ import java.util.Date; | ||
| 11 | */ | 11 | */ |
| 12 | public class TimeUtil { | 12 | public class TimeUtil { |
| 13 | 13 | ||
| 14 | + // public static String stampToChronometer(long stamp){ | ||
| 15 | +//// int hour=stamp/60/60 | ||
| 16 | +// } | ||
| 17 | + public static String stampToChronometer(long mss) { | ||
| 18 | + String DateTimes = ""; | ||
| 19 | + long days = mss / (60 * 60 * 24); | ||
| 20 | + long hours = (mss % (60 * 60 * 24)) / (60 * 60); | ||
| 21 | + long minutes = (mss % (60 * 60)) / 60; | ||
| 22 | + long seconds = mss % 60; | ||
| 23 | + | ||
| 24 | + if (hours < 10) { | ||
| 25 | + DateTimes += "0" + hours + ":"; | ||
| 26 | + } else { | ||
| 27 | + DateTimes += hours + ":"; | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + if (minutes < 10) { | ||
| 31 | + DateTimes += "0" + minutes + ":"; | ||
| 32 | + } else { | ||
| 33 | + DateTimes += minutes + ":"; | ||
| 34 | + | ||
| 35 | + } | ||
| 36 | + if (seconds < 10) { | ||
| 37 | + DateTimes += "0" + seconds; | ||
| 38 | + } else { | ||
| 39 | + DateTimes += seconds; | ||
| 40 | + | ||
| 41 | + } | ||
| 42 | + return DateTimes; | ||
| 43 | + } | ||
| 44 | + | ||
| 14 | /** | 45 | /** |
| 15 | * 日期格式字符串转换成时间戳 | 46 | * 日期格式字符串转换成时间戳 |
| 16 | * | 47 | * |
moudle_pedometer/src/main/res/drawable-hdpi/icon_no_fail_line.png
0 → 100644
14.5 KB
moudle_pedometer/src/main/res/drawable-xhdpi/icon_no_fail_line.png
0 → 100644
16.6 KB
moudle_pedometer/src/main/res/drawable-xxhdpi/icon_no_fail_line.png
0 → 100644
32 KB
moudle_pedometer/src/main/res/layout/fragment_line_up_again.xml
| 1 | <layout xmlns:android="http://schemas.android.com/apk/res/android"> | 1 | <layout xmlns:android="http://schemas.android.com/apk/res/android"> |
| 2 | 2 | ||
| 3 | + | ||
| 3 | <LinearLayout | 4 | <LinearLayout |
| 4 | android:layout_width="match_parent" | 5 | android:layout_width="match_parent" |
| 5 | android:layout_height="match_parent" | 6 | android:layout_height="match_parent" |
| @@ -10,19 +11,48 @@ | @@ -10,19 +11,48 @@ | ||
| 10 | android:layout_width="match_parent" | 11 | android:layout_width="match_parent" |
| 11 | android:layout_height="?attr/qmui_topbar_height" /> | 12 | android:layout_height="?attr/qmui_topbar_height" /> |
| 12 | 13 | ||
| 13 | - <com.scwang.smartrefresh.layout.SmartRefreshLayout | ||
| 14 | - android:id="@+id/refreshLayout" | 14 | + <FrameLayout |
| 15 | android:layout_width="match_parent" | 15 | android:layout_width="match_parent" |
| 16 | - android:layout_height="match_parent" | ||
| 17 | - android:background="#F8F8F8" > | 16 | + android:layout_height="match_parent"> |
| 17 | + | ||
| 18 | + <com.scwang.smartrefresh.layout.SmartRefreshLayout | ||
| 19 | + android:id="@+id/refreshLayout" | ||
| 20 | + android:layout_width="match_parent" | ||
| 21 | + android:layout_height="match_parent" | ||
| 22 | + android:background="#F8F8F8"> | ||
| 18 | 23 | ||
| 19 | - <android.support.v7.widget.RecyclerView | ||
| 20 | - android:id="@+id/recycler" | 24 | + <android.support.v7.widget.RecyclerView |
| 25 | + android:id="@+id/recycler" | ||
| 26 | + android:layout_width="match_parent" | ||
| 27 | + android:layout_height="match_parent" /> | ||
| 28 | + | ||
| 29 | + </com.scwang.smartrefresh.layout.SmartRefreshLayout> | ||
| 30 | + <!----> | ||
| 31 | + //没有失败记录 | ||
| 32 | + | ||
| 33 | + <LinearLayout | ||
| 34 | + android:id="@+id/ll_no_fail_tip" | ||
| 21 | android:layout_width="match_parent" | 35 | android:layout_width="match_parent" |
| 22 | android:layout_height="match_parent" | 36 | android:layout_height="match_parent" |
| 23 | - /> | 37 | + android:background="@color/white" |
| 38 | + android:gravity="center" | ||
| 39 | + android:orientation="vertical" | ||
| 40 | + android:visibility="gone"> | ||
| 24 | 41 | ||
| 25 | - </com.scwang.smartrefresh.layout.SmartRefreshLayout> | 42 | + <ImageView |
| 43 | + android:layout_width="224dp" | ||
| 44 | + android:layout_height="124dp" | ||
| 45 | + android:background="@drawable/icon_no_fail_line" /> | ||
| 46 | + | ||
| 47 | + <TextView | ||
| 48 | + android:layout_width="wrap_content" | ||
| 49 | + android:layout_height="wrap_content" | ||
| 50 | + android:layout_marginTop="10dp" | ||
| 51 | + android:text="@string/no_fail_line_text_tip" | ||
| 52 | + android:textColor="@color/text_black" /> | ||
| 53 | + </LinearLayout> | ||
| 54 | + </FrameLayout> | ||
| 26 | </LinearLayout> | 55 | </LinearLayout> |
| 56 | + | ||
| 27 | </layout> | 57 | </layout> |
| 28 | 58 |
moudle_pedometer/src/main/res/layout/layout_finish_running_route.xml
| @@ -56,7 +56,7 @@ | @@ -56,7 +56,7 @@ | ||
| 56 | android:layout_width="wrap_content" | 56 | android:layout_width="wrap_content" |
| 57 | android:layout_height="wrap_content" | 57 | android:layout_height="wrap_content" |
| 58 | android:layout_marginLeft="10dp" | 58 | android:layout_marginLeft="10dp" |
| 59 | - android:text="首都师范大学操场东门" | 59 | + android:text="--" |
| 60 | android:textColor="@color/black" | 60 | android:textColor="@color/black" |
| 61 | android:textSize="12sp" /> | 61 | android:textSize="12sp" /> |
| 62 | </LinearLayout> | 62 | </LinearLayout> |
| @@ -93,7 +93,7 @@ | @@ -93,7 +93,7 @@ | ||
| 93 | android:layout_width="wrap_content" | 93 | android:layout_width="wrap_content" |
| 94 | android:layout_height="wrap_content" | 94 | android:layout_height="wrap_content" |
| 95 | android:layout_marginLeft="10dp" | 95 | android:layout_marginLeft="10dp" |
| 96 | - android:text="首都师范大学操场东门" | 96 | + android:text="--" |
| 97 | android:textColor="@color/black" | 97 | android:textColor="@color/black" |
| 98 | android:textSize="12sp" /> | 98 | android:textSize="12sp" /> |
| 99 | </LinearLayout> | 99 | </LinearLayout> |
| @@ -128,7 +128,7 @@ | @@ -128,7 +128,7 @@ | ||
| 128 | android:layout_height="wrap_content" | 128 | android:layout_height="wrap_content" |
| 129 | android:layout_marginLeft="10dp" | 129 | android:layout_marginLeft="10dp" |
| 130 | android:layout_marginTop="5dp" | 130 | android:layout_marginTop="5dp" |
| 131 | - android:text="00:27:23" | 131 | + android:text="--" |
| 132 | android:textColor="@color/text_black" | 132 | android:textColor="@color/text_black" |
| 133 | android:textSize="18sp" | 133 | android:textSize="18sp" |
| 134 | android:textStyle="bold" /> | 134 | android:textStyle="bold" /> |
| @@ -170,7 +170,7 @@ | @@ -170,7 +170,7 @@ | ||
| 170 | android:layout_width="wrap_content" | 170 | android:layout_width="wrap_content" |
| 171 | android:layout_height="wrap_content" | 171 | android:layout_height="wrap_content" |
| 172 | android:layout_marginLeft="10dp" | 172 | android:layout_marginLeft="10dp" |
| 173 | - android:text="路线完成" | 173 | + android:text="--" |
| 174 | android:textColor="@color/text_gray" | 174 | android:textColor="@color/text_gray" |
| 175 | android:textSize="11sp" /> | 175 | android:textSize="11sp" /> |
| 176 | </LinearLayout> | 176 | </LinearLayout> |
moudle_pedometer/src/main/res/layout/layout_finish_step.xml
| @@ -38,7 +38,7 @@ | @@ -38,7 +38,7 @@ | ||
| 38 | android:id="@+id/tv_step" | 38 | android:id="@+id/tv_step" |
| 39 | android:layout_width="wrap_content" | 39 | android:layout_width="wrap_content" |
| 40 | android:layout_height="wrap_content" | 40 | android:layout_height="wrap_content" |
| 41 | - android:text="1233" | 41 | + android:text="--" |
| 42 | android:textColor="@color/green_round" | 42 | android:textColor="@color/green_round" |
| 43 | android:textSize="28sp" | 43 | android:textSize="28sp" |
| 44 | android:textStyle="bold" /> | 44 | android:textStyle="bold" /> |
moudle_pedometer/src/main/res/layout/layout_finish_user_info.xml
| @@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
| 8 | 8 | ||
| 9 | <LinearLayout | 9 | <LinearLayout |
| 10 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
| 11 | - android:layout_height="170dp" | 11 | + android:layout_height="190dp" |
| 12 | android:layout_marginTop="30dp" | 12 | android:layout_marginTop="30dp" |
| 13 | android:background="@drawable/shape_10dp_white_raduis_bg" | 13 | android:background="@drawable/shape_10dp_white_raduis_bg" |
| 14 | android:orientation="vertical"> | 14 | android:orientation="vertical"> |
| @@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
| 19 | android:layout_height="wrap_content" | 19 | android:layout_height="wrap_content" |
| 20 | android:layout_marginLeft="80dp" | 20 | android:layout_marginLeft="80dp" |
| 21 | android:layout_marginTop="10dp" | 21 | android:layout_marginTop="10dp" |
| 22 | - android:text="用户昵称" | 22 | + android:text="--" |
| 23 | android:textColor="@color/text_black" | 23 | android:textColor="@color/text_black" |
| 24 | android:textSize="13sp" /> | 24 | android:textSize="13sp" /> |
| 25 | <!----> | 25 | <!----> |
| @@ -40,7 +40,7 @@ | @@ -40,7 +40,7 @@ | ||
| 40 | android:layout_height="wrap_content" | 40 | android:layout_height="wrap_content" |
| 41 | android:layout_marginLeft="15dp" | 41 | android:layout_marginLeft="15dp" |
| 42 | android:layout_marginTop="15dp" | 42 | android:layout_marginTop="15dp" |
| 43 | - android:text="奥森公园南路" | 43 | + android:text="--" |
| 44 | android:textColor="@color/text_black" | 44 | android:textColor="@color/text_black" |
| 45 | android:textSize="15sp" /> | 45 | android:textSize="15sp" /> |
| 46 | 46 | ||
| @@ -50,7 +50,7 @@ | @@ -50,7 +50,7 @@ | ||
| 50 | android:layout_height="wrap_content" | 50 | android:layout_height="wrap_content" |
| 51 | android:layout_marginLeft="15dp" | 51 | android:layout_marginLeft="15dp" |
| 52 | android:layout_marginTop="5dp" | 52 | android:layout_marginTop="5dp" |
| 53 | - android:text="2019/06/10 9:51" | 53 | + android:text="--" |
| 54 | android:textColor="@color/text_gray" | 54 | android:textColor="@color/text_gray" |
| 55 | android:textSize="10sp" /> | 55 | android:textSize="10sp" /> |
| 56 | </LinearLayout> | 56 | </LinearLayout> |
| @@ -66,7 +66,7 @@ | @@ -66,7 +66,7 @@ | ||
| 66 | android:layout_width="wrap_content" | 66 | android:layout_width="wrap_content" |
| 67 | android:layout_height="wrap_content" | 67 | android:layout_height="wrap_content" |
| 68 | android:layout_marginRight="10dp" | 68 | android:layout_marginRight="10dp" |
| 69 | - android:text="1.53" | 69 | + android:text="--" |
| 70 | android:textColor="@color/text_black" | 70 | android:textColor="@color/text_black" |
| 71 | android:textSize="45sp" | 71 | android:textSize="45sp" |
| 72 | android:textStyle="bold" /> | 72 | android:textStyle="bold" /> |
| @@ -104,7 +104,7 @@ | @@ -104,7 +104,7 @@ | ||
| 104 | android:id="@+id/tv_speed" | 104 | android:id="@+id/tv_speed" |
| 105 | android:layout_width="wrap_content" | 105 | android:layout_width="wrap_content" |
| 106 | android:layout_height="wrap_content" | 106 | android:layout_height="wrap_content" |
| 107 | - android:text="34'33''" | 107 | + android:text="--" |
| 108 | android:textColor="@color/text_black" | 108 | android:textColor="@color/text_black" |
| 109 | android:textSize="20sp" | 109 | android:textSize="20sp" |
| 110 | android:textStyle="bold" /> | 110 | android:textStyle="bold" /> |
| @@ -129,7 +129,7 @@ | @@ -129,7 +129,7 @@ | ||
| 129 | android:id="@+id/tv_timer" | 129 | android:id="@+id/tv_timer" |
| 130 | android:layout_width="wrap_content" | 130 | android:layout_width="wrap_content" |
| 131 | android:layout_height="wrap_content" | 131 | android:layout_height="wrap_content" |
| 132 | - android:text="00:00:00" | 132 | + android:text="--" |
| 133 | android:textColor="@color/text_black" | 133 | android:textColor="@color/text_black" |
| 134 | android:textSize="20sp" | 134 | android:textSize="20sp" |
| 135 | android:textStyle="bold" /> | 135 | android:textStyle="bold" /> |
moudle_pedometer/src/main/res/values/ids.xml
| @@ -8,5 +8,7 @@ | @@ -8,5 +8,7 @@ | ||
| 8 | <item name="fragment_finish_run_map" type="id" /> | 8 | <item name="fragment_finish_run_map" type="id" /> |
| 9 | <!--路径工具--> | 9 | <!--路径工具--> |
| 10 | <item name="fragment_start_collect_trace" type="id" /> | 10 | <item name="fragment_start_collect_trace" type="id" /> |
| 11 | + <!--上传失败--> | ||
| 12 | + <item name="fragment_upload_fail" type="id" /> | ||
| 11 | 13 | ||
| 12 | </resources> | 14 | </resources> |
moudle_pedometer/src/main/res/values/strings.xml
| @@ -69,7 +69,7 @@ | @@ -69,7 +69,7 @@ | ||
| 69 | <string name="loc_gps_accuracy_mid">GPS信号质量中等</string> | 69 | <string name="loc_gps_accuracy_mid">GPS信号质量中等</string> |
| 70 | <string name="loc_gps_accuracy_good">GPS信号质量好</string> | 70 | <string name="loc_gps_accuracy_good">GPS信号质量好</string> |
| 71 | <string name="layout_street_active_type">活动类型</string> | 71 | <string name="layout_street_active_type">活动类型</string> |
| 72 | - <string name="open_gps_tip">您尚未开启GPS,为确保定位准确性,请您打开后使用!</string> | 72 | + <string name="open_gps_tip">请开启GPS饼将其设置为高精度模式!</string> |
| 73 | <!----> | 73 | <!----> |
| 74 | <!--网络请求--> | 74 | <!--网络请求--> |
| 75 | <string name="retry">重试</string> | 75 | <string name="retry">重试</string> |
| @@ -88,6 +88,7 @@ | @@ -88,6 +88,7 @@ | ||
| 88 | <string name="add_path">添加轨迹</string> | 88 | <string name="add_path">添加轨迹</string> |
| 89 | <string name="addpath">绑定轨迹</string> | 89 | <string name="addpath">绑定轨迹</string> |
| 90 | <string name="delect">删除</string> | 90 | <string name="delect">删除</string> |
| 91 | + <string name="no_fail_line_text_tip">没有上传失败的路线哦</string> | ||
| 91 | 92 | ||
| 92 | 93 | ||
| 93 | </resources> | 94 | </resources> |