Commit eddc9545e245313ed646a925f30cb019bb73144a
代码合并
Showing
59 changed files
with
1151 additions
and
595 deletions
.idea/codeStyles/Project.xml deleted
100644 → 0
| 1 | -<component name="ProjectCodeStyleConfiguration"> | ||
| 2 | - <code_scheme name="Project" version="173"> | ||
| 3 | - <Objective-C-extensions> | ||
| 4 | - <file> | ||
| 5 | - <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" /> | ||
| 6 | - <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" /> | ||
| 7 | - <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" /> | ||
| 8 | - <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" /> | ||
| 9 | - <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" /> | ||
| 10 | - <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" /> | ||
| 11 | - <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" /> | ||
| 12 | - <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" /> | ||
| 13 | - <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" /> | ||
| 14 | - </file> | ||
| 15 | - <class> | ||
| 16 | - <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" /> | ||
| 17 | - <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" /> | ||
| 18 | - <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" /> | ||
| 19 | - <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" /> | ||
| 20 | - <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" /> | ||
| 21 | - <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" /> | ||
| 22 | - </class> | ||
| 23 | - <extensions> | ||
| 24 | - <pair source="cpp" header="h" fileNamingConvention="NONE" /> | ||
| 25 | - <pair source="c" header="h" fileNamingConvention="NONE" /> | ||
| 26 | - </extensions> | ||
| 27 | - </Objective-C-extensions> | ||
| 28 | - </code_scheme> | ||
| 29 | -</component> | ||
| 30 | \ No newline at end of file | 0 | \ No newline at end of file |
app/src/main/java/com/example/modulepedometer/MainActivity.java
| @@ -3,8 +3,16 @@ package com.example.modulepedometer; | @@ -3,8 +3,16 @@ package com.example.modulepedometer; | ||
| 3 | import android.content.Intent; | 3 | import android.content.Intent; |
| 4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
| 5 | import android.support.v7.app.AppCompatActivity; | 5 | import android.support.v7.app.AppCompatActivity; |
| 6 | +import android.text.TextUtils; | ||
| 6 | import android.view.View; | 7 | import android.view.View; |
| 7 | 8 | ||
| 9 | +import com.baidu.mapapi.model.LatLng; | ||
| 10 | +import com.baidu.mapapi.search.geocode.GeoCodeResult; | ||
| 11 | +import com.baidu.mapapi.search.geocode.GeoCoder; | ||
| 12 | +import com.baidu.mapapi.search.geocode.OnGetGeoCoderResultListener; | ||
| 13 | +import com.baidu.mapapi.search.geocode.ReverseGeoCodeOption; | ||
| 14 | +import com.baidu.mapapi.search.geocode.ReverseGeoCodeResult; | ||
| 15 | +import com.cnlive.libs.base.util.AlertUtil; | ||
| 8 | import com.cnlive.moudle.collectionTrace.ui.activity.CollRunRaceDetailActivity; | 16 | import com.cnlive.moudle.collectionTrace.ui.activity.CollRunRaceDetailActivity; |
| 9 | import com.cnlive.moudle.collectionTrace.ui.activity.CollRunningFinishActivity; | 17 | import com.cnlive.moudle.collectionTrace.ui.activity.CollRunningFinishActivity; |
| 10 | import com.cnlive.moudle.collectionTrace.ui.activity.RaceListActivity; | 18 | import com.cnlive.moudle.collectionTrace.ui.activity.RaceListActivity; |
| @@ -13,6 +21,7 @@ import com.cnlive.moudle.pedometer.model.Constant; | @@ -13,6 +21,7 @@ import com.cnlive.moudle.pedometer.model.Constant; | ||
| 13 | import com.cnlive.moudle.pedometer.ui.activity.MyRecordActivity; | 21 | import com.cnlive.moudle.pedometer.ui.activity.MyRecordActivity; |
| 14 | import com.cnlive.moudle.pedometer.ui.activity.RunLineActivity; | 22 | import com.cnlive.moudle.pedometer.ui.activity.RunLineActivity; |
| 15 | import com.cnlive.moudle.pedometer.ui.activity.SelfRecordActivity; | 23 | import com.cnlive.moudle.pedometer.ui.activity.SelfRecordActivity; |
| 24 | +import com.cnlive.moudle.pedometer.utils.MyMapUtil; | ||
| 16 | 25 | ||
| 17 | 26 | ||
| 18 | public class MainActivity extends AppCompatActivity { | 27 | public class MainActivity extends AppCompatActivity { |
| @@ -22,6 +31,7 @@ public class MainActivity extends AppCompatActivity { | @@ -22,6 +31,7 @@ public class MainActivity extends AppCompatActivity { | ||
| 22 | super.onCreate(savedInstanceState); | 31 | super.onCreate(savedInstanceState); |
| 23 | setContentView(R.layout.activity_main); | 32 | setContentView(R.layout.activity_main); |
| 24 | 33 | ||
| 34 | +// String uid = "10535072"; | ||
| 25 | String uid = "358916"; | 35 | String uid = "358916"; |
| 26 | // String uid = "358689"; | 36 | // String uid = "358689"; |
| 27 | 37 | ||
| @@ -44,19 +54,14 @@ public class MainActivity extends AppCompatActivity { | @@ -44,19 +54,14 @@ public class MainActivity extends AppCompatActivity { | ||
| 44 | } | 54 | } |
| 45 | }); | 55 | }); |
| 46 | 56 | ||
| 47 | -// RunLineActivity.newInstance(this,null,null,null); | ||
| 48 | -// Intent intent = new Intent(this, CollRunRaceDetailActivity.class); | ||
| 49 | -// startActivity(intent); | ||
| 50 | -// ARouter.getInstance() | ||
| 51 | -//// .build("/moudle_pedometer/InterestActivity") | ||
| 52 | -// .build("/moudle_pedometer/CollRunRaceDetailActivity") | ||
| 53 | -// .navigation(this); | ||
| 54 | -// finish(); | ||
| 55 | -// BottomSheetDialog bottomSheetDialog=new BottomSheetDialog(this); | ||
| 56 | -// View view=getLayoutInflater().inflate(R.layout.dialog_start_tip_bottomsheet,null); | ||
| 57 | -// bottomSheetDialog.setContentView(view); | ||
| 58 | -// bottomSheetDialog.show(); | ||
| 59 | -// bottomSheetDialog.setCancelable(false); | 57 | +// MyMapUtil.getGeoCoderResult(new LatLng(39.934805, 116.308686), new MyMapUtil.GeoCodeResult() { |
| 58 | +// @Override | ||
| 59 | +// public void success(String address) { | ||
| 60 | +// if (null != address && !TextUtils.isEmpty(address)) { | ||
| 61 | +// AlertUtil.showDeftToast(MainActivity.this, address); | ||
| 62 | +// } | ||
| 63 | +// } | ||
| 64 | +// }); | ||
| 60 | 65 | ||
| 61 | } | 66 | } |
| 62 | } | 67 | } |
config.gradle
moudle_pedometer/src/main/AndroidManifest.xml
| @@ -52,36 +52,46 @@ | @@ -52,36 +52,46 @@ | ||
| 52 | android:required="true" /> | 52 | android:required="true" /> |
| 53 | 53 | ||
| 54 | <application android:persistent="true"> | 54 | <application android:persistent="true"> |
| 55 | - <activity android:name="com.cnlive.moudle.collectionTrace.ui.activity.RaceNameListActivity" | 55 | + <activity |
| 56 | + android:name="com.cnlive.moudle.collectionTrace.ui.activity.RaceNameListActivity" | ||
| 56 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" | 57 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" |
| 57 | - android:screenOrientation="portrait"/> | ||
| 58 | - <activity android:name="com.cnlive.moudle.collectionTrace.ui.activity.RaceListActivity" | 58 | + android:screenOrientation="portrait" /> |
| 59 | + <activity | ||
| 60 | + android:name="com.cnlive.moudle.collectionTrace.ui.activity.RaceListActivity" | ||
| 59 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" | 61 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" |
| 60 | - android:screenOrientation="portrait"/> | ||
| 61 | - <activity android:name="com.cnlive.moudle.pedometer.ui.activity.LineUpAgainActivity" | 62 | + android:screenOrientation="portrait" /> |
| 63 | + <activity | ||
| 64 | + android:name="com.cnlive.moudle.pedometer.ui.activity.LineUpAgainActivity" | ||
| 62 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" | 65 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" |
| 63 | - android:screenOrientation="portrait"/> | ||
| 64 | - <activity android:name="com.cnlive.moudle.pedometer.ui.activity.SelfRecordActivity" | 66 | + android:screenOrientation="portrait" /> |
| 67 | + <activity | ||
| 68 | + android:name="com.cnlive.moudle.pedometer.ui.activity.SelfRecordActivity" | ||
| 65 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" | 69 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" |
| 66 | - android:screenOrientation="portrait"/> | ||
| 67 | - <activity android:name="com.cnlive.moudle.pedometer.ui.activity.TakePartActivity" | 70 | + android:screenOrientation="portrait" /> |
| 71 | + <activity | ||
| 72 | + android:name="com.cnlive.moudle.pedometer.ui.activity.TakePartActivity" | ||
| 68 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" | 73 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" |
| 69 | - android:screenOrientation="portrait"/> | ||
| 70 | - <activity android:name="com.cnlive.moudle.pedometer.ui.activity.RunLineActivity" | 74 | + android:screenOrientation="portrait" /> |
| 75 | + <activity | ||
| 76 | + android:name="com.cnlive.moudle.pedometer.ui.activity.RunLineActivity" | ||
| 71 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" | 77 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" |
| 72 | - android:screenOrientation="portrait"/> | ||
| 73 | - <activity android:name="com.cnlive.moudle.pedometer.ui.activity.MyRecordActivity" | 78 | + android:screenOrientation="portrait" /> |
| 79 | + <activity | ||
| 80 | + android:name="com.cnlive.moudle.pedometer.ui.activity.MyRecordActivity" | ||
| 74 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" | 81 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" |
| 75 | - android:screenOrientation="portrait"/> | ||
| 76 | - <activity android:name="com.cnlive.moudle.pedometer.ui.activity.ShareRecordActivity" | 82 | + android:screenOrientation="portrait" /> |
| 83 | + <activity | ||
| 84 | + android:name="com.cnlive.moudle.pedometer.ui.activity.ShareRecordActivity" | ||
| 77 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" | 85 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" |
| 78 | - android:screenOrientation="portrait"/> | ||
| 79 | - <activity android:name="com.cnlive.moudle.pedometer.ui.activity.RaceRecordActivity" | 86 | + android:screenOrientation="portrait" /> |
| 87 | + <activity | ||
| 88 | + android:name="com.cnlive.moudle.pedometer.ui.activity.RaceRecordActivity" | ||
| 80 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" | 89 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" |
| 81 | - android:screenOrientation="portrait"/> | ||
| 82 | - <activity android:name="com.cnlive.moudle.pedometer.ui.activity.RegistrationInfoActivity" | 90 | + android:screenOrientation="portrait" /> |
| 91 | + <activity | ||
| 92 | + android:name="com.cnlive.moudle.pedometer.ui.activity.RegistrationInfoActivity" | ||
| 83 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" | 93 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" |
| 84 | - android:screenOrientation="portrait"/> | 94 | + android:screenOrientation="portrait" /> |
| 85 | 95 | ||
| 86 | <service | 96 | <service |
| 87 | android:name="com.cnlive.moudle.pedometer.service.StepService" | 97 | android:name="com.cnlive.moudle.pedometer.service.StepService" |
| @@ -183,7 +193,7 @@ | @@ -183,7 +193,7 @@ | ||
| 183 | android:enabled="true" | 193 | android:enabled="true" |
| 184 | android:exported="true" | 194 | android:exported="true" |
| 185 | android:priority="1000" | 195 | android:priority="1000" |
| 186 | - android:process=":re" /> | 196 | + android:process=":alive" /> |
| 187 | <service | 197 | <service |
| 188 | android:name="com.cnlive.moudle.collectionTrace.service.CollStepService" | 198 | android:name="com.cnlive.moudle.collectionTrace.service.CollStepService" |
| 189 | android:enabled="true" | 199 | android:enabled="true" |
| @@ -221,22 +231,27 @@ | @@ -221,22 +231,27 @@ | ||
| 221 | <activity | 231 | <activity |
| 222 | android:name="com.cnlive.moudle.collectionTrace.ui.activity.CollPedometerMainActivity" | 232 | android:name="com.cnlive.moudle.collectionTrace.ui.activity.CollPedometerMainActivity" |
| 223 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" | 233 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" |
| 234 | + android:launchMode="singleTask" | ||
| 224 | android:screenOrientation="portrait" /> | 235 | android:screenOrientation="portrait" /> |
| 225 | <activity | 236 | <activity |
| 226 | android:name="com.cnlive.moudle.collectionTrace.ui.activity.CollRunningFinishActivity" | 237 | android:name="com.cnlive.moudle.collectionTrace.ui.activity.CollRunningFinishActivity" |
| 227 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" | 238 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" |
| 239 | + android:launchMode="singleTask" | ||
| 228 | android:screenOrientation="portrait" /> <!-- android:theme="@style/Theme.AppCompat.Light.NoActionBar" --> | 240 | android:screenOrientation="portrait" /> <!-- android:theme="@style/Theme.AppCompat.Light.NoActionBar" --> |
| 229 | <activity | 241 | <activity |
| 230 | android:name="com.cnlive.moudle.collectionTrace.ui.activity.CollRunningMapActivity" | 242 | android:name="com.cnlive.moudle.collectionTrace.ui.activity.CollRunningMapActivity" |
| 231 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" | 243 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" |
| 244 | + android:launchMode="singleTask" | ||
| 232 | android:screenOrientation="portrait" /> | 245 | android:screenOrientation="portrait" /> |
| 233 | <activity | 246 | <activity |
| 234 | android:name="com.cnlive.moudle.collectionTrace.ui.activity.CollRunRaceDetailActivity" | 247 | android:name="com.cnlive.moudle.collectionTrace.ui.activity.CollRunRaceDetailActivity" |
| 235 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" | 248 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" |
| 249 | + android:launchMode="singleTask" | ||
| 236 | android:screenOrientation="portrait" /> | 250 | android:screenOrientation="portrait" /> |
| 237 | <activity | 251 | <activity |
| 238 | android:name="com.cnlive.moudle.collectionTrace.ui.activity.StartCollectTraceActivity" | 252 | android:name="com.cnlive.moudle.collectionTrace.ui.activity.StartCollectTraceActivity" |
| 239 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" | 253 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" |
| 254 | + android:launchMode="singleTask" | ||
| 240 | android:screenOrientation="portrait" /> | 255 | android:screenOrientation="portrait" /> |
| 241 | </application> | 256 | </application> |
| 242 | 257 |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/presenter/CollRunningFinishFragmetPresenter.java
| @@ -16,6 +16,8 @@ import com.cnlive.moudle.collectionTrace.frame.view.CollRunningFinishFragmentVie | @@ -16,6 +16,8 @@ import com.cnlive.moudle.collectionTrace.frame.view.CollRunningFinishFragmentVie | ||
| 16 | import com.cnlive.moudle.collectionTrace.model.CollectPoint; | 16 | import com.cnlive.moudle.collectionTrace.model.CollectPoint; |
| 17 | import com.cnlive.moudle.collectionTrace.utils.CollStepUtil; | 17 | import com.cnlive.moudle.collectionTrace.utils.CollStepUtil; |
| 18 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | 18 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 19 | +import com.cnlive.moudle.pedometer.model.Constant; | ||
| 20 | +import com.cnlive.moudle.pedometer.model.MessageEvent; | ||
| 19 | import com.cnlive.moudle.pedometer.net.ApiServiceRunLin; | 21 | import com.cnlive.moudle.pedometer.net.ApiServiceRunLin; |
| 20 | import com.cnlive.moudle.pedometer.net.SubscriptionRequest; | 22 | import com.cnlive.moudle.pedometer.net.SubscriptionRequest; |
| 21 | import com.cnlive.moudle.pedometer.net.bean.BaseInfo; | 23 | import com.cnlive.moudle.pedometer.net.bean.BaseInfo; |
| @@ -30,6 +32,8 @@ import com.cnlive.moudle.pedometer.utils.StepUtil; | @@ -30,6 +32,8 @@ import com.cnlive.moudle.pedometer.utils.StepUtil; | ||
| 30 | import com.example.moudle_pedometer.R; | 32 | import com.example.moudle_pedometer.R; |
| 31 | import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; | 33 | import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; |
| 32 | 34 | ||
| 35 | +import org.greenrobot.eventbus.EventBus; | ||
| 36 | + | ||
| 33 | import java.util.HashMap; | 37 | import java.util.HashMap; |
| 34 | import java.util.List; | 38 | import java.util.List; |
| 35 | import java.util.Map; | 39 | import java.util.Map; |
| @@ -39,6 +43,9 @@ import io.reactivex.disposables.Disposable; | @@ -39,6 +43,9 @@ import io.reactivex.disposables.Disposable; | ||
| 39 | public class CollRunningFinishFragmetPresenter extends MvpBasePresenter<CollRunningFinishFragmentView> { | 43 | public class CollRunningFinishFragmetPresenter extends MvpBasePresenter<CollRunningFinishFragmentView> { |
| 40 | 44 | ||
| 41 | public void uploadTraceDateToServer(Activity context, CollUserStepEntity userStepEntity, String roadmap) { | 45 | public void uploadTraceDateToServer(Activity context, CollUserStepEntity userStepEntity, String roadmap) { |
| 46 | + if (null != getView()) { | ||
| 47 | + getView().limitUploadBtnTouch(); | ||
| 48 | + } | ||
| 42 | QMUITipDialogUtil.loadingDialog(context, "正在上传数据", false); | 49 | QMUITipDialogUtil.loadingDialog(context, "正在上传数据", false); |
| 43 | Map<String, String> paramsMap = new HashMap<>(); | 50 | Map<String, String> paramsMap = new HashMap<>(); |
| 44 | //赛事id | 51 | //赛事id |
| @@ -84,10 +91,10 @@ public class CollRunningFinishFragmetPresenter extends MvpBasePresenter<CollRunn | @@ -84,10 +91,10 @@ public class CollRunningFinishFragmetPresenter extends MvpBasePresenter<CollRunn | ||
| 84 | if (!TextUtils.isEmpty(userStepEntity.getStepCount())) { | 91 | if (!TextUtils.isEmpty(userStepEntity.getStepCount())) { |
| 85 | double mileage = CollStepUtil.getWalkDistanceKM(Long.parseLong(userStepEntity.getStepCount())); | 92 | double mileage = CollStepUtil.getWalkDistanceKM(Long.parseLong(userStepEntity.getStepCount())); |
| 86 | paramsMap.put("mileage", mileage + ""); | 93 | paramsMap.put("mileage", mileage + ""); |
| 87 | - if (0==mileage){ | 94 | + if (0 == mileage) { |
| 88 | paramsMap.put("mileage", "0"); | 95 | paramsMap.put("mileage", "0"); |
| 89 | } | 96 | } |
| 90 | - }else { | 97 | + } else { |
| 91 | paramsMap.put("mileage", "0"); | 98 | paramsMap.put("mileage", "0"); |
| 92 | } | 99 | } |
| 93 | //开始时间 | 100 | //开始时间 |
| @@ -113,6 +120,9 @@ public class CollRunningFinishFragmetPresenter extends MvpBasePresenter<CollRunn | @@ -113,6 +120,9 @@ public class CollRunningFinishFragmetPresenter extends MvpBasePresenter<CollRunn | ||
| 113 | if (getView() == null) { | 120 | if (getView() == null) { |
| 114 | return; | 121 | return; |
| 115 | } | 122 | } |
| 123 | + if (null != getView()) { | ||
| 124 | + getView().allowUploadBtnTouch(); | ||
| 125 | + } | ||
| 116 | QMUITipDialogUtil.dismessDialog(); | 126 | QMUITipDialogUtil.dismessDialog(); |
| 117 | SelectDialog selectDialog = new SelectDialog(context, "数据上传失败,是否重试?", "取消", new SelectDialog.DialogInterface() { | 127 | SelectDialog selectDialog = new SelectDialog(context, "数据上传失败,是否重试?", "取消", new SelectDialog.DialogInterface() { |
| 118 | @Override | 128 | @Override |
| @@ -138,6 +148,7 @@ public class CollRunningFinishFragmetPresenter extends MvpBasePresenter<CollRunn | @@ -138,6 +148,7 @@ public class CollRunningFinishFragmetPresenter extends MvpBasePresenter<CollRunn | ||
| 138 | if (getView() == null) { | 148 | if (getView() == null) { |
| 139 | return; | 149 | return; |
| 140 | } | 150 | } |
| 151 | + EventBus.getDefault().post(new MessageEvent(Constant.UPDATA_COLL_TRACE_LIST, "")); | ||
| 141 | QMUITipDialogUtil.dismessDialog(); | 152 | QMUITipDialogUtil.dismessDialog(); |
| 142 | QMUITipDialogUtil.successDialog(context, "数据上传成功", 1); | 153 | QMUITipDialogUtil.successDialog(context, "数据上传成功", 1); |
| 143 | //清空数据 | 154 | //清空数据 |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollRunRaceDetailFragmentView.java
| @@ -669,7 +669,7 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen | @@ -669,7 +669,7 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen | ||
| 669 | if (isFirstLoc) { | 669 | if (isFirstLoc) { |
| 670 | isFirstLoc = false; | 670 | isFirstLoc = false; |
| 671 | if (location.getRadius() > Constant.LOCA_ACCURACY) { | 671 | if (location.getRadius() > Constant.LOCA_ACCURACY) { |
| 672 | - Toast.makeText(getContext(), "当前定位精度为:" + location.getRadius() + "米,请您移动至空旷地带!", Toast.LENGTH_SHORT).show(); | 672 | + Toast.makeText(getContext(), "当前定位误差为:" + location.getRadius() + "米,请您移动至空旷地带!", Toast.LENGTH_SHORT).show(); |
| 673 | } | 673 | } |
| 674 | } else { | 674 | } else { |
| 675 | //过滤定位精度 | 675 | //过滤定位精度 |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollRunningFinishFragmentView.java
| @@ -2,27 +2,20 @@ package com.cnlive.moudle.collectionTrace.frame.view; | @@ -2,27 +2,20 @@ package com.cnlive.moudle.collectionTrace.frame.view; | ||
| 2 | 2 | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | import android.graphics.Bitmap; | 4 | import android.graphics.Bitmap; |
| 5 | -import android.graphics.BitmapFactory; | ||
| 6 | import android.os.Handler; | 5 | import android.os.Handler; |
| 7 | import android.support.v7.widget.LinearLayoutManager; | 6 | import android.support.v7.widget.LinearLayoutManager; |
| 8 | import android.text.TextUtils; | 7 | import android.text.TextUtils; |
| 9 | import android.util.Log; | 8 | import android.util.Log; |
| 10 | import android.view.MotionEvent; | 9 | import android.view.MotionEvent; |
| 11 | import android.view.View; | 10 | import android.view.View; |
| 12 | -import android.widget.Toast; | ||
| 13 | 11 | ||
| 14 | -import com.baidu.location.LocationClient; | ||
| 15 | -import com.baidu.location.LocationClientOption; | ||
| 16 | import com.baidu.mapapi.map.BaiduMap; | 12 | import com.baidu.mapapi.map.BaiduMap; |
| 17 | -import com.baidu.mapapi.map.BitmapDescriptorFactory; | ||
| 18 | import com.baidu.mapapi.map.MapView; | 13 | import com.baidu.mapapi.map.MapView; |
| 19 | -import com.baidu.mapapi.map.MyLocationConfiguration; | ||
| 20 | import com.baidu.mapapi.map.Overlay; | 14 | import com.baidu.mapapi.map.Overlay; |
| 21 | import com.baidu.mapapi.map.UiSettings; | 15 | import com.baidu.mapapi.map.UiSettings; |
| 22 | import com.baidu.mapapi.model.LatLng; | 16 | import com.baidu.mapapi.model.LatLng; |
| 23 | import com.baidu.trace.LBSTraceClient; | 17 | import com.baidu.trace.LBSTraceClient; |
| 24 | import com.baidu.trace.api.fence.AddMonitoredPersonResponse; | 18 | import com.baidu.trace.api.fence.AddMonitoredPersonResponse; |
| 25 | -import com.baidu.trace.api.fence.CreateFenceRequest; | ||
| 26 | import com.baidu.trace.api.fence.CreateFenceResponse; | 19 | import com.baidu.trace.api.fence.CreateFenceResponse; |
| 27 | import com.baidu.trace.api.fence.DeleteFenceResponse; | 20 | import com.baidu.trace.api.fence.DeleteFenceResponse; |
| 28 | import com.baidu.trace.api.fence.DeleteMonitoredPersonResponse; | 21 | import com.baidu.trace.api.fence.DeleteMonitoredPersonResponse; |
| @@ -33,8 +26,8 @@ import com.baidu.trace.api.fence.MonitoredStatusByLocationResponse; | @@ -33,8 +26,8 @@ import com.baidu.trace.api.fence.MonitoredStatusByLocationResponse; | ||
| 33 | import com.baidu.trace.api.fence.MonitoredStatusResponse; | 26 | import com.baidu.trace.api.fence.MonitoredStatusResponse; |
| 34 | import com.baidu.trace.api.fence.OnFenceListener; | 27 | import com.baidu.trace.api.fence.OnFenceListener; |
| 35 | import com.baidu.trace.api.fence.UpdateFenceResponse; | 28 | import com.baidu.trace.api.fence.UpdateFenceResponse; |
| 36 | -import com.baidu.trace.model.CoordType; | ||
| 37 | import com.baidu.trace.model.SortType; | 29 | import com.baidu.trace.model.SortType; |
| 30 | +import com.bumptech.glide.Glide; | ||
| 38 | import com.cnlive.libs.base.logic.Event; | 31 | import com.cnlive.libs.base.logic.Event; |
| 39 | import com.cnlive.libs.base.logic.callback.FailureCallback; | 32 | import com.cnlive.libs.base.logic.callback.FailureCallback; |
| 40 | import com.cnlive.libs.base.logic.callback.SuccessCallback; | 33 | import com.cnlive.libs.base.logic.callback.SuccessCallback; |
| @@ -44,13 +37,9 @@ import com.cnlive.moudle.collectionTrace.ui.adapter.CollFinishDetaiAdapter; | @@ -44,13 +37,9 @@ import com.cnlive.moudle.collectionTrace.ui.adapter.CollFinishDetaiAdapter; | ||
| 44 | import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunningFinishFragment; | 37 | import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunningFinishFragment; |
| 45 | import com.cnlive.moudle.collectionTrace.utils.CollStepUtil; | 38 | import com.cnlive.moudle.collectionTrace.utils.CollStepUtil; |
| 46 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | 39 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 47 | -import com.cnlive.moudle.pedometer.model.Constant; | ||
| 48 | -import com.cnlive.moudle.pedometer.model.RunningFinishBean; | ||
| 49 | import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity; | 40 | import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity; |
| 50 | -import com.cnlive.moudle.pedometer.ui.fragment.RunningFinishFragment; | ||
| 51 | import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; | 41 | import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; |
| 52 | import com.cnlive.moudle.pedometer.upload.UploadLogic; | 42 | import com.cnlive.moudle.pedometer.upload.UploadLogic; |
| 53 | -import com.cnlive.moudle.pedometer.utils.BitmapUtil; | ||
| 54 | import com.cnlive.moudle.pedometer.utils.GsonUtil; | 43 | import com.cnlive.moudle.pedometer.utils.GsonUtil; |
| 55 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; | 44 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; |
| 56 | import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil; | 45 | import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil; |
| @@ -59,7 +48,6 @@ import com.cnlive.moudle.pedometer.utils.TimeUtil; | @@ -59,7 +48,6 @@ import com.cnlive.moudle.pedometer.utils.TimeUtil; | ||
| 59 | import com.cnlive.strike.application.GlideApp; | 48 | import com.cnlive.strike.application.GlideApp; |
| 60 | import com.example.moudle_pedometer.R; | 49 | import com.example.moudle_pedometer.R; |
| 61 | import com.hannesdorfmann.mosby3.mvp.MvpView; | 50 | import com.hannesdorfmann.mosby3.mvp.MvpView; |
| 62 | -import com.qmuiteam.qmui.widget.dialog.QMUITipDialog; | ||
| 63 | import com.sothree.slidinguppanel.SlidingUpPanelLayout; | 51 | import com.sothree.slidinguppanel.SlidingUpPanelLayout; |
| 64 | 52 | ||
| 65 | import java.io.File; | 53 | import java.io.File; |
| @@ -134,6 +122,8 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | @@ -134,6 +122,8 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | ||
| 134 | String faceUrl = CommonInfo.getUserIcon(getContext()); | 122 | String faceUrl = CommonInfo.getUserIcon(getContext()); |
| 135 | if (!TextUtils.isEmpty(faceUrl)) { | 123 | if (!TextUtils.isEmpty(faceUrl)) { |
| 136 | GlideApp.with(getContext()).load(faceUrl).into(fragment.binding.includeFinishUserInfo.qmIvIcon); | 124 | GlideApp.with(getContext()).load(faceUrl).into(fragment.binding.includeFinishUserInfo.qmIvIcon); |
| 125 | + }else { | ||
| 126 | + GlideApp.with(getContext()).load(getContext().getResources().getString(R.string.default_face_url)).into(fragment.binding.includeFinishUserInfo.qmIvIcon); | ||
| 137 | } | 127 | } |
| 138 | //设置标题 | 128 | //设置标题 |
| 139 | if (!TextUtils.isEmpty(collUserStepEntity.getStreetTitle())) { | 129 | if (!TextUtils.isEmpty(collUserStepEntity.getStreetTitle())) { |
| @@ -184,6 +174,11 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | @@ -184,6 +174,11 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | ||
| 184 | fragment.binding.rlScrollViewStartBtn.setOnTouchListener(new View.OnTouchListener() { | 174 | fragment.binding.rlScrollViewStartBtn.setOnTouchListener(new View.OnTouchListener() { |
| 185 | @Override | 175 | @Override |
| 186 | public boolean onTouch(View view, MotionEvent motionEvent) { | 176 | public boolean onTouch(View view, MotionEvent motionEvent) { |
| 177 | + if (null != fragment.binding.rlScrollViewStartBtn.getTag()) { | ||
| 178 | + if ("1".equals(fragment.binding.rlScrollViewStartBtn.getTag())) { | ||
| 179 | + return false; | ||
| 180 | + } | ||
| 181 | + } | ||
| 187 | if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) { | 182 | if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) { |
| 188 | //判断是否成功查询到轨迹点 | 183 | //判断是否成功查询到轨迹点 |
| 189 | if (null == queryResultPoints) { | 184 | if (null == queryResultPoints) { |
| @@ -198,10 +193,14 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | @@ -198,10 +193,14 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | ||
| 198 | @Override | 193 | @Override |
| 199 | public void onClick(SelectDialog dialog) { | 194 | public void onClick(SelectDialog dialog) { |
| 200 | dialog.dismiss(); | 195 | dialog.dismiss(); |
| 196 | + //允许点击 | ||
| 197 | + allowUploadBtnTouch(); | ||
| 201 | } | 198 | } |
| 202 | }, "是", new SelectDialog.DialogInterface() { | 199 | }, "是", new SelectDialog.DialogInterface() { |
| 203 | @Override | 200 | @Override |
| 204 | public void onClick(SelectDialog dialog) { | 201 | public void onClick(SelectDialog dialog) { |
| 202 | + //不让点击上传轨迹按钮 | ||
| 203 | + limitUploadBtnTouch(); | ||
| 205 | if (null != allMapOverlays) { | 204 | if (null != allMapOverlays) { |
| 206 | for (Overlay overlay : allMapOverlays) { | 205 | for (Overlay overlay : allMapOverlays) { |
| 207 | overlay.remove(); | 206 | overlay.remove(); |
| @@ -223,7 +222,9 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | @@ -223,7 +222,9 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | ||
| 223 | }); | 222 | }); |
| 224 | selectDialog.setCanceledOnTouchOutside(false); | 223 | selectDialog.setCanceledOnTouchOutside(false); |
| 225 | selectDialog.setCancelable(false); | 224 | selectDialog.setCancelable(false); |
| 226 | - selectDialog.show(); | 225 | + if (!selectDialog.isShowing()) { |
| 226 | + selectDialog.show(); | ||
| 227 | + } | ||
| 227 | } | 228 | } |
| 228 | } | 229 | } |
| 229 | return false; | 230 | return false; |
| @@ -303,6 +304,20 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | @@ -303,6 +304,20 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | ||
| 303 | 304 | ||
| 304 | } | 305 | } |
| 305 | 306 | ||
| 307 | + /** | ||
| 308 | + * 屏蔽上传轨迹按钮 | ||
| 309 | + */ | ||
| 310 | + public void limitUploadBtnTouch() { | ||
| 311 | + fragment.binding.rlScrollViewStartBtn.setTag("1"); | ||
| 312 | + } | ||
| 313 | + | ||
| 314 | + /** | ||
| 315 | + * 允许上传轨迹按钮 | ||
| 316 | + */ | ||
| 317 | + public void allowUploadBtnTouch() { | ||
| 318 | + fragment.binding.rlScrollViewStartBtn.setTag("0"); | ||
| 319 | + } | ||
| 320 | + | ||
| 306 | private void queryWalkTrace(long startTime, long endTime) { | 321 | private void queryWalkTrace(long startTime, long endTime) { |
| 307 | MyMapUtil.queryHistoryTrace(getContext(), mClient, CommonInfo.getUserId(getContext()), startTime, endTime, new MyMapUtil.CallBack() { | 322 | MyMapUtil.queryHistoryTrace(getContext(), mClient, CommonInfo.getUserId(getContext()), startTime, endTime, new MyMapUtil.CallBack() { |
| 308 | @Override | 323 | @Override |
| @@ -339,6 +354,7 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | @@ -339,6 +354,7 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | ||
| 339 | } | 354 | } |
| 340 | 355 | ||
| 341 | private void getBaiDuSnap() { | 356 | private void getBaiDuSnap() { |
| 357 | + limitUploadBtnTouch(); | ||
| 342 | baiduMap.snapshot(new BaiduMap.SnapshotReadyCallback() { | 358 | baiduMap.snapshot(new BaiduMap.SnapshotReadyCallback() { |
| 343 | @Override | 359 | @Override |
| 344 | public void onSnapshotReady(Bitmap bitmap) { | 360 | public void onSnapshotReady(Bitmap bitmap) { |
| @@ -362,6 +378,8 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | @@ -362,6 +378,8 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | ||
| 362 | } catch (Exception e) { | 378 | } catch (Exception e) { |
| 363 | QMUITipDialogUtil.dismessDialog(); | 379 | QMUITipDialogUtil.dismessDialog(); |
| 364 | QMUITipDialogUtil.failedDialog(getContext(), "赛事图片截取失败,请重试", 2); | 380 | QMUITipDialogUtil.failedDialog(getContext(), "赛事图片截取失败,请重试", 2); |
| 381 | + //允许点击 | ||
| 382 | + allowUploadBtnTouch(); | ||
| 365 | e.printStackTrace(); | 383 | e.printStackTrace(); |
| 366 | } | 384 | } |
| 367 | } | 385 | } |
| @@ -374,6 +392,8 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | @@ -374,6 +392,8 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | ||
| 374 | * @param roadMapPath | 392 | * @param roadMapPath |
| 375 | */ | 393 | */ |
| 376 | private void uploadRoadMapPic(String roadMapPath) { | 394 | private void uploadRoadMapPic(String roadMapPath) { |
| 395 | + //禁止点击 | ||
| 396 | + limitUploadBtnTouch(); | ||
| 377 | if (!TextUtils.isEmpty(roadMapPath)) { | 397 | if (!TextUtils.isEmpty(roadMapPath)) { |
| 378 | QMUITipDialogUtil.loadingDialog(getContext(), "正在上传赛事图片,请稍后", false); | 398 | QMUITipDialogUtil.loadingDialog(getContext(), "正在上传赛事图片,请稍后", false); |
| 379 | List<String> imagePaths = new ArrayList<>(); | 399 | List<String> imagePaths = new ArrayList<>(); |
| @@ -387,6 +407,8 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | @@ -387,6 +407,8 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | ||
| 387 | @Override | 407 | @Override |
| 388 | public void onClick(SelectDialog dialog) { | 408 | public void onClick(SelectDialog dialog) { |
| 389 | dialog.dismiss(); | 409 | dialog.dismiss(); |
| 410 | + //允许点击 | ||
| 411 | + allowUploadBtnTouch(); | ||
| 390 | } | 412 | } |
| 391 | }, "重试", new SelectDialog.DialogInterface() { | 413 | }, "重试", new SelectDialog.DialogInterface() { |
| 392 | @Override | 414 | @Override |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollRunningMapFragmentView.java
| @@ -52,6 +52,7 @@ import com.cnlive.moudle.pedometer.utils.ButtonAnimUtil; | @@ -52,6 +52,7 @@ import com.cnlive.moudle.pedometer.utils.ButtonAnimUtil; | ||
| 52 | import com.cnlive.moudle.collectionTrace.utils.CollStepUtil; | 52 | import com.cnlive.moudle.collectionTrace.utils.CollStepUtil; |
| 53 | import com.cnlive.moudle.pedometer.utils.GsonUtil; | 53 | import com.cnlive.moudle.pedometer.utils.GsonUtil; |
| 54 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; | 54 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; |
| 55 | +import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil; | ||
| 55 | import com.cnlive.moudle.pedometer.utils.TimeUtil; | 56 | import com.cnlive.moudle.pedometer.utils.TimeUtil; |
| 56 | import com.example.moudle_pedometer.R; | 57 | import com.example.moudle_pedometer.R; |
| 57 | import com.hannesdorfmann.mosby3.mvp.MvpView; | 58 | import com.hannesdorfmann.mosby3.mvp.MvpView; |
| @@ -258,15 +259,36 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | @@ -258,15 +259,36 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | ||
| 258 | //更新可打点数量 | 259 | //更新可打点数量 |
| 259 | int remainNum = updataCanTakePointCount(); | 260 | int remainNum = updataCanTakePointCount(); |
| 260 | if (remainNum != 0) { | 261 | if (remainNum != 0) { |
| 262 | +// if (null != followMyLocation) { | ||
| 263 | +// currentImportLatLng = new LatLng(followMyLocation.latitude, followMyLocation.longitude); | ||
| 264 | +// } | ||
| 265 | +// //获取当前地点 | ||
| 266 | +// if (!TextUtils.isEmpty(currentAddress)) { | ||
| 267 | +// selectDialog.setTipMessage("确定在" + "\"" + currentAddress + "\"" + "打点?"); | ||
| 268 | +// selectDialog.show(); | ||
| 269 | +// } else { | ||
| 270 | +// isShowFollowAddress = true; | ||
| 271 | +// Toast.makeText(getContext(), "正在获取当前地点信息,请稍后", Toast.LENGTH_SHORT).show(); | ||
| 272 | +// } | ||
| 273 | + | ||
| 261 | if (null != followMyLocation) { | 274 | if (null != followMyLocation) { |
| 262 | currentImportLatLng = new LatLng(followMyLocation.latitude, followMyLocation.longitude); | 275 | currentImportLatLng = new LatLng(followMyLocation.latitude, followMyLocation.longitude); |
| 263 | - } | ||
| 264 | - //获取当前地点 | ||
| 265 | - if (!TextUtils.isEmpty(currentAddress)) { | ||
| 266 | - selectDialog.setTipMessage("确定在" + "\"" + currentAddress + "\"" + "打点?"); | ||
| 267 | - selectDialog.show(); | 276 | + QMUITipDialogUtil.loadingDialog(getContext(), "正在获取位置信息...", false); |
| 277 | + MyMapUtil.getGeoCoderResult(new LatLng(followMyLocation.latitude, followMyLocation.longitude), new MyMapUtil.GeoCodeResult() { | ||
| 278 | + @Override | ||
| 279 | + public void success(String address) { | ||
| 280 | + if (null == getContext()) { | ||
| 281 | + return; | ||
| 282 | + } | ||
| 283 | + QMUITipDialogUtil.dismessDialog(); | ||
| 284 | + if (null != address && !TextUtils.isEmpty(address)) { | ||
| 285 | + currentAddress = address; | ||
| 286 | + selectDialog.setTipMessage("确定在" + "\"" + currentAddress + "\"" + "打点?"); | ||
| 287 | + selectDialog.show(); | ||
| 288 | + } | ||
| 289 | + } | ||
| 290 | + }); | ||
| 268 | } else { | 291 | } else { |
| 269 | - isShowFollowAddress = true; | ||
| 270 | Toast.makeText(getContext(), "正在获取当前地点信息,请稍后", Toast.LENGTH_SHORT).show(); | 292 | Toast.makeText(getContext(), "正在获取当前地点信息,请稍后", Toast.LENGTH_SHORT).show(); |
| 271 | } | 293 | } |
| 272 | } else { | 294 | } else { |
| @@ -286,14 +308,29 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | @@ -286,14 +308,29 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | ||
| 286 | } else { | 308 | } else { |
| 287 | if (null != followMyLocation) { | 309 | if (null != followMyLocation) { |
| 288 | currentImportLatLng = new LatLng(followMyLocation.latitude, followMyLocation.longitude); | 310 | currentImportLatLng = new LatLng(followMyLocation.latitude, followMyLocation.longitude); |
| 289 | - //获取当前地点 | ||
| 290 | - if (!TextUtils.isEmpty(currentAddress)) { | ||
| 291 | - endSelectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设为结束地点?"); | ||
| 292 | - endSelectDialog.show(); | ||
| 293 | - } else { | ||
| 294 | - isShowEndFollowAddress = true; | ||
| 295 | - Toast.makeText(getContext(), "正在获取当前地点信息,请稍后", Toast.LENGTH_SHORT).show(); | ||
| 296 | - } | 311 | +// //获取当前地点 |
| 312 | +// if (!TextUtils.isEmpty(currentAddress)) { | ||
| 313 | +// endSelectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设为结束地点?"); | ||
| 314 | +// endSelectDialog.show(); | ||
| 315 | +// } else { | ||
| 316 | +// isShowEndFollowAddress = true; | ||
| 317 | +// Toast.makeText(getContext(), "正在获取当前地点信息,请稍后", Toast.LENGTH_SHORT).show(); | ||
| 318 | +// } | ||
| 319 | + QMUITipDialogUtil.loadingDialog(getContext(), "正在获取位置信息...", false); | ||
| 320 | + MyMapUtil.getGeoCoderResult(new LatLng(followMyLocation.latitude, followMyLocation.longitude), new MyMapUtil.GeoCodeResult() { | ||
| 321 | + @Override | ||
| 322 | + public void success(String address) { | ||
| 323 | + if (null == getContext()) { | ||
| 324 | + return; | ||
| 325 | + } | ||
| 326 | + QMUITipDialogUtil.dismessDialog(); | ||
| 327 | + if (null != address && !TextUtils.isEmpty(address)) { | ||
| 328 | + currentAddress = address; | ||
| 329 | + endSelectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设为结束地点?"); | ||
| 330 | + endSelectDialog.show(); | ||
| 331 | + } | ||
| 332 | + } | ||
| 333 | + }); | ||
| 297 | } else { | 334 | } else { |
| 298 | isShowEndFollowAddress = true; | 335 | isShowEndFollowAddress = true; |
| 299 | Toast.makeText(getContext(), "正在获取当前地点信息,请稍后", Toast.LENGTH_SHORT).show(); | 336 | Toast.makeText(getContext(), "正在获取当前地点信息,请稍后", Toast.LENGTH_SHORT).show(); |
| @@ -497,7 +534,6 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | @@ -497,7 +534,6 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | ||
| 497 | mLocClient = new LocationClient(getContext()); | 534 | mLocClient = new LocationClient(getContext()); |
| 498 | mLocClient.registerLocationListener(myListener); | 535 | mLocClient.registerLocationListener(myListener); |
| 499 | LocationClientOption option = new LocationClientOption(); | 536 | LocationClientOption option = new LocationClientOption(); |
| 500 | - option.setOpenGps(true); // 打开gps | ||
| 501 | //可选,设置返回经纬度坐标类型,默认GCJ02 | 537 | //可选,设置返回经纬度坐标类型,默认GCJ02 |
| 502 | //GCJ02:国测局坐标; | 538 | //GCJ02:国测局坐标; |
| 503 | //BD09ll:百度经纬度坐标; | 539 | //BD09ll:百度经纬度坐标; |
| @@ -514,11 +550,11 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | @@ -514,11 +550,11 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | ||
| 514 | //LocationMode. Device_Sensors:仅使用设备; | 550 | //LocationMode. Device_Sensors:仅使用设备; |
| 515 | option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy); | 551 | option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy); |
| 516 | //可选,设置是否需要地址信息,默认不需要 | 552 | //可选,设置是否需要地址信息,默认不需要 |
| 517 | - option.setIsNeedAddress(true); | 553 | + option.setIsNeedAddress(false); |
| 518 | //可选,设置是否需要地址描述 | 554 | //可选,设置是否需要地址描述 |
| 519 | - option.setIsNeedLocationDescribe(true); | 555 | + option.setIsNeedLocationDescribe(false); |
| 520 | //需要POI信息 | 556 | //需要POI信息 |
| 521 | - option.setIsNeedLocationPoiList(true); | 557 | + option.setIsNeedLocationPoiList(false); |
| 522 | //可选,设置是否需要设备方向结果 | 558 | //可选,设置是否需要设备方向结果 |
| 523 | option.setNeedDeviceDirect(false); | 559 | option.setNeedDeviceDirect(false); |
| 524 | //设置打开自动回调位置模式,该开关打开后,期间只要定位SDK检测到位置变化就会主动回调给开发者 | 560 | //设置打开自动回调位置模式,该开关打开后,期间只要定位SDK检测到位置变化就会主动回调给开发者 |
| @@ -568,90 +604,6 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | @@ -568,90 +604,6 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | ||
| 568 | return; | 604 | return; |
| 569 | } | 605 | } |
| 570 | 606 | ||
| 571 | -// if (followMyLocation == null || followMyLocation.latitude == 0 || followMyLocation.longitude == 0) { | ||
| 572 | -// return; | ||
| 573 | -// } | ||
| 574 | - MapStatus.Builder builder = new MapStatus.Builder(); | ||
| 575 | - //第一次定位 | ||
| 576 | - if (isFirstLoc) { | ||
| 577 | - isFirstLoc = false; | ||
| 578 | - mCurrentAccracy = location.getRadius(); | ||
| 579 | - followMyLocation = new MyLocationData.Builder() | ||
| 580 | - .accuracy(location.getRadius()) | ||
| 581 | - // 此处设置开发者获取到的方向信息,顺时针0-360 | ||
| 582 | - .direction(mCurrentDirection).latitude(location.getLatitude()) | ||
| 583 | - .longitude(location.getLongitude()).build(); | ||
| 584 | - | ||
| 585 | - baiduMap.setMyLocationData(followMyLocation); | ||
| 586 | - builder.target(new LatLng(followMyLocation.latitude, followMyLocation.longitude)).zoom(DEFULT_ZOOM); | ||
| 587 | - baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build())); | ||
| 588 | - } else { | ||
| 589 | - //不是第一次定位状态 | ||
| 590 | - //过滤定位精度 | ||
| 591 | - if (location.getRadius() > Constant.LOCA_ACCURACY) { | ||
| 592 | - return; | ||
| 593 | - } | ||
| 594 | - mCurrentAccracy = location.getRadius(); | ||
| 595 | - followMyLocation = new MyLocationData.Builder() | ||
| 596 | - .accuracy(location.getRadius()) | ||
| 597 | - // 此处设置开发者获取到的方向信息,顺时针0-360 | ||
| 598 | - .direction(mCurrentDirection).latitude(location.getLatitude()) | ||
| 599 | - .longitude(location.getLongitude()).build(); | ||
| 600 | - if (null != currentWalkPoints && currentWalkPoints.size() > 0) { | ||
| 601 | - //进行判断 | ||
| 602 | - LatLng lastLatLng = currentWalkPoints.get(currentWalkPoints.size() - 1); | ||
| 603 | - LatLng curLatLng = new LatLng(location.getLatitude(), | ||
| 604 | - location.getLongitude()); | ||
| 605 | - if (DistanceUtil.getDistance(lastLatLng, curLatLng) > 0.5) { | ||
| 606 | - currentWalkPoints.add(curLatLng); | ||
| 607 | - } | ||
| 608 | - } else { | ||
| 609 | - currentWalkPoints.add(new LatLng(location.getLatitude(), | ||
| 610 | - location.getLongitude())); | ||
| 611 | - } | ||
| 612 | - | ||
| 613 | - //判断当前集合列表是否可以划线(至少两个点) | ||
| 614 | - if (currentWalkPoints != null && currentWalkPoints.size() > 1) { | ||
| 615 | - //判断当前是否已经在地图上画点 | ||
| 616 | - if (currentLine != null) { | ||
| 617 | - currentLine.remove(); | ||
| 618 | - } | ||
| 619 | - currentLine = MyMapUtil.drawMapLine(getContext(), baiduMap, currentWalkPoints, R.color.green_round); | ||
| 620 | - } | ||
| 621 | - } | ||
| 622 | - if (null != location.getPoiList() && null != location.getPoiList().get(0)) { | ||
| 623 | - currentAddress = location.getPoiList().get(0).getName(); | ||
| 624 | - } | ||
| 625 | - if (TextUtils.isEmpty(currentAddress)) { | ||
| 626 | - if (null != location.getAddress()) { | ||
| 627 | - currentAddress = location.getAddress().address; | ||
| 628 | - } | ||
| 629 | - } | ||
| 630 | - | ||
| 631 | - if (isShowFollowAddress && !TextUtils.isEmpty(currentAddress)) { | ||
| 632 | - if (isShowFollowAddress && selectDialog != null && !selectDialog.isShowing()) { | ||
| 633 | - if (!TextUtils.isEmpty(currentAddress)) { | ||
| 634 | - selectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设置开始地点?"); | ||
| 635 | - if (!selectDialog.isShowing()) { | ||
| 636 | - selectDialog.show(); | ||
| 637 | - } | ||
| 638 | - isShowFollowAddress = false; | ||
| 639 | - } | ||
| 640 | - } | ||
| 641 | - } | ||
| 642 | - //结束按钮 | ||
| 643 | - if (isShowEndFollowAddress && !TextUtils.isEmpty(currentAddress)) { | ||
| 644 | - if (isShowEndFollowAddress && endSelectDialog != null && !endSelectDialog.isShowing()) { | ||
| 645 | - if (!TextUtils.isEmpty(currentAddress)) { | ||
| 646 | - endSelectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设为结束地点?"); | ||
| 647 | - if (!endSelectDialog.isShowing()) { | ||
| 648 | - endSelectDialog.show(); | ||
| 649 | - } | ||
| 650 | - isShowEndFollowAddress = false; | ||
| 651 | - } | ||
| 652 | - } | ||
| 653 | - } | ||
| 654 | - | ||
| 655 | //正在搜索GPS信号 | 607 | //正在搜索GPS信号 |
| 656 | if (location.getGpsAccuracyStatus() == BDLocation.GPS_ACCURACY_UNKNOWN) { | 608 | if (location.getGpsAccuracyStatus() == BDLocation.GPS_ACCURACY_UNKNOWN) { |
| 657 | if (fragment.binding.tvGpsPopBg.getVisibility() != View.VISIBLE) { | 609 | if (fragment.binding.tvGpsPopBg.getVisibility() != View.VISIBLE) { |
| @@ -701,6 +653,88 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | @@ -701,6 +653,88 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | ||
| 701 | fragment.binding.ivGpsState.setBackground(getContext().getResources().getDrawable(R.drawable.rt_training_gps_3)); | 653 | fragment.binding.ivGpsState.setBackground(getContext().getResources().getDrawable(R.drawable.rt_training_gps_3)); |
| 702 | } | 654 | } |
| 703 | } | 655 | } |
| 656 | + if (followMyLocation == null || followMyLocation.latitude == 0 || followMyLocation.longitude == 0) { | ||
| 657 | + return; | ||
| 658 | + } | ||
| 659 | + MapStatus.Builder builder = new MapStatus.Builder(); | ||
| 660 | + mCurrentAccracy = location.getRadius(); | ||
| 661 | + followMyLocation = new MyLocationData.Builder() | ||
| 662 | + .accuracy(location.getRadius()) | ||
| 663 | + // 此处设置开发者获取到的方向信息,顺时针0-360 | ||
| 664 | + .direction(mCurrentDirection).latitude(location.getLatitude()) | ||
| 665 | + .longitude(location.getLongitude()).build(); | ||
| 666 | + //第一次定位 | ||
| 667 | + if (isFirstLoc) { | ||
| 668 | + isFirstLoc = false; | ||
| 669 | + baiduMap.setMyLocationData(followMyLocation); | ||
| 670 | + builder.target(new LatLng(followMyLocation.latitude, followMyLocation.longitude)).zoom(DEFULT_ZOOM); | ||
| 671 | + baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build())); | ||
| 672 | + } else { | ||
| 673 | + //不是第一次定位状态 | ||
| 674 | + //过滤定位精度 | ||
| 675 | + if (location.getRadius() > Constant.LOCA_ACCURACY) { | ||
| 676 | + return; | ||
| 677 | + } | ||
| 678 | + if (null != currentWalkPoints) { | ||
| 679 | + if (currentWalkPoints.size() > 0) { | ||
| 680 | + //进行判断 | ||
| 681 | + LatLng lastLatLng = currentWalkPoints.get(currentWalkPoints.size() - 1); | ||
| 682 | + LatLng curLatLng = new LatLng(location.getLatitude(), | ||
| 683 | + location.getLongitude()); | ||
| 684 | + if (DistanceUtil.getDistance(lastLatLng, curLatLng) > 0.5) { | ||
| 685 | + currentWalkPoints.add(curLatLng); | ||
| 686 | + } | ||
| 687 | + } | ||
| 688 | + } else { | ||
| 689 | + currentWalkPoints.add(new LatLng(location.getLatitude(), | ||
| 690 | + location.getLongitude())); | ||
| 691 | + } | ||
| 692 | + | ||
| 693 | + //判断当前集合列表是否可以划线(至少两个点) | ||
| 694 | + if (currentWalkPoints != null && currentWalkPoints.size() > 1) { | ||
| 695 | + //判断当前是否已经在地图上画点 | ||
| 696 | + if (currentLine != null) { | ||
| 697 | + currentLine.remove(); | ||
| 698 | + } | ||
| 699 | + currentLine = MyMapUtil.drawMapLine(getContext(), baiduMap, currentWalkPoints, R.color.green_round); | ||
| 700 | + } | ||
| 701 | + } | ||
| 702 | +// if (location.hasAddr()) { | ||
| 703 | +// if (!TextUtils.isEmpty(location.getAddress().address)) { | ||
| 704 | +// currentAddress = location.getAddress().address; | ||
| 705 | +// } | ||
| 706 | +// } | ||
| 707 | +// if (TextUtils.isEmpty(currentAddress)) { | ||
| 708 | +// if (null != location.getAddress()) { | ||
| 709 | +// currentAddress = location.getAddress().address; | ||
| 710 | +// } | ||
| 711 | +// } | ||
| 712 | +// | ||
| 713 | +// if (isShowFollowAddress && !TextUtils.isEmpty(currentAddress)) { | ||
| 714 | +// if (isShowFollowAddress && selectDialog != null && !selectDialog.isShowing()) { | ||
| 715 | +// if (!TextUtils.isEmpty(currentAddress)) { | ||
| 716 | +// selectDialog.setTipMessage("确定在" + "\"" + currentAddress + "\"" + "打点?"); | ||
| 717 | +// if (!selectDialog.isShowing()) { | ||
| 718 | +// selectDialog.show(); | ||
| 719 | +// } | ||
| 720 | +// isShowFollowAddress = false; | ||
| 721 | +// } | ||
| 722 | +// } | ||
| 723 | +// } | ||
| 724 | +// //结束按钮 | ||
| 725 | +// if (isShowEndFollowAddress && !TextUtils.isEmpty(currentAddress)) { | ||
| 726 | +// if (isShowEndFollowAddress && endSelectDialog != null && !endSelectDialog.isShowing()) { | ||
| 727 | +// if (!TextUtils.isEmpty(currentAddress)) { | ||
| 728 | +// endSelectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设为结束地点?"); | ||
| 729 | +// if (!endSelectDialog.isShowing()) { | ||
| 730 | +// endSelectDialog.show(); | ||
| 731 | +// } | ||
| 732 | +// isShowEndFollowAddress = false; | ||
| 733 | +// } | ||
| 734 | +// } | ||
| 735 | +// } | ||
| 736 | + | ||
| 737 | + | ||
| 704 | } | 738 | } |
| 705 | 739 | ||
| 706 | 740 |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollTraceListDetailFragmentView.java
| @@ -197,6 +197,44 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | @@ -197,6 +197,44 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | ||
| 197 | allCollectPoints = GsonUtil.jsonToList(eventShoeLinesBean.getLatLongitude(), CollectPoint.class); | 197 | allCollectPoints = GsonUtil.jsonToList(eventShoeLinesBean.getLatLongitude(), CollectPoint.class); |
| 198 | 198 | ||
| 199 | } | 199 | } |
| 200 | + //设置起点终点 | ||
| 201 | + CollectPoint startLocation = null; | ||
| 202 | + if (!TextUtils.isEmpty(eventShoeLinesBean.getStartLocation())) { | ||
| 203 | + startLocation = new CollectPoint(); | ||
| 204 | + startLocation.setPointName(eventShoeLinesBean.getStartLocation()); | ||
| 205 | + startLocation.setLatitude(0); | ||
| 206 | + startLocation.setLongitude(0); | ||
| 207 | + }else { | ||
| 208 | + startLocation = new CollectPoint(); | ||
| 209 | + startLocation.setPointName(""); | ||
| 210 | + startLocation.setLatitude(0); | ||
| 211 | + startLocation.setLongitude(0); | ||
| 212 | + } | ||
| 213 | + //设置终点 | ||
| 214 | + CollectPoint endLocation = null; | ||
| 215 | + if (!TextUtils.isEmpty(eventShoeLinesBean.getEndLocation())) { | ||
| 216 | + endLocation = new CollectPoint(); | ||
| 217 | + endLocation.setPointName(eventShoeLinesBean.getEndLocation()); | ||
| 218 | + endLocation.setLatitude(0); | ||
| 219 | + endLocation.setLongitude(0); | ||
| 220 | + }else { | ||
| 221 | + endLocation = new CollectPoint(); | ||
| 222 | + endLocation.setPointName(""); | ||
| 223 | + endLocation.setLatitude(0); | ||
| 224 | + endLocation.setLongitude(0); | ||
| 225 | + } | ||
| 226 | + if (null != startLocation) { | ||
| 227 | + if (null == allCollectPoints) { | ||
| 228 | + allCollectPoints = new ArrayList<>(); | ||
| 229 | + } | ||
| 230 | + allCollectPoints.add(0, startLocation); | ||
| 231 | + } | ||
| 232 | + if (null != endLocation) { | ||
| 233 | + if (null == allCollectPoints) { | ||
| 234 | + allCollectPoints = new ArrayList<>(); | ||
| 235 | + } | ||
| 236 | + allCollectPoints.add(endLocation); | ||
| 237 | + } | ||
| 200 | //设置打点liebiao | 238 | //设置打点liebiao |
| 201 | if (null != allCollectPoints && allCollectPoints.size() > 1) { | 239 | if (null != allCollectPoints && allCollectPoints.size() > 1) { |
| 202 | //设置适配器 | 240 | //设置适配器 |
| @@ -208,13 +246,15 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | @@ -208,13 +246,15 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | ||
| 208 | } | 246 | } |
| 209 | 247 | ||
| 210 | 248 | ||
| 211 | - //设置用户头像 | 249 | + //设置用户昵称 |
| 212 | if (!TextUtils.isEmpty(eventShoeLinesBean.getUserMsg().getNickName())) { | 250 | if (!TextUtils.isEmpty(eventShoeLinesBean.getUserMsg().getNickName())) { |
| 213 | fragment.binding.includeFinishUserInfo.tvUserNickName.setText(eventShoeLinesBean.getUserMsg().getNickName()); | 251 | fragment.binding.includeFinishUserInfo.tvUserNickName.setText(eventShoeLinesBean.getUserMsg().getNickName()); |
| 214 | } | 252 | } |
| 215 | //设置用户头像 | 253 | //设置用户头像 |
| 216 | if (!TextUtils.isEmpty(eventShoeLinesBean.getUserMsg().getImage())) { | 254 | if (!TextUtils.isEmpty(eventShoeLinesBean.getUserMsg().getImage())) { |
| 217 | - Glide.with(getContext()).load(eventShoeLinesBean.getUserMsg().getImage()).into(fragment.binding.includeFinishUserInfo.qmIvIcon); | 255 | + GlideApp.with(getContext()).load(eventShoeLinesBean.getUserMsg().getImage()).into(fragment.binding.includeFinishUserInfo.qmIvIcon); |
| 256 | + }else { | ||
| 257 | + GlideApp.with(getContext()).load(getContext().getResources().getString(R.string.default_face_url)).into(fragment.binding.includeFinishUserInfo.qmIvIcon); | ||
| 218 | } | 258 | } |
| 219 | //设置用户行走公里 | 259 | //设置用户行走公里 |
| 220 | if (!TextUtils.isEmpty(eventShoeLinesBean.getMileage())) { | 260 | if (!TextUtils.isEmpty(eventShoeLinesBean.getMileage())) { |
| @@ -246,15 +286,11 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | @@ -246,15 +286,11 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | ||
| 246 | } | 286 | } |
| 247 | if (resultPoints.size() > 1) { | 287 | if (resultPoints.size() > 1) { |
| 248 | MyMapUtil.drawHistoryTrack(getContext(), baiduMap, resultPoints, SortType.asc, R.color.green_round, R.drawable.icon_start, R.drawable.icon_end); | 288 | MyMapUtil.drawHistoryTrack(getContext(), baiduMap, resultPoints, SortType.asc, R.color.green_round, R.drawable.icon_start, R.drawable.icon_end); |
| 249 | - MyMapUtil.setMapAutoZoom(baiduMap, resultPoints, -1.5f); | 289 | + MyMapUtil.setMapAutoZoom(baiduMap, resultPoints, -0.5f); |
| 250 | 290 | ||
| 251 | 291 | ||
| 252 | //获取打点不为空 | 292 | //获取打点不为空 |
| 253 | - if (null != finalResultCollectPoints && finalResultCollectPoints.size() > 1) { | ||
| 254 | - //移除起点 | ||
| 255 | - finalResultCollectPoints.remove(0); | ||
| 256 | - //移除终点 | ||
| 257 | - finalResultCollectPoints.remove(finalResultCollectPoints.size() - 1); | 293 | + if (null != finalResultCollectPoints && finalResultCollectPoints.size() > 0) { |
| 258 | //开始在地图上绘制打点信息 | 294 | //开始在地图上绘制打点信息 |
| 259 | for (int i = 0; i < finalResultCollectPoints.size(); i++) { | 295 | for (int i = 0; i < finalResultCollectPoints.size(); i++) { |
| 260 | LatLng latLng = new LatLng(finalResultCollectPoints.get(i).getLatitude(), finalResultCollectPoints.get(i).getLongitude()); | 296 | LatLng latLng = new LatLng(finalResultCollectPoints.get(i).getLatitude(), finalResultCollectPoints.get(i).getLongitude()); |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/RaceNameListView.java
| @@ -106,7 +106,7 @@ public class RaceNameListView implements MvpView, OnFenceListener { | @@ -106,7 +106,7 @@ public class RaceNameListView implements MvpView, OnFenceListener { | ||
| 106 | 106 | ||
| 107 | public void delectShoeLine(int position) { | 107 | public void delectShoeLine(int position) { |
| 108 | list.remove(position); | 108 | list.remove(position); |
| 109 | - if(list.size() == 0){ | 109 | + if (list.size() == 0) { |
| 110 | showEmpty(); | 110 | showEmpty(); |
| 111 | } | 111 | } |
| 112 | adapter.notifyDataSetChanged(); | 112 | adapter.notifyDataSetChanged(); |
| @@ -163,13 +163,13 @@ public class RaceNameListView implements MvpView, OnFenceListener { | @@ -163,13 +163,13 @@ public class RaceNameListView implements MvpView, OnFenceListener { | ||
| 163 | //先校验 | 163 | //先校验 |
| 164 | fragment.getPresenter().checkShoeLine(fragment.getActivity(), eventShoeLinesBean.getId(), eventShoeLinesBean.getEventId(), new RaceNameListPresenter.CallBack() { | 164 | fragment.getPresenter().checkShoeLine(fragment.getActivity(), eventShoeLinesBean.getId(), eventShoeLinesBean.getEventId(), new RaceNameListPresenter.CallBack() { |
| 165 | @Override | 165 | @Override |
| 166 | - public void onSuccess(String fenceId, String entityName,String isDelete) { | 166 | + public void onSuccess(String fenceId, String entityName, String isDelete) { |
| 167 | if (null == fragment.getActivity()) { | 167 | if (null == fragment.getActivity()) { |
| 168 | return; | 168 | return; |
| 169 | } | 169 | } |
| 170 | - if(isDelete != null && isDelete.equals("1")){ | 170 | + if (isDelete != null && isDelete.equals("1")) { |
| 171 | delectShoeLine(position); | 171 | delectShoeLine(position); |
| 172 | - AlertUtil.showLongToast(fragment.getActivity(),"该轨迹已被删除,不能进行绑定",2000); | 172 | + AlertUtil.showLongToast(fragment.getActivity(), "该轨迹已被删除,不能进行绑定", 2000); |
| 173 | return; | 173 | return; |
| 174 | } | 174 | } |
| 175 | //判断是否为空 | 175 | //判断是否为空 |
| @@ -333,11 +333,14 @@ public class RaceNameListView implements MvpView, OnFenceListener { | @@ -333,11 +333,14 @@ public class RaceNameListView implements MvpView, OnFenceListener { | ||
| 333 | if (5102 == createFenceResponse.getStatus()) { | 333 | if (5102 == createFenceResponse.getStatus()) { |
| 334 | QMUITipDialogUtil.dismessDialog(); | 334 | QMUITipDialogUtil.dismessDialog(); |
| 335 | QMUITipDialogUtil.failedDialog(fragment.getActivity(), createFenceResponse.getMessage(), 1); | 335 | QMUITipDialogUtil.failedDialog(fragment.getActivity(), createFenceResponse.getMessage(), 1); |
| 336 | - } else { | 336 | + } else if (0 == createFenceResponse.getStatus()) { |
| 337 | if (null != currentSelBean && -1 != currentSelPos) { | 337 | if (null != currentSelBean && -1 != currentSelPos) { |
| 338 | QMUITipDialogUtil.dismessDialog(); | 338 | QMUITipDialogUtil.dismessDialog(); |
| 339 | fragment.addShoeLine(currentSelBean, createFenceResponse.getFenceId() + "", currentSelPos); | 339 | fragment.addShoeLine(currentSelBean, createFenceResponse.getFenceId() + "", currentSelPos); |
| 340 | } | 340 | } |
| 341 | + }else { | ||
| 342 | + QMUITipDialogUtil.dismessDialog(); | ||
| 343 | + QMUITipDialogUtil.failedDialog(fragment.getActivity(), createFenceResponse.getMessage(), 1); | ||
| 341 | } | 344 | } |
| 342 | } | 345 | } |
| 343 | 346 |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/StartTraceFragmentView.java
| @@ -8,6 +8,7 @@ import android.hardware.Sensor; | @@ -8,6 +8,7 @@ import android.hardware.Sensor; | ||
| 8 | import android.hardware.SensorEvent; | 8 | import android.hardware.SensorEvent; |
| 9 | import android.hardware.SensorEventListener; | 9 | import android.hardware.SensorEventListener; |
| 10 | import android.hardware.SensorManager; | 10 | import android.hardware.SensorManager; |
| 11 | +import android.os.Build; | ||
| 11 | import android.support.v4.content.ContextCompat; | 12 | import android.support.v4.content.ContextCompat; |
| 12 | import android.text.TextUtils; | 13 | import android.text.TextUtils; |
| 13 | import android.util.Log; | 14 | import android.util.Log; |
| @@ -44,6 +45,7 @@ import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity; | @@ -44,6 +45,7 @@ import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity; | ||
| 44 | import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; | 45 | import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; |
| 45 | import com.cnlive.moudle.pedometer.utils.BitmapUtil; | 46 | import com.cnlive.moudle.pedometer.utils.BitmapUtil; |
| 46 | import com.cnlive.moudle.pedometer.utils.GsonUtil; | 47 | import com.cnlive.moudle.pedometer.utils.GsonUtil; |
| 48 | +import com.cnlive.moudle.pedometer.utils.MyMapUtil; | ||
| 47 | import com.cnlive.moudle.pedometer.utils.NetUtil; | 49 | import com.cnlive.moudle.pedometer.utils.NetUtil; |
| 48 | import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil; | 50 | import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil; |
| 49 | import com.cnlive.moudle.pedometer.utils.ServiceUtils; | 51 | import com.cnlive.moudle.pedometer.utils.ServiceUtils; |
| @@ -61,7 +63,7 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { | @@ -61,7 +63,7 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { | ||
| 61 | private BitmapDescriptor mCurrentMarker;//定位图标 | 63 | private BitmapDescriptor mCurrentMarker;//定位图标 |
| 62 | private static int accuracyCircleFillColor; | 64 | private static int accuracyCircleFillColor; |
| 63 | private static int accuracyCircleStrokeColor; | 65 | private static int accuracyCircleStrokeColor; |
| 64 | - private static MyLocationData followMyLocation; | 66 | + private MyLocationData followMyLocation; |
| 65 | private LatLng currentLatLng; | 67 | private LatLng currentLatLng; |
| 66 | private Double lastX = 0.0; | 68 | private Double lastX = 0.0; |
| 67 | private int mCurrentDirection = 0; | 69 | private int mCurrentDirection = 0; |
| @@ -75,6 +77,7 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { | @@ -75,6 +77,7 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { | ||
| 75 | private SelectDialog selectDialog; | 77 | private SelectDialog selectDialog; |
| 76 | private boolean isShowFollowAddress = false;//是否显示跟随地址 | 78 | private boolean isShowFollowAddress = false;//是否显示跟随地址 |
| 77 | public RunRaceDetailInfo runRaceDetailInfo; | 79 | public RunRaceDetailInfo runRaceDetailInfo; |
| 80 | + private boolean isFollowUserShow = true;//是否跟随用户视角 | ||
| 78 | 81 | ||
| 79 | public StartTraceFragmentView(StartTraceFragment fragment) { | 82 | public StartTraceFragmentView(StartTraceFragment fragment) { |
| 80 | this.fragment = fragment; | 83 | this.fragment = fragment; |
| @@ -117,17 +120,32 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { | @@ -117,17 +120,32 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { | ||
| 117 | fragment.binding.btnIdentify.setOnClickListener(new View.OnClickListener() { | 120 | fragment.binding.btnIdentify.setOnClickListener(new View.OnClickListener() { |
| 118 | @Override | 121 | @Override |
| 119 | public void onClick(View view) { | 122 | public void onClick(View view) { |
| 120 | -// if (!NetUtil.isNetworkConnected(getContext())) { | ||
| 121 | -// AlertUtil.showDeftToast(getContext(), "无法连接网络,请稍后重试"); | ||
| 122 | -// } else { | ||
| 123 | //获取当前地点 | 123 | //获取当前地点 |
| 124 | - if (!TextUtils.isEmpty(currentAddress)) { | ||
| 125 | - selectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设置开始地点?"); | ||
| 126 | - selectDialog.show(); | 124 | +// if (!TextUtils.isEmpty(currentAddress)) { |
| 125 | +// selectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设置开始地点?"); | ||
| 126 | +// selectDialog.show(); | ||
| 127 | +// } else { | ||
| 128 | +// isShowFollowAddress = true; | ||
| 129 | +// Toast.makeText(getContext(), "正在获取当前地点信息,请稍后", Toast.LENGTH_SHORT).show(); | ||
| 130 | +// } | ||
| 131 | + if (null != followMyLocation) { | ||
| 132 | + QMUITipDialogUtil.loadingDialog(getContext(), "正在获取位置信息...", false); | ||
| 133 | + MyMapUtil.getGeoCoderResult(new LatLng(followMyLocation.latitude, followMyLocation.longitude), new MyMapUtil.GeoCodeResult() { | ||
| 134 | + @Override | ||
| 135 | + public void success(String address) { | ||
| 136 | + QMUITipDialogUtil.dismessDialog(); | ||
| 137 | + if (null != address && !TextUtils.isEmpty(address)) { | ||
| 138 | + currentAddress = address; | ||
| 139 | + selectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设置开始地点?"); | ||
| 140 | + selectDialog.show(); | ||
| 141 | + } | ||
| 142 | + } | ||
| 143 | + }); | ||
| 127 | } else { | 144 | } else { |
| 128 | - isShowFollowAddress = true; | ||
| 129 | Toast.makeText(getContext(), "正在获取当前地点信息,请稍后", Toast.LENGTH_SHORT).show(); | 145 | Toast.makeText(getContext(), "正在获取当前地点信息,请稍后", Toast.LENGTH_SHORT).show(); |
| 130 | } | 146 | } |
| 147 | + | ||
| 148 | + | ||
| 131 | } | 149 | } |
| 132 | // } | 150 | // } |
| 133 | }); | 151 | }); |
| @@ -139,7 +157,7 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { | @@ -139,7 +157,7 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { | ||
| 139 | */ | 157 | */ |
| 140 | public void checkIsHasRunningRace() { | 158 | public void checkIsHasRunningRace() { |
| 141 | //先判断有没有数据 | 159 | //先判断有没有数据 |
| 142 | - CollUserStepEntity userStepEntity = CollStepUtil.getCollUserStepData(getContext(), CommonInfo.getUserId(getContext())); | 160 | + CollUserStepEntity userStepEntity = CollStepUtil.getCollUserStepData(getContext(), CollCommonInfo.getUserId(getContext())); |
| 143 | if (null != userStepEntity) { | 161 | if (null != userStepEntity) { |
| 144 | //判断用户是否点击wanc | 162 | //判断用户是否点击wanc |
| 145 | if (0 == userStepEntity.getFinishTimeStamp()) { | 163 | if (0 == userStepEntity.getFinishTimeStamp()) { |
| @@ -242,7 +260,11 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { | @@ -242,7 +260,11 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { | ||
| 242 | CollCommonInfo.setTsRunBaiduTraceService(context, true); | 260 | CollCommonInfo.setTsRunBaiduTraceService(context, true); |
| 243 | CollCommonInfo.setIsWriteUserStep(context, true); | 261 | CollCommonInfo.setIsWriteUserStep(context, true); |
| 244 | Intent intent = new Intent(fragment.getActivity(), CollKeepLiveService.class); | 262 | Intent intent = new Intent(fragment.getActivity(), CollKeepLiveService.class); |
| 245 | - ContextCompat.startForegroundService(fragment.getActivity(), intent); | 263 | + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { |
| 264 | + fragment.getActivity().startForegroundService(intent); | ||
| 265 | + } else { | ||
| 266 | + fragment.getActivity().startService(intent); | ||
| 267 | + } | ||
| 246 | 268 | ||
| 247 | } | 269 | } |
| 248 | 270 | ||
| @@ -272,8 +294,10 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { | @@ -272,8 +294,10 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { | ||
| 272 | } | 294 | } |
| 273 | 295 | ||
| 274 | private void stopStepService() { | 296 | private void stopStepService() { |
| 275 | - | ||
| 276 | - | 297 | + CollCommonInfo.setIsRunKeepAliveService(getContext(), false); |
| 298 | + CollCommonInfo.setIsRunStepService(getContext(), false); | ||
| 299 | + CollCommonInfo.setTsRunBaiduTraceService(getContext(), false); | ||
| 300 | + CollCommonInfo.setIsWriteUserStep(getContext(), false); | ||
| 277 | if (CollStepService.mClient != null) { | 301 | if (CollStepService.mClient != null) { |
| 278 | CollStepService.mClient.stopGather(CollStepService.traceListener); | 302 | CollStepService.mClient.stopGather(CollStepService.traceListener); |
| 279 | } | 303 | } |
| @@ -407,47 +431,45 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { | @@ -407,47 +431,45 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { | ||
| 407 | } | 431 | } |
| 408 | if (isFirstLoc) { | 432 | if (isFirstLoc) { |
| 409 | isFirstLoc = false; | 433 | isFirstLoc = false; |
| 410 | - Toast.makeText(getContext(), "当前定位精度为:" + location.getRadius() + "米,请您移动至空旷地带!", Toast.LENGTH_SHORT).show(); | ||
| 411 | - | 434 | + Toast.makeText(getContext(), "当前定位误差为:" + location.getRadius() + "米,请您移动至空旷地带!", Toast.LENGTH_SHORT).show(); |
| 435 | + //过滤定位精度 | ||
| 436 | + if (location.getRadius() > Constant.LOCA_ACCURACY) { | ||
| 437 | + return; | ||
| 438 | + } | ||
| 439 | + } else { | ||
| 440 | + //过滤定位精度 | ||
| 441 | + if (location.getRadius() > Constant.LOCA_ACCURACY) { | ||
| 442 | + return; | ||
| 443 | + } | ||
| 444 | + currentLatLng = new LatLng(location.getLatitude(), | ||
| 445 | + location.getLongitude()); | ||
| 446 | + followMyLocation = new MyLocationData.Builder() | ||
| 447 | + .accuracy(location.getRadius()) | ||
| 448 | + // 此处设置开发者获取到的方向信息,顺时针0-360 | ||
| 449 | + .direction(location.getDirection()).latitude(location.getLatitude()) | ||
| 450 | + .longitude(location.getLongitude()).build(); | ||
| 451 | + if (isFollowUserShow) { | ||
| 452 | + baiduMap.setMyLocationData(followMyLocation); | ||
| 453 | + MapStatus.Builder builder = new MapStatus.Builder(); | ||
| 454 | + builder.target(new LatLng(followMyLocation.latitude, followMyLocation.longitude)).zoom(DEFULT_ZOOM); | ||
| 455 | + baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build())); | ||
| 456 | + isFollowUserShow = false; | ||
| 457 | + } | ||
| 412 | } | 458 | } |
| 413 | -// if (location.getRadius() > Constant.LOCA_ACCURACY) { | ||
| 414 | -// Toast.makeText(getContext(), "当前定位精度为:" + location.getRadius() + "米,请您移动至空旷地带!", Toast.LENGTH_SHORT).show(); | 459 | +// if (location.hasAddr()) { |
| 460 | +// if (!TextUtils.isEmpty(location.getAddress().address)) { | ||
| 461 | +// currentAddress = location.getAddress().address; | ||
| 462 | +// } | ||
| 463 | +// } | ||
| 464 | +// if (isShowFollowAddress && selectDialog != null && !selectDialog.isShowing()) { | ||
| 465 | +// if (!TextUtils.isEmpty(currentAddress)) { | ||
| 466 | +// selectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设置开始地点?"); | ||
| 467 | +// if (!selectDialog.isShowing()) { | ||
| 468 | +// selectDialog.show(); | ||
| 469 | +// } | ||
| 415 | // } | 470 | // } |
| 416 | -// } else { | ||
| 417 | - //过滤定位精度 | ||
| 418 | - if (location.getRadius() > Constant.LOCA_ACCURACY) { | ||
| 419 | - return; | ||
| 420 | - } | ||
| 421 | // } | 471 | // } |
| 422 | - followMyLocation = new MyLocationData.Builder() | ||
| 423 | - .accuracy(location.getRadius()) | ||
| 424 | - // 此处设置开发者获取到的方向信息,顺时针0-360 | ||
| 425 | - .direction(location.getDirection()).latitude(location.getLatitude()) | ||
| 426 | - .longitude(location.getLongitude()).build(); | ||
| 427 | - if (null != location.getPoiList() && null != location.getPoiList().get(0)) { | ||
| 428 | - currentAddress = location.getPoiList().get(0).getName(); | ||
| 429 | - } | ||
| 430 | - if (isShowFollowAddress && selectDialog != null && !selectDialog.isShowing()) { | ||
| 431 | - if (!TextUtils.isEmpty(currentAddress)) { | ||
| 432 | - selectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设置开始地点?"); | ||
| 433 | - if (!selectDialog.isShowing()) { | ||
| 434 | - selectDialog.show(); | ||
| 435 | - } | ||
| 436 | - } | ||
| 437 | - } | ||
| 438 | - if (followMyLocation == null || followMyLocation.latitude == 0 || followMyLocation.longitude == 0) { | ||
| 439 | - return; | ||
| 440 | - } | ||
| 441 | - | ||
| 442 | - MapStatus.Builder builder = new MapStatus.Builder(); | ||
| 443 | 472 | ||
| 444 | -// if (isFirstLoc) { | ||
| 445 | -// isFirstLoc = false; | ||
| 446 | - currentLatLng = new LatLng(location.getLatitude(), | ||
| 447 | - location.getLongitude()); | ||
| 448 | - baiduMap.setMyLocationData(followMyLocation); | ||
| 449 | - builder.target(currentLatLng).zoom(DEFULT_ZOOM); | ||
| 450 | - baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build())); | ||
| 451 | 473 | ||
| 452 | } | 474 | } |
| 453 | } | 475 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/receivers/CollServiceReceiver.java
| @@ -23,7 +23,7 @@ public class CollServiceReceiver extends BroadcastReceiver { | @@ -23,7 +23,7 @@ public class CollServiceReceiver extends BroadcastReceiver { | ||
| 23 | private final String TAG = "CollServiceReceiver"; | 23 | private final String TAG = "CollServiceReceiver"; |
| 24 | 24 | ||
| 25 | public CollServiceReceiver() { | 25 | public CollServiceReceiver() { |
| 26 | - | 26 | + super(); |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | public CollServiceReceiver(PowerManager.WakeLock wakeLock) { | 29 | public CollServiceReceiver(PowerManager.WakeLock wakeLock) { |
| @@ -72,7 +72,7 @@ public class CollServiceReceiver extends BroadcastReceiver { | @@ -72,7 +72,7 @@ public class CollServiceReceiver extends BroadcastReceiver { | ||
| 72 | } | 72 | } |
| 73 | Log.e(TAG, "启动KeepLiveService"); | 73 | Log.e(TAG, "启动KeepLiveService"); |
| 74 | } else { | 74 | } else { |
| 75 | - Log.e(TAG, "KeepLiveService已经在运行"); | 75 | + Log.e(TAG, "collKeepLiveService已经在运行"); |
| 76 | 76 | ||
| 77 | } | 77 | } |
| 78 | String action = intent.getAction(); | 78 | String action = intent.getAction(); |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/service/CollKeepLiveService.java
| @@ -4,6 +4,7 @@ import android.annotation.SuppressLint; | @@ -4,6 +4,7 @@ import android.annotation.SuppressLint; | ||
| 4 | import android.app.Notification; | 4 | import android.app.Notification; |
| 5 | import android.app.NotificationChannel; | 5 | import android.app.NotificationChannel; |
| 6 | import android.app.NotificationManager; | 6 | import android.app.NotificationManager; |
| 7 | +import android.app.PendingIntent; | ||
| 7 | import android.app.Service; | 8 | import android.app.Service; |
| 8 | import android.content.ComponentName; | 9 | import android.content.ComponentName; |
| 9 | import android.content.Context; | 10 | import android.content.Context; |
| @@ -19,6 +20,8 @@ import android.util.Log; | @@ -19,6 +20,8 @@ import android.util.Log; | ||
| 19 | 20 | ||
| 20 | import com.cnlive.moudle.collectionTrace.receivers.CollServiceReceiver; | 21 | import com.cnlive.moudle.collectionTrace.receivers.CollServiceReceiver; |
| 21 | import com.cnlive.moudle.collectionTrace.commonInfo.CollCommonInfo; | 22 | import com.cnlive.moudle.collectionTrace.commonInfo.CollCommonInfo; |
| 23 | +import com.cnlive.moudle.collectionTrace.ui.activity.CollRunningMapActivity; | ||
| 24 | +import com.cnlive.moudle.pedometer.ui.activity.PedometerMainActivity; | ||
| 22 | import com.cnlive.moudle.pedometer.utils.ServiceUtils; | 25 | import com.cnlive.moudle.pedometer.utils.ServiceUtils; |
| 23 | import com.example.moudle_pedometer.R; | 26 | import com.example.moudle_pedometer.R; |
| 24 | 27 | ||
| @@ -36,18 +39,19 @@ public class CollKeepLiveService extends Service implements MediaPlayer.OnComple | @@ -36,18 +39,19 @@ public class CollKeepLiveService extends Service implements MediaPlayer.OnComple | ||
| 36 | public static MediaPlayer mMediaPlayer; | 39 | public static MediaPlayer mMediaPlayer; |
| 37 | //广播 | 40 | //广播 |
| 38 | private static CollServiceReceiver myReceiver; | 41 | private static CollServiceReceiver myReceiver; |
| 39 | - private String CHANNEL_ONE_ID = "com.cnlive.keep"; | ||
| 40 | - private String CHANNEL_ONE_NAME = "KeepLive"; | 42 | + private String CHANNEL_ONE_ID = "com.cnlive.collkeep"; |
| 43 | + private String CHANNEL_ONE_NAME = "collKeepLive"; | ||
| 41 | private NotificationManager mNM; | 44 | private NotificationManager mNM; |
| 42 | private Notification notification = null; | 45 | private Notification notification = null; |
| 43 | //是否在后台运行 | 46 | //是否在后台运行 |
| 44 | public static boolean isKeepService = true; | 47 | public static boolean isKeepService = true; |
| 45 | public static CollKeepLiveService instance; | 48 | public static CollKeepLiveService instance; |
| 46 | - private int startId; | ||
| 47 | private final String TAG = "CollKeepLiveService"; | 49 | private final String TAG = "CollKeepLiveService"; |
| 48 | private Handler handler; | 50 | private Handler handler; |
| 49 | private Runnable runnable; | 51 | private Runnable runnable; |
| 50 | private boolean isRegisterReceiver = false; | 52 | private boolean isRegisterReceiver = false; |
| 53 | + private boolean isStartForegroundService = false; | ||
| 54 | + private final int NOTIFICATION_ID = 1; | ||
| 51 | 55 | ||
| 52 | public CollKeepLiveService() { | 56 | public CollKeepLiveService() { |
| 53 | } | 57 | } |
| @@ -69,14 +73,16 @@ public class CollKeepLiveService extends Service implements MediaPlayer.OnComple | @@ -69,14 +73,16 @@ public class CollKeepLiveService extends Service implements MediaPlayer.OnComple | ||
| 69 | handler.postDelayed(this, 5000); | 73 | handler.postDelayed(this, 5000); |
| 70 | } else { | 74 | } else { |
| 71 | try { | 75 | try { |
| 72 | - if (myReceiver != null) { | 76 | + if (myReceiver != null && isRegisterReceiver) { |
| 73 | unregisterReceiver(myReceiver); | 77 | unregisterReceiver(myReceiver); |
| 74 | } | 78 | } |
| 75 | } catch (Exception e) { | 79 | } catch (Exception e) { |
| 76 | Log.e(TAG, "run: "); | 80 | Log.e(TAG, "run: "); |
| 77 | } | 81 | } |
| 78 | stopPlaySong(); | 82 | stopPlaySong(); |
| 79 | - stopForeground(true); | 83 | + if (isStartForegroundService) { |
| 84 | + stopForeground(true); | ||
| 85 | + } | ||
| 80 | } | 86 | } |
| 81 | 87 | ||
| 82 | } | 88 | } |
| @@ -140,16 +146,15 @@ public class CollKeepLiveService extends Service implements MediaPlayer.OnComple | @@ -140,16 +146,15 @@ public class CollKeepLiveService extends Service implements MediaPlayer.OnComple | ||
| 140 | } | 146 | } |
| 141 | } | 147 | } |
| 142 | } | 148 | } |
| 143 | - this.startId = startId; | ||
| 144 | //跨进程读取配置文件 | 149 | //跨进程读取配置文件 |
| 145 | boolean isRun = CollCommonInfo.getIsRunKeepAliveService(getApplicationContext()); | 150 | boolean isRun = CollCommonInfo.getIsRunKeepAliveService(getApplicationContext()); |
| 146 | 151 | ||
| 147 | if (isRun) { | 152 | if (isRun) { |
| 153 | + showHideForegroundNotification(); | ||
| 154 | + startPlaySong(); | ||
| 148 | if (runnable != null) { | 155 | if (runnable != null) { |
| 149 | handler.postDelayed(runnable, 5000); | 156 | handler.postDelayed(runnable, 5000); |
| 150 | } | 157 | } |
| 151 | - showHideForegroundNotification(); | ||
| 152 | - startPlaySong(); | ||
| 153 | } | 158 | } |
| 154 | return START_STICKY; | 159 | return START_STICKY; |
| 155 | } | 160 | } |
| @@ -202,20 +207,26 @@ public class CollKeepLiveService extends Service implements MediaPlayer.OnComple | @@ -202,20 +207,26 @@ public class CollKeepLiveService extends Service implements MediaPlayer.OnComple | ||
| 202 | channel.setLockscreenVisibility(NotificationCompat.VISIBILITY_PRIVATE); | 207 | channel.setLockscreenVisibility(NotificationCompat.VISIBILITY_PRIVATE); |
| 203 | mNM.createNotificationChannel(channel); | 208 | mNM.createNotificationChannel(channel); |
| 204 | } | 209 | } |
| 210 | + Intent notificationIntent = new Intent(this, CollRunningMapActivity.class); | ||
| 205 | notification = new NotificationCompat.Builder(this, CHANNEL_ONE_ID) | 211 | notification = new NotificationCompat.Builder(this, CHANNEL_ONE_ID) |
| 212 | + .setContentIntent(PendingIntent.getActivity(this, 0, notificationIntent, 0)) | ||
| 213 | + .setSmallIcon(R.mipmap.ic_launcher) | ||
| 214 | +// .setCustomContentView(remoteViews) | ||
| 206 | .setContentTitle(getResources().getString(R.string.app_name)) | 215 | .setContentTitle(getResources().getString(R.string.app_name)) |
| 207 | - .setContentText("正在记录您的运动") | ||
| 208 | - .setWhen(System.currentTimeMillis()) | 216 | + .setContentText(getResources().getString(R.string.keep_service_tip)) |
| 217 | + .setCategory(Notification.CATEGORY_SERVICE) | ||
| 209 | .setSound(null) | 218 | .setSound(null) |
| 219 | + .setWhen(System.currentTimeMillis()) | ||
| 210 | .build(); | 220 | .build(); |
| 211 | // 0 隐藏前台服务通知 | 221 | // 0 隐藏前台服务通知 |
| 212 | - startForeground(100, notification); | ||
| 213 | -// stopForeground(true); | 222 | + startForeground(NOTIFICATION_ID, notification); |
| 223 | + isStartForegroundService = true; | ||
| 214 | } | 224 | } |
| 215 | 225 | ||
| 216 | @Override | 226 | @Override |
| 217 | public void onDestroy() { | 227 | public void onDestroy() { |
| 218 | super.onDestroy(); | 228 | super.onDestroy(); |
| 229 | + Log.e(TAG, "onDestroy: "); | ||
| 219 | try { | 230 | try { |
| 220 | if (myReceiver != null && isRegisterReceiver) { | 231 | if (myReceiver != null && isRegisterReceiver) { |
| 221 | unregisterReceiver(myReceiver); | 232 | unregisterReceiver(myReceiver); |
| @@ -264,7 +275,7 @@ public class CollKeepLiveService extends Service implements MediaPlayer.OnComple | @@ -264,7 +275,7 @@ public class CollKeepLiveService extends Service implements MediaPlayer.OnComple | ||
| 264 | @Override | 275 | @Override |
| 265 | public void onCompletion(MediaPlayer mediaPlayer) { | 276 | public void onCompletion(MediaPlayer mediaPlayer) { |
| 266 | boolean isRun = CollCommonInfo.getIsRunKeepAliveService(getApplicationContext()); | 277 | boolean isRun = CollCommonInfo.getIsRunKeepAliveService(getApplicationContext()); |
| 267 | - | 278 | + Log.e(TAG, "onCompletion: 是否循环播放" + isRun); |
| 268 | if (isRun) { | 279 | if (isRun) { |
| 269 | Log.e(TAG, "重新播放"); | 280 | Log.e(TAG, "重新播放"); |
| 270 | mediaPlayer.start(); | 281 | mediaPlayer.start(); |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/service/CollStepService.java
| @@ -36,6 +36,7 @@ import com.baidu.trace.model.OnTraceListener; | @@ -36,6 +36,7 @@ import com.baidu.trace.model.OnTraceListener; | ||
| 36 | import com.baidu.trace.model.PushMessage; | 36 | import com.baidu.trace.model.PushMessage; |
| 37 | import com.baidu.trace.model.StatusCodes; | 37 | import com.baidu.trace.model.StatusCodes; |
| 38 | import com.cnlive.moudle.collectionTrace.commonInfo.CollCommonInfo; | 38 | import com.cnlive.moudle.collectionTrace.commonInfo.CollCommonInfo; |
| 39 | +import com.cnlive.moudle.collectionTrace.ui.activity.CollRunningMapActivity; | ||
| 39 | import com.cnlive.moudle.pedometer.model.Constant; | 40 | import com.cnlive.moudle.pedometer.model.Constant; |
| 40 | import com.cnlive.moudle.pedometer.model.MessageEvent; | 41 | import com.cnlive.moudle.pedometer.model.MessageEvent; |
| 41 | import com.cnlive.moudle.pedometer.model.step.StepCount; | 42 | import com.cnlive.moudle.pedometer.model.step.StepCount; |
| @@ -60,8 +61,8 @@ public class CollStepService extends Service implements SensorEventListener { | @@ -60,8 +61,8 @@ public class CollStepService extends Service implements SensorEventListener { | ||
| 60 | /** | 61 | /** |
| 61 | * 通知栏相关 | 62 | * 通知栏相关 |
| 62 | */ | 63 | */ |
| 63 | - private String CHANNEL_ONE_ID = "com.cnlive.step"; | ||
| 64 | - private String CHANNEL_ONE_NAME = "Step"; | 64 | + private String CHANNEL_ONE_ID = "com.cnlive.collstep"; |
| 65 | + private String CHANNEL_ONE_NAME = "collStep"; | ||
| 65 | private NotificationManager mNM; | 66 | private NotificationManager mNM; |
| 66 | private Notification notification = null; | 67 | private Notification notification = null; |
| 67 | private RemoteViews remoteViews; | 68 | private RemoteViews remoteViews; |
| @@ -116,7 +117,7 @@ public class CollStepService extends Service implements SensorEventListener { | @@ -116,7 +117,7 @@ public class CollStepService extends Service implements SensorEventListener { | ||
| 116 | private String userId; | 117 | private String userId; |
| 117 | private Handler handler; | 118 | private Handler handler; |
| 118 | private Runnable speedRunnable; | 119 | private Runnable speedRunnable; |
| 119 | - private final int NOTIFICATION_ID = 100; | 120 | + private final int NOTIFICATION_ID = 101; |
| 120 | // private static int tempStep;//计步器临时保存步数 | 121 | // private static int tempStep;//计步器临时保存步数 |
| 121 | private static boolean pauseFlag;//是否暂停 | 122 | private static boolean pauseFlag;//是否暂停 |
| 122 | private static int speedCurrentStep;//用于检测速度步数 | 123 | private static int speedCurrentStep;//用于检测速度步数 |
| @@ -144,6 +145,8 @@ public class CollStepService extends Service implements SensorEventListener { | @@ -144,6 +145,8 @@ public class CollStepService extends Service implements SensorEventListener { | ||
| 144 | */ | 145 | */ |
| 145 | public static Trace mTrace = null; | 146 | public static Trace mTrace = null; |
| 146 | 147 | ||
| 148 | + private boolean isStartForeground = false; | ||
| 149 | + | ||
| 147 | public CollStepService() { | 150 | public CollStepService() { |
| 148 | 151 | ||
| 149 | } | 152 | } |
| @@ -229,7 +232,7 @@ public class CollStepService extends Service implements SensorEventListener { | @@ -229,7 +232,7 @@ public class CollStepService extends Service implements SensorEventListener { | ||
| 229 | if (mClient != null) { | 232 | if (mClient != null) { |
| 230 | retryIndex = 0; | 233 | retryIndex = 0; |
| 231 | mClient.startGather(traceListener); | 234 | mClient.startGather(traceListener); |
| 232 | - Log.e(TAG, "开启轨迹服务" ); | 235 | + Log.e(TAG, "开启轨迹服务"); |
| 233 | // Toast.makeText(getApplicationContext(), "开启轨迹服务", Toast.LENGTH_LONG).show(); | 236 | // Toast.makeText(getApplicationContext(), "开启轨迹服务", Toast.LENGTH_LONG).show(); |
| 234 | boolean isFirstSendNotification = CollCommonInfo.getIsFirstStepSendTraceTip(getApplicationContext()); | 237 | boolean isFirstSendNotification = CollCommonInfo.getIsFirstStepSendTraceTip(getApplicationContext()); |
| 235 | if (isFirstSendNotification) { | 238 | if (isFirstSendNotification) { |
| @@ -274,7 +277,7 @@ public class CollStepService extends Service implements SensorEventListener { | @@ -274,7 +277,7 @@ public class CollStepService extends Service implements SensorEventListener { | ||
| 274 | if (StatusCodes.SUCCESS == errorNo || StatusCodes.CACHE_TRACK_NOT_UPLOAD == errorNo) { | 277 | if (StatusCodes.SUCCESS == errorNo || StatusCodes.CACHE_TRACK_NOT_UPLOAD == errorNo) { |
| 275 | if (mClient != null) { | 278 | if (mClient != null) { |
| 276 | mClient.stopTrace(mTrace, traceListener); | 279 | mClient.stopTrace(mTrace, traceListener); |
| 277 | - Log.e(TAG, "停止轨迹服务" ); | 280 | + Log.e(TAG, "停止轨迹服务"); |
| 278 | // Toast.makeText(getApplicationContext(), "停止轨迹服务", Toast.LENGTH_LONG).show(); | 281 | // Toast.makeText(getApplicationContext(), "停止轨迹服务", Toast.LENGTH_LONG).show(); |
| 279 | } | 282 | } |
| 280 | } | 283 | } |
| @@ -295,7 +298,7 @@ public class CollStepService extends Service implements SensorEventListener { | @@ -295,7 +298,7 @@ public class CollStepService extends Service implements SensorEventListener { | ||
| 295 | Log.e(TAG, "onStartGatherCallback: " + message + "," + errorNo); | 298 | Log.e(TAG, "onStartGatherCallback: " + message + "," + errorNo); |
| 296 | if (StatusCodes.SUCCESS == errorNo || StatusCodes.GATHER_STARTED == errorNo) { | 299 | if (StatusCodes.SUCCESS == errorNo || StatusCodes.GATHER_STARTED == errorNo) { |
| 297 | retryIndex = 0; | 300 | retryIndex = 0; |
| 298 | - Log.e(TAG, "开始采集" ); | 301 | + Log.e(TAG, "开始采集"); |
| 299 | // Toast.makeText(getApplicationContext(), "开始采集", Toast.LENGTH_LONG).show(); | 302 | // Toast.makeText(getApplicationContext(), "开始采集", Toast.LENGTH_LONG).show(); |
| 300 | } else { | 303 | } else { |
| 301 | //重新开启采集 | 304 | //重新开启采集 |
| @@ -323,7 +326,7 @@ public class CollStepService extends Service implements SensorEventListener { | @@ -323,7 +326,7 @@ public class CollStepService extends Service implements SensorEventListener { | ||
| 323 | @Override | 326 | @Override |
| 324 | public void onStopGatherCallback(int errorNo, String message) { | 327 | public void onStopGatherCallback(int errorNo, String message) { |
| 325 | if (StatusCodes.SUCCESS == errorNo || StatusCodes.GATHER_STOPPED == errorNo) { | 328 | if (StatusCodes.SUCCESS == errorNo || StatusCodes.GATHER_STOPPED == errorNo) { |
| 326 | - Log.e(TAG, "停止采集" ); | 329 | + Log.e(TAG, "停止采集"); |
| 327 | // Toast.makeText(getApplicationContext(), "停止采集", Toast.LENGTH_LONG).show(); | 330 | // Toast.makeText(getApplicationContext(), "停止采集", Toast.LENGTH_LONG).show(); |
| 328 | if (mClient != null) { | 331 | if (mClient != null) { |
| 329 | mClient.stopTrace(mTrace, traceListener); | 332 | mClient.stopTrace(mTrace, traceListener); |
| @@ -370,6 +373,7 @@ public class CollStepService extends Service implements SensorEventListener { | @@ -370,6 +373,7 @@ public class CollStepService extends Service implements SensorEventListener { | ||
| 370 | @SuppressLint("WrongConstant") | 373 | @SuppressLint("WrongConstant") |
| 371 | @Override | 374 | @Override |
| 372 | public int onStartCommand(Intent intent, int flags, int startId) { | 375 | public int onStartCommand(Intent intent, int flags, int startId) { |
| 376 | + | ||
| 373 | if (!EventBus.getDefault().isRegistered(this)) { | 377 | if (!EventBus.getDefault().isRegistered(this)) { |
| 374 | EventBus.getDefault().register(this); | 378 | EventBus.getDefault().register(this); |
| 375 | } | 379 | } |
| @@ -435,19 +439,20 @@ public class CollStepService extends Service implements SensorEventListener { | @@ -435,19 +439,20 @@ public class CollStepService extends Service implements SensorEventListener { | ||
| 435 | } | 439 | } |
| 436 | 440 | ||
| 437 | 441 | ||
| 438 | - Intent notificationIntent = new Intent(this, PedometerMainActivity.class); | 442 | + Intent notificationIntent = new Intent(this, CollRunningMapActivity.class); |
| 439 | notification = new NotificationCompat.Builder(this, CHANNEL_ONE_ID) | 443 | notification = new NotificationCompat.Builder(this, CHANNEL_ONE_ID) |
| 440 | .setContentIntent(PendingIntent.getActivity(this, 0, notificationIntent, 0)) | 444 | .setContentIntent(PendingIntent.getActivity(this, 0, notificationIntent, 0)) |
| 441 | .setSmallIcon(R.mipmap.ic_launcher) | 445 | .setSmallIcon(R.mipmap.ic_launcher) |
| 442 | // .setCustomContentView(remoteViews) | 446 | // .setCustomContentView(remoteViews) |
| 443 | .setContentTitle(getResources().getString(R.string.app_name)) | 447 | .setContentTitle(getResources().getString(R.string.app_name)) |
| 444 | - .setContentText("正在记录您的运动") | 448 | + .setContentText(getResources().getString(R.string.step_service_tip)) |
| 445 | .setCategory(Notification.CATEGORY_SERVICE) | 449 | .setCategory(Notification.CATEGORY_SERVICE) |
| 446 | .setSound(null) | 450 | .setSound(null) |
| 447 | .setWhen(System.currentTimeMillis()) | 451 | .setWhen(System.currentTimeMillis()) |
| 448 | .build(); | 452 | .build(); |
| 449 | // remoteViews.setChronometer(R.id.ch, aa, null, true); | 453 | // remoteViews.setChronometer(R.id.ch, aa, null, true); |
| 450 | startForeground(NOTIFICATION_ID, notification); | 454 | startForeground(NOTIFICATION_ID, notification); |
| 455 | + isStartForeground = true; | ||
| 451 | 456 | ||
| 452 | } | 457 | } |
| 453 | 458 | ||
| @@ -462,8 +467,10 @@ public class CollStepService extends Service implements SensorEventListener { | @@ -462,8 +467,10 @@ public class CollStepService extends Service implements SensorEventListener { | ||
| 462 | @Override | 467 | @Override |
| 463 | public void onDestroy() { | 468 | public void onDestroy() { |
| 464 | super.onDestroy(); | 469 | super.onDestroy(); |
| 465 | - //取消前台进程 | ||
| 466 | - stopForeground(true); | 470 | + if (isStartForeground) { |
| 471 | + //取消前台进程 | ||
| 472 | + stopForeground(true); | ||
| 473 | + } | ||
| 467 | if (mBatInfoReceiver != null) { | 474 | if (mBatInfoReceiver != null) { |
| 468 | unregisterReceiver(mBatInfoReceiver); | 475 | unregisterReceiver(mBatInfoReceiver); |
| 469 | } | 476 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/CollPedometerMainActivity.java
| @@ -51,8 +51,9 @@ public class CollPedometerMainActivity extends QMUIFragmentActivity { | @@ -51,8 +51,9 @@ public class CollPedometerMainActivity extends QMUIFragmentActivity { | ||
| 51 | super.onCreate(savedInstanceState); | 51 | super.onCreate(savedInstanceState); |
| 52 | StatusBarUtil2.setColor(this, getResources().getColor(R.color.run_main_bg), 0); | 52 | StatusBarUtil2.setColor(this, getResources().getColor(R.color.run_main_bg), 0); |
| 53 | // setContentView(R.layout.activity_pedometer_main); | 53 | // setContentView(R.layout.activity_pedometer_main); |
| 54 | - runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().getSerializable("runRaceDetailInfo"); | ||
| 55 | - | 54 | + if (null != getIntent().getExtras()) { |
| 55 | + runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().getSerializable("runRaceDetailInfo"); | ||
| 56 | + } | ||
| 56 | } | 57 | } |
| 57 | 58 | ||
| 58 | 59 |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/CollRunningMapActivity.java
| @@ -21,9 +21,11 @@ public class CollRunningMapActivity extends QMUIFragmentActivity { | @@ -21,9 +21,11 @@ public class CollRunningMapActivity extends QMUIFragmentActivity { | ||
| 21 | super.onCreate(savedInstanceState); | 21 | super.onCreate(savedInstanceState); |
| 22 | 22 | ||
| 23 | StatusBarUtil2.setColor(this, getResources().getColor(R.color.run_main_bg), 0); | 23 | StatusBarUtil2.setColor(this, getResources().getColor(R.color.run_main_bg), 0); |
| 24 | - RunRaceDetailInfo runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().getSerializable("runRaceDetailInfo"); | ||
| 25 | - if (runRaceDetailInfo != null) { | ||
| 26 | - addFragment(runRaceDetailInfo); | 24 | + if (null != getIntent().getExtras()) { |
| 25 | + RunRaceDetailInfo runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().getSerializable("runRaceDetailInfo"); | ||
| 26 | + if (runRaceDetailInfo != null) { | ||
| 27 | + addFragment(runRaceDetailInfo); | ||
| 28 | + } | ||
| 27 | } | 29 | } |
| 28 | } | 30 | } |
| 29 | 31 |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/CollTraceListDetailActivity.java
| @@ -26,11 +26,13 @@ public class CollTraceListDetailActivity extends QMUIFragmentActivity { | @@ -26,11 +26,13 @@ public class CollTraceListDetailActivity extends QMUIFragmentActivity { | ||
| 26 | @Override | 26 | @Override |
| 27 | protected void onCreate(Bundle savedInstanceState) { | 27 | protected void onCreate(Bundle savedInstanceState) { |
| 28 | super.onCreate(savedInstanceState); | 28 | super.onCreate(savedInstanceState); |
| 29 | - eventShoeLinesBean = (RaceNameListInfo.EventShoeLinesBean) getIntent().getExtras().get("eventShoeLinesBean"); | ||
| 30 | - String fenceEntityName = getIntent().getExtras().getString("fenceEntityName"); | ||
| 31 | - String position= getIntent().getExtras().getString("position"); | ||
| 32 | - if (null != eventShoeLinesBean) { | ||
| 33 | - addFragment(CollTraceListDetailFragment.newInstance(eventShoeLinesBean,position)); | 29 | + if (null != getIntent().getExtras()) { |
| 30 | + eventShoeLinesBean = (RaceNameListInfo.EventShoeLinesBean) getIntent().getExtras().get("eventShoeLinesBean"); | ||
| 31 | + String fenceEntityName = getIntent().getExtras().getString("fenceEntityName"); | ||
| 32 | + String position = getIntent().getExtras().getString("position"); | ||
| 33 | + if (null != eventShoeLinesBean) { | ||
| 34 | + addFragment(CollTraceListDetailFragment.newInstance(eventShoeLinesBean, position)); | ||
| 35 | + } | ||
| 34 | } | 36 | } |
| 35 | } | 37 | } |
| 36 | 38 |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/RaceNameListActivity.java
| @@ -31,9 +31,11 @@ public class RaceNameListActivity extends AppCompatActivity { | @@ -31,9 +31,11 @@ public class RaceNameListActivity extends AppCompatActivity { | ||
| 31 | StatusBarUtil.setStatusBarWrite(this); | 31 | StatusBarUtil.setStatusBarWrite(this); |
| 32 | StatusBarUtil2.setColor(this, getResources().getColor(R.color.white), 0); | 32 | StatusBarUtil2.setColor(this, getResources().getColor(R.color.white), 0); |
| 33 | setContentView(R.layout.activity_race_name_list); | 33 | setContentView(R.layout.activity_race_name_list); |
| 34 | - RunRaceDetailInfo runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().getSerializable("runRaceDetailInfo"); | ||
| 35 | - if (null != runRaceDetailInfo) { | ||
| 36 | - getSupportFragmentManager().beginTransaction().replace(R.id.race_container, RaceNameListFragment.newInstance(getIntent().getStringExtra("eventId"), runRaceDetailInfo)).commit(); | 34 | + if (null != getIntent().getExtras()) { |
| 35 | + RunRaceDetailInfo runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().getSerializable("runRaceDetailInfo"); | ||
| 36 | + if (null != runRaceDetailInfo) { | ||
| 37 | + getSupportFragmentManager().beginTransaction().replace(R.id.race_container, RaceNameListFragment.newInstance(getIntent().getStringExtra("eventId"), runRaceDetailInfo)).commit(); | ||
| 38 | + } | ||
| 37 | } | 39 | } |
| 38 | } | 40 | } |
| 39 | } | 41 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/StartCollectTraceActivity.java
| @@ -4,9 +4,12 @@ import android.Manifest; | @@ -4,9 +4,12 @@ import android.Manifest; | ||
| 4 | import android.app.Activity; | 4 | import android.app.Activity; |
| 5 | import android.content.Context; | 5 | import android.content.Context; |
| 6 | import android.content.Intent; | 6 | import android.content.Intent; |
| 7 | +import android.content.pm.PackageManager; | ||
| 8 | +import android.net.Uri; | ||
| 7 | import android.os.Bundle; | 9 | import android.os.Bundle; |
| 8 | import android.provider.Settings; | 10 | import android.provider.Settings; |
| 9 | import android.support.annotation.NonNull; | 11 | import android.support.annotation.NonNull; |
| 12 | +import android.support.v4.app.ActivityCompat; | ||
| 10 | import android.util.Log; | 13 | import android.util.Log; |
| 11 | import android.widget.Toast; | 14 | import android.widget.Toast; |
| 12 | 15 | ||
| @@ -17,7 +20,11 @@ import com.cnlive.libs.base.util.StatusBarUtil2; | @@ -17,7 +20,11 @@ import com.cnlive.libs.base.util.StatusBarUtil2; | ||
| 17 | import com.cnlive.moudle.collectionTrace.commonInfo.CollCommonInfo; | 20 | import com.cnlive.moudle.collectionTrace.commonInfo.CollCommonInfo; |
| 18 | import com.cnlive.moudle.collectionTrace.ui.fragment.StartTraceFragment; | 21 | import com.cnlive.moudle.collectionTrace.ui.fragment.StartTraceFragment; |
| 19 | import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; | 22 | import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; |
| 23 | +import com.cnlive.moudle.pedometer.ui.activity.RunRaceDetailActivity; | ||
| 24 | +import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; | ||
| 25 | +import com.cnlive.moudle.pedometer.utils.CheckUtil; | ||
| 20 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; | 26 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; |
| 27 | +import com.cnlive.moudle.pedometer.utils.NotificationUtil; | ||
| 21 | import com.cnlive.moudle.pedometer.utils.lib_permisshelper.PermissionsListener; | 28 | import com.cnlive.moudle.pedometer.utils.lib_permisshelper.PermissionsListener; |
| 22 | import com.cnlive.moudle.pedometer.utils.lib_permisshelper.PermissionsUtils; | 29 | import com.cnlive.moudle.pedometer.utils.lib_permisshelper.PermissionsUtils; |
| 23 | import com.example.moudle_pedometer.R; | 30 | import com.example.moudle_pedometer.R; |
| @@ -26,8 +33,10 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity { | @@ -26,8 +33,10 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity { | ||
| 26 | 33 | ||
| 27 | private PermissionsUtils mPermissionsUtils;//权限申请 | 34 | private PermissionsUtils mPermissionsUtils;//权限申请 |
| 28 | private RunRaceDetailInfo runRaceDetailInfo; | 35 | private RunRaceDetailInfo runRaceDetailInfo; |
| 36 | + private int permissionRequestCount = 0;//权限请求次数 | ||
| 37 | + private SelectDialog selectDialog; | ||
| 29 | 38 | ||
| 30 | - public static void newInstance(Context context, String eventId,RunRaceDetailInfo runRaceDetailInfo) { | 39 | + public static void newInstance(Context context, String eventId, RunRaceDetailInfo runRaceDetailInfo) { |
| 31 | CollCommonInfo.setStreetId(context, eventId); | 40 | CollCommonInfo.setStreetId(context, eventId); |
| 32 | Intent intent = new Intent(context, StartCollectTraceActivity.class); | 41 | Intent intent = new Intent(context, StartCollectTraceActivity.class); |
| 33 | intent.putExtra("eventId", eventId); | 42 | intent.putExtra("eventId", eventId); |
| @@ -46,15 +55,32 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity { | @@ -46,15 +55,32 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity { | ||
| 46 | mPermissionsUtils = new PermissionsUtils(); | 55 | mPermissionsUtils = new PermissionsUtils(); |
| 47 | StatusBarUtil.setStatusBarWrite(this); | 56 | StatusBarUtil.setStatusBarWrite(this); |
| 48 | StatusBarUtil2.setColor(this, getResources().getColor(R.color.white), 0); | 57 | StatusBarUtil2.setColor(this, getResources().getColor(R.color.white), 0); |
| 49 | - runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().getSerializable("runRaceDetailInfo"); | ||
| 50 | - | ||
| 51 | - | 58 | + if (null != getIntent().getExtras()) { |
| 59 | + runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().getSerializable("runRaceDetailInfo"); | ||
| 60 | + } | ||
| 61 | + initPermissionDefineTip(); | ||
| 52 | } | 62 | } |
| 53 | 63 | ||
| 54 | @Override | 64 | @Override |
| 55 | protected void onResume() { | 65 | protected void onResume() { |
| 56 | super.onResume(); | 66 | super.onResume(); |
| 57 | - getPermissionsWithTip(); | 67 | + boolean isOpen = NotificationUtil.isOpenNotification(this); |
| 68 | + if (isOpen) { | ||
| 69 | + //判断GPS是否开启 | ||
| 70 | + if (!MyMapUtil.isOPenGps(getApplicationContext())) { | ||
| 71 | + Toast.makeText(getApplicationContext(), getString(R.string.open_gps_tip), Toast.LENGTH_LONG).show(); | ||
| 72 | + //开启GPS | ||
| 73 | + Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); | ||
| 74 | + startActivityForResult(intent, 10); | ||
| 75 | + } else { | ||
| 76 | + boolean isSetBattery = CheckUtil.isIgnoringBatteryOptimizationss(StartCollectTraceActivity.this); | ||
| 77 | + if (!isSetBattery) { | ||
| 78 | + isSetBattery = CheckUtil.isIgnoringBatteryOptimizationss(StartCollectTraceActivity.this); | ||
| 79 | + } else { | ||
| 80 | + getPermissionsWithTip(); | ||
| 81 | + } | ||
| 82 | + } | ||
| 83 | + } | ||
| 58 | } | 84 | } |
| 59 | 85 | ||
| 60 | private void addFragment(QMUIFragment fragment) { | 86 | private void addFragment(QMUIFragment fragment) { |
| @@ -75,6 +101,9 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity { | @@ -75,6 +101,9 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity { | ||
| 75 | * 一次申请一组权限(使用拒绝弹框)点击事件 | 101 | * 一次申请一组权限(使用拒绝弹框)点击事件 |
| 76 | */ | 102 | */ |
| 77 | public void getPermissionsWithTip() { | 103 | public void getPermissionsWithTip() { |
| 104 | + if (1 == permissionRequestCount) { | ||
| 105 | + return; | ||
| 106 | + } | ||
| 78 | mPermissionsUtils | 107 | mPermissionsUtils |
| 79 | .setPermissionsListener(new PermissionsListener() { | 108 | .setPermissionsListener(new PermissionsListener() { |
| 80 | @Override | 109 | @Override |
| @@ -120,6 +149,29 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity { | @@ -120,6 +149,29 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity { | ||
| 120 | // , Manifest.permission.ACCESS_FINE_LOCATION); | 149 | // , Manifest.permission.ACCESS_FINE_LOCATION); |
| 121 | } | 150 | } |
| 122 | 151 | ||
| 152 | + private void initPermissionDefineTip() { | ||
| 153 | + selectDialog = new SelectDialog(StartCollectTraceActivity.this, "您尚未授予程序运行所需权限\n是否设置?", | ||
| 154 | + "返回", new SelectDialog.DialogInterface() { | ||
| 155 | + @Override | ||
| 156 | + public void onClick(SelectDialog dialog) { | ||
| 157 | + dialog.dismiss(); | ||
| 158 | + finish(); | ||
| 159 | + } | ||
| 160 | + }, "设置", new SelectDialog.DialogInterface() { | ||
| 161 | + @Override | ||
| 162 | + public void onClick(SelectDialog dialog) { | ||
| 163 | + dialog.dismiss(); | ||
| 164 | +// if (!ActivityCompat.shouldShowRequestPermissionRationale(this, permissions[i])) { | ||
| 165 | +// showToast("点击权限,并打开全部权限"); | ||
| 166 | + Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); | ||
| 167 | + Uri uri = Uri.fromParts("package", getPackageName(), null); | ||
| 168 | + intent.setData(uri); | ||
| 169 | + startActivityForResult(intent, 0); | ||
| 170 | + permissionRequestCount = 0; | ||
| 171 | +// } | ||
| 172 | + } | ||
| 173 | + }); | ||
| 174 | + } | ||
| 123 | 175 | ||
| 124 | /** | 176 | /** |
| 125 | * 权限回调 | 177 | * 权限回调 |
| @@ -132,6 +184,31 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity { | @@ -132,6 +184,31 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity { | ||
| 132 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, | 184 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, |
| 133 | @NonNull int[] grantResults) { | 185 | @NonNull int[] grantResults) { |
| 134 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); | 186 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); |
| 135 | - mPermissionsUtils.dealResult(requestCode, permissions, grantResults); | 187 | + if (1 == permissionRequestCount) { |
| 188 | + return; | ||
| 189 | + } | ||
| 190 | + boolean isShowPermissionTip = true; | ||
| 191 | + for (int i = 0; i < grantResults.length; i++) {//判断权限的结果,如果有被拒绝,就return | ||
| 192 | + if (grantResults[i] == PackageManager.PERMISSION_DENIED) { | ||
| 193 | + if (!ActivityCompat.shouldShowRequestPermissionRationale(this, permissions[i])) { | ||
| 194 | + isShowPermissionTip = false; | ||
| 195 | + break; | ||
| 196 | + } | ||
| 197 | + } | ||
| 198 | + } | ||
| 199 | + if (isShowPermissionTip) { | ||
| 200 | + mPermissionsUtils.dealResult(requestCode, permissions, grantResults); | ||
| 201 | + } else { | ||
| 202 | + if (0 == permissionRequestCount) { | ||
| 203 | + selectDialog.setCancelable(false); | ||
| 204 | + selectDialog.setCanceledOnTouchOutside(false); | ||
| 205 | + if (!selectDialog.isShowing()) { | ||
| 206 | + selectDialog.show(); | ||
| 207 | + permissionRequestCount = 1; | ||
| 208 | + } | ||
| 209 | + } else { | ||
| 210 | + return; | ||
| 211 | + } | ||
| 212 | + } | ||
| 136 | } | 213 | } |
| 137 | } | 214 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/fragment/RaceNameListFragment.java
| @@ -98,5 +98,12 @@ public class RaceNameListFragment extends MvpBindingFragment<RaceNameListView, R | @@ -98,5 +98,12 @@ public class RaceNameListFragment extends MvpBindingFragment<RaceNameListView, R | ||
| 98 | getMvpView().delectShoeLine(Integer.parseInt(messageEvent.getMessageContent()+"")); | 98 | getMvpView().delectShoeLine(Integer.parseInt(messageEvent.getMessageContent()+"")); |
| 99 | } | 99 | } |
| 100 | } | 100 | } |
| 101 | + //轨迹上传成功,更新轨迹列表 | ||
| 102 | + else if(messageEvent.getMessageType() == Constant.UPDATA_COLL_TRACE_LIST){ | ||
| 103 | + if (getMvpView() != null&&null!=getPresenter()) { | ||
| 104 | + currentPage = 1; | ||
| 105 | + getPresenter().setData(getActivity(), eventId, currentPage, pageSize); | ||
| 106 | + } | ||
| 107 | + } | ||
| 101 | } | 108 | } |
| 102 | } | 109 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/RegistrationInfoPresenter.java
| @@ -2,6 +2,7 @@ package com.cnlive.moudle.pedometer.frame.presenter; | @@ -2,6 +2,7 @@ package com.cnlive.moudle.pedometer.frame.presenter; | ||
| 2 | 2 | ||
| 3 | import android.app.Activity; | 3 | import android.app.Activity; |
| 4 | import android.content.Context; | 4 | import android.content.Context; |
| 5 | +import android.util.Log; | ||
| 5 | import android.widget.Toast; | 6 | import android.widget.Toast; |
| 6 | 7 | ||
| 7 | import com.cnlive.libs.base.application.AppConfig; | 8 | import com.cnlive.libs.base.application.AppConfig; |
| @@ -17,6 +18,7 @@ import com.cnlive.moudle.pedometer.net.SubscriptionRequest; | @@ -17,6 +18,7 @@ import com.cnlive.moudle.pedometer.net.SubscriptionRequest; | ||
| 17 | import com.cnlive.moudle.pedometer.net.bean.BaiduTraceBean; | 18 | import com.cnlive.moudle.pedometer.net.bean.BaiduTraceBean; |
| 18 | import com.cnlive.moudle.pedometer.net.bean.BaseInfo; | 19 | import com.cnlive.moudle.pedometer.net.bean.BaseInfo; |
| 19 | import com.cnlive.moudle.pedometer.utils.Sha1Util; | 20 | import com.cnlive.moudle.pedometer.utils.Sha1Util; |
| 21 | +import com.example.moudle_pedometer.BuildConfig; | ||
| 20 | import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; | 22 | import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; |
| 21 | 23 | ||
| 22 | import java.util.HashMap; | 24 | import java.util.HashMap; |
| @@ -31,6 +33,9 @@ import io.reactivex.disposables.Disposable; | @@ -31,6 +33,9 @@ import io.reactivex.disposables.Disposable; | ||
| 31 | public class RegistrationInfoPresenter extends MvpBasePresenter<RegistrationInfoView> { | 33 | public class RegistrationInfoPresenter extends MvpBasePresenter<RegistrationInfoView> { |
| 32 | 34 | ||
| 33 | public void commitInfo(Context context, String eventId, String sid, String mobile, String sex, String birthday) { | 35 | public void commitInfo(Context context, String eventId, String sid, String mobile, String sex, String birthday) { |
| 36 | + if (null!=getView()){ | ||
| 37 | + getView().limitClickRegistBtn(); | ||
| 38 | + } | ||
| 34 | HashMap<String, String> map = new HashMap<>(); | 39 | HashMap<String, String> map = new HashMap<>(); |
| 35 | map.put("eventId", eventId); | 40 | map.put("eventId", eventId); |
| 36 | map.put("sid", sid); | 41 | map.put("sid", sid); |
| @@ -41,6 +46,9 @@ public class RegistrationInfoPresenter extends MvpBasePresenter<RegistrationInfo | @@ -41,6 +46,9 @@ public class RegistrationInfoPresenter extends MvpBasePresenter<RegistrationInfo | ||
| 41 | sex = "0"; | 46 | sex = "0"; |
| 42 | } | 47 | } |
| 43 | map.put("sex", sex); | 48 | map.put("sex", sex); |
| 49 | + if (birthday.contains("年")) birthday = birthday.replace("年", "-"); | ||
| 50 | + if (birthday.contains("月")) birthday = birthday.replace("月", "-"); | ||
| 51 | + if (birthday.contains("日")) birthday = birthday.replace("日", ""); | ||
| 44 | map.put("birthday", birthday); | 52 | map.put("birthday", birthday); |
| 45 | Logic.create(map).action(new Logic.Action<Map<String, String>, BaseInfo>() { | 53 | Logic.create(map).action(new Logic.Action<Map<String, String>, BaseInfo>() { |
| 46 | @Override | 54 | @Override |
| @@ -50,7 +58,10 @@ public class RegistrationInfoPresenter extends MvpBasePresenter<RegistrationInfo | @@ -50,7 +58,10 @@ public class RegistrationInfoPresenter extends MvpBasePresenter<RegistrationInfo | ||
| 50 | }).<BaseInfo>event().setFailureCallback(new FailureCallback() { | 58 | }).<BaseInfo>event().setFailureCallback(new FailureCallback() { |
| 51 | @Override | 59 | @Override |
| 52 | public void onFailure(int code, String message) { | 60 | public void onFailure(int code, String message) { |
| 53 | - Toast.makeText(context, "报名失败", Toast.LENGTH_LONG).show(); | 61 | + if (null!=getView()){ |
| 62 | + getView().allowClickRegistBtn(); | ||
| 63 | + } | ||
| 64 | + Toast.makeText(context, "报名失败", Toast.LENGTH_LONG).show(); | ||
| 54 | } | 65 | } |
| 55 | }).setSuccessCallback(new SuccessCallback<BaseInfo>() { | 66 | }).setSuccessCallback(new SuccessCallback<BaseInfo>() { |
| 56 | @Override | 67 | @Override |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/RunningFinishFragmetPresenter.java
| @@ -17,6 +17,7 @@ import com.cnlive.libs.base.logic.callback.SuccessCallback; | @@ -17,6 +17,7 @@ import com.cnlive.libs.base.logic.callback.SuccessCallback; | ||
| 17 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | 17 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 18 | import com.cnlive.moudle.pedometer.frame.view.RunningFinishFragmentView; | 18 | import com.cnlive.moudle.pedometer.frame.view.RunningFinishFragmentView; |
| 19 | import com.cnlive.moudle.pedometer.model.Constant; | 19 | import com.cnlive.moudle.pedometer.model.Constant; |
| 20 | +import com.cnlive.moudle.pedometer.model.MessageEvent; | ||
| 20 | import com.cnlive.moudle.pedometer.model.RunningFinishBean; | 21 | import com.cnlive.moudle.pedometer.model.RunningFinishBean; |
| 21 | import com.cnlive.moudle.pedometer.net.ApiServiceRunLin; | 22 | import com.cnlive.moudle.pedometer.net.ApiServiceRunLin; |
| 22 | import com.cnlive.moudle.pedometer.net.SubscriptionRequest; | 23 | import com.cnlive.moudle.pedometer.net.SubscriptionRequest; |
| @@ -32,6 +33,8 @@ import com.cnlive.moudle.pedometer.utils.StepUtil; | @@ -32,6 +33,8 @@ import com.cnlive.moudle.pedometer.utils.StepUtil; | ||
| 32 | import com.example.moudle_pedometer.R; | 33 | import com.example.moudle_pedometer.R; |
| 33 | import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; | 34 | import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; |
| 34 | 35 | ||
| 36 | +import org.greenrobot.eventbus.EventBus; | ||
| 37 | + | ||
| 35 | import java.util.ArrayList; | 38 | import java.util.ArrayList; |
| 36 | import java.util.HashMap; | 39 | import java.util.HashMap; |
| 37 | import java.util.List; | 40 | import java.util.List; |
| @@ -135,11 +138,12 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter<RunningFinis | @@ -135,11 +138,12 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter<RunningFinis | ||
| 135 | dialog.dismiss(); | 138 | dialog.dismiss(); |
| 136 | StepUtil.clearRunData(context, CommonInfo.getUserId(context)); | 139 | StepUtil.clearRunData(context, CommonInfo.getUserId(context)); |
| 137 | CommonInfo.reset(context); | 140 | CommonInfo.reset(context); |
| 141 | + //用户跑完了,更新一下按钮 | ||
| 142 | + EventBus.getDefault().post(new MessageEvent(Constant.UPDATE_RACE_STATE_BTN, "")); | ||
| 138 | //跳转到上传失败列表 | 143 | //跳转到上传失败列表 |
| 139 | LineUpAgainActivity.newInstance(context); | 144 | LineUpAgainActivity.newInstance(context); |
| 140 | //关闭当前窗口 | 145 | //关闭当前窗口 |
| 141 | context.finish(); | 146 | context.finish(); |
| 142 | - | ||
| 143 | } | 147 | } |
| 144 | }); | 148 | }); |
| 145 | uploadFailDialog.setCanceledOnTouchOutside(false); | 149 | uploadFailDialog.setCanceledOnTouchOutside(false); |
| @@ -170,7 +174,8 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter<RunningFinis | @@ -170,7 +174,8 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter<RunningFinis | ||
| 170 | //删除当前跑步数据 | 174 | //删除当前跑步数据 |
| 171 | StepUtil.clearRunData(context, CommonInfo.getUserId(context)); | 175 | StepUtil.clearRunData(context, CommonInfo.getUserId(context)); |
| 172 | CommonInfo.reset(context); | 176 | CommonInfo.reset(context); |
| 173 | - | 177 | + //用户跑完了,更新一下按钮 |
| 178 | + EventBus.getDefault().post(new MessageEvent(Constant.UPDATE_RACE_STATE_BTN, "")); | ||
| 174 | } | 179 | } |
| 175 | }).start(); | 180 | }).start(); |
| 176 | } | 181 | } |
| @@ -346,11 +351,14 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter<RunningFinis | @@ -346,11 +351,14 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter<RunningFinis | ||
| 346 | dialog.dismiss(); | 351 | dialog.dismiss(); |
| 347 | StepUtil.clearRunData(context, CommonInfo.getUserId(context)); | 352 | StepUtil.clearRunData(context, CommonInfo.getUserId(context)); |
| 348 | CommonInfo.reset(context); | 353 | CommonInfo.reset(context); |
| 354 | + //用户跑完了,更新一下按钮 | ||
| 355 | + EventBus.getDefault().post(new MessageEvent(Constant.UPDATE_RACE_STATE_BTN,"")); | ||
| 349 | //跳转到上传失败列表 | 356 | //跳转到上传失败列表 |
| 350 | LineUpAgainActivity.newInstance(context); | 357 | LineUpAgainActivity.newInstance(context); |
| 351 | //关闭当前窗口 | 358 | //关闭当前窗口 |
| 352 | context.finish(); | 359 | context.finish(); |
| 353 | - | 360 | + //用户跑完了,更新一下按钮 |
| 361 | + EventBus.getDefault().post(new MessageEvent(Constant.UPDATE_RACE_STATE_BTN, "")); | ||
| 354 | } | 362 | } |
| 355 | }); | 363 | }); |
| 356 | failTraceDialog.setCanceledOnTouchOutside(false); | 364 | failTraceDialog.setCanceledOnTouchOutside(false); |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/RunningMapFragmentPresenter.java
| @@ -336,14 +336,14 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | @@ -336,14 +336,14 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | ||
| 336 | } | 336 | } |
| 337 | } | 337 | } |
| 338 | if (importPoints != null && resultPoints != null) { | 338 | if (importPoints != null && resultPoints != null) { |
| 339 | - boolean isFinish = MyMapUtil.checkIsFinishTrace(importPoints, resultPoints, 0.6); | ||
| 340 | - if (isFinish) { | ||
| 341 | - Toast.makeText(context, "已完成", Toast.LENGTH_LONG).show(); | ||
| 342 | - | ||
| 343 | - } else { | ||
| 344 | - Toast.makeText(context, "没有完成", Toast.LENGTH_LONG).show(); | ||
| 345 | - | ||
| 346 | - } | 339 | +// boolean isFinish = MyMapUtil.checkIsFinishTrace(importPoints, resultPoints, 0.6); |
| 340 | +// if (isFinish) { | ||
| 341 | +// Toast.makeText(context, "已完成", Toast.LENGTH_LONG).show(); | ||
| 342 | +// | ||
| 343 | +// } else { | ||
| 344 | +// Toast.makeText(context, "没有完成", Toast.LENGTH_LONG).show(); | ||
| 345 | +// | ||
| 346 | +// } | ||
| 347 | if (isPause) { | 347 | if (isPause) { |
| 348 | MyMapUtil.drawRealTimeTrack(context, getView().baiduMap, resultPoints, SortType.asc, R.color.red, R.drawable.icon_start); | 348 | MyMapUtil.drawRealTimeTrack(context, getView().baiduMap, resultPoints, SortType.asc, R.color.red, R.drawable.icon_start); |
| 349 | } else { | 349 | } else { |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/ALLScoreDetailFragmentView.java
| @@ -9,10 +9,12 @@ import android.widget.LinearLayout; | @@ -9,10 +9,12 @@ import android.widget.LinearLayout; | ||
| 9 | import com.baidu.mapapi.map.BaiduMap; | 9 | import com.baidu.mapapi.map.BaiduMap; |
| 10 | import com.baidu.mapapi.map.MapView; | 10 | import com.baidu.mapapi.map.MapView; |
| 11 | import com.baidu.mapapi.map.UiSettings; | 11 | import com.baidu.mapapi.map.UiSettings; |
| 12 | +import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | ||
| 12 | import com.cnlive.moudle.pedometer.model.RunningFinishBean; | 13 | import com.cnlive.moudle.pedometer.model.RunningFinishBean; |
| 13 | import com.cnlive.moudle.pedometer.ui.fragment.ALLScoreDetailFragment; | 14 | import com.cnlive.moudle.pedometer.ui.fragment.ALLScoreDetailFragment; |
| 14 | import com.cnlive.moudle.pedometer.utils.ScreenUtil; | 15 | import com.cnlive.moudle.pedometer.utils.ScreenUtil; |
| 15 | import com.cnlive.moudle.pedometer.utils.TimeUtil; | 16 | import com.cnlive.moudle.pedometer.utils.TimeUtil; |
| 17 | +import com.cnlive.strike.application.GlideApp; | ||
| 16 | import com.example.moudle_pedometer.R; | 18 | import com.example.moudle_pedometer.R; |
| 17 | import com.hannesdorfmann.mosby3.mvp.MvpView; | 19 | import com.hannesdorfmann.mosby3.mvp.MvpView; |
| 18 | 20 | ||
| @@ -42,6 +44,17 @@ public class ALLScoreDetailFragmentView implements MvpView { | @@ -42,6 +44,17 @@ public class ALLScoreDetailFragmentView implements MvpView { | ||
| 42 | ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) fragment.binding.scrollView.getLayoutParams(); | 44 | ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) fragment.binding.scrollView.getLayoutParams(); |
| 43 | params.bottomMargin = ScreenUtil.dip2px(getContext(), 20); | 45 | params.bottomMargin = ScreenUtil.dip2px(getContext(), 20); |
| 44 | fragment.binding.scrollView.setLayoutParams(params); | 46 | fragment.binding.scrollView.setLayoutParams(params); |
| 47 | + //设置用户头像 | ||
| 48 | + //设置用户昵称 | ||
| 49 | + String nickName = CommonInfo.getUserNickName(getContext()); | ||
| 50 | + fragment.binding.includeFinishUserInfo.tvUserNickName.setText(nickName); | ||
| 51 | + //设置用户头像 | ||
| 52 | + String faceUrl = CommonInfo.getUserIcon(getContext()); | ||
| 53 | + if (!TextUtils.isEmpty(faceUrl)) { | ||
| 54 | + GlideApp.with(getContext()).load(faceUrl).into(fragment.binding.includeFinishUserInfo.qmIvIcon); | ||
| 55 | + }else { | ||
| 56 | + GlideApp.with(getContext()).load(getContext().getResources().getString(R.string.default_face_url)).into(fragment.binding.includeFinishUserInfo.qmIvIcon); | ||
| 57 | + } | ||
| 45 | //隐藏开始按钮 | 58 | //隐藏开始按钮 |
| 46 | fragment.binding.rlScrollViewStartBtn.setVisibility(View.GONE); | 59 | fragment.binding.rlScrollViewStartBtn.setVisibility(View.GONE); |
| 47 | //设置标题 | 60 | //设置标题 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/OnGoingFragmentView.java
| @@ -238,7 +238,7 @@ public class OnGoingFragmentView implements MvpView { | @@ -238,7 +238,7 @@ public class OnGoingFragmentView implements MvpView { | ||
| 238 | fragment.binding.includeStreet.tvAddress.setText(runRaceDetailInfo.getAddress()); | 238 | fragment.binding.includeStreet.tvAddress.setText(runRaceDetailInfo.getAddress()); |
| 239 | //设置活动距离 | 239 | //设置活动距离 |
| 240 | if (!TextUtils.isEmpty(runRaceDetailInfo.getMileage())) { | 240 | if (!TextUtils.isEmpty(runRaceDetailInfo.getMileage())) { |
| 241 | - fragment.binding.includeStreet.tvAddress.append("\t\t" + runRaceDetailInfo.getMileage()); | 241 | + fragment.binding.includeStreet.tvAddress.append("\t\t" + runRaceDetailInfo.getMileage()+"公里"); |
| 242 | } | 242 | } |
| 243 | } | 243 | } |
| 244 | 244 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RegistrationInfoView.java
| @@ -47,17 +47,17 @@ public class RegistrationInfoView implements MvpView, OnDateSetListener { | @@ -47,17 +47,17 @@ public class RegistrationInfoView implements MvpView, OnDateSetListener { | ||
| 47 | fragment.getActivity().finish(); | 47 | fragment.getActivity().finish(); |
| 48 | }); | 48 | }); |
| 49 | fragment.binding.topbar.setTitle("填写报名信息"); | 49 | fragment.binding.topbar.setTitle("填写报名信息"); |
| 50 | - if(CommonInfo.getUserNickName(fragment.getActivity()) != null && CommonInfo.getUserNickName(fragment.getActivity()).trim().length() > 0){ | 50 | + if (CommonInfo.getUserNickName(fragment.getActivity()) != null && CommonInfo.getUserNickName(fragment.getActivity()).trim().length() > 0) { |
| 51 | fragment.binding.userName.setText(CommonInfo.getUserNickName(fragment.getActivity())); | 51 | fragment.binding.userName.setText(CommonInfo.getUserNickName(fragment.getActivity())); |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | - if(CommonInfo.getUserPhone(fragment.getActivity()) != null && CommonInfo.getUserPhone(fragment.getActivity()).trim().length() > 0){ | 54 | + if (CommonInfo.getUserPhone(fragment.getActivity()) != null && CommonInfo.getUserPhone(fragment.getActivity()).trim().length() > 0) { |
| 55 | fragment.binding.phoneNum.setText(CommonInfo.getUserPhone(fragment.getActivity())); | 55 | fragment.binding.phoneNum.setText(CommonInfo.getUserPhone(fragment.getActivity())); |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | - if(CommonInfo.getUserIcon(fragment.getActivity()) != null && CommonInfo.getUserIcon(fragment.getActivity()).trim().length() > 0){ | 58 | + if (CommonInfo.getUserIcon(fragment.getActivity()) != null && CommonInfo.getUserIcon(fragment.getActivity()).trim().length() > 0) { |
| 59 | Glide.with(fragment.getActivity()).load(CommonInfo.getUserIcon(fragment.getActivity())) | 59 | Glide.with(fragment.getActivity()).load(CommonInfo.getUserIcon(fragment.getActivity())) |
| 60 | - .apply(RequestOptions.bitmapTransform(new CircleCrop()).placeholder(R.drawable.ic_icon)).into( fragment.binding.userIcon); | 60 | + .apply(RequestOptions.bitmapTransform(new CircleCrop()).placeholder(R.drawable.ic_icon)).into(fragment.binding.userIcon); |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | if(CommonInfo.getSex(fragment.getActivity(),userId) != null && CommonInfo.getSex(fragment.getActivity(),userId).trim().length() > 0){ | 63 | if(CommonInfo.getSex(fragment.getActivity(),userId) != null && CommonInfo.getSex(fragment.getActivity(),userId).trim().length() > 0){ |
| @@ -124,7 +124,7 @@ public class RegistrationInfoView implements MvpView, OnDateSetListener { | @@ -124,7 +124,7 @@ public class RegistrationInfoView implements MvpView, OnDateSetListener { | ||
| 124 | 124 | ||
| 125 | public void toResult() { | 125 | public void toResult() { |
| 126 | EventBus.getDefault().post(new MessageEvent(Constant.REGISTRATION_SUCCESS, "")); | 126 | EventBus.getDefault().post(new MessageEvent(Constant.REGISTRATION_SUCCESS, "")); |
| 127 | - AlertUtil.showLongToast(fragment.getActivity(),"恭喜你报名成功",3000); | 127 | + AlertUtil.showLongToast(fragment.getActivity(), "恭喜你报名成功", 3000); |
| 128 | fragment.getActivity().finish(); | 128 | fragment.getActivity().finish(); |
| 129 | } | 129 | } |
| 130 | 130 | ||
| @@ -140,4 +140,22 @@ public class RegistrationInfoView implements MvpView, OnDateSetListener { | @@ -140,4 +140,22 @@ public class RegistrationInfoView implements MvpView, OnDateSetListener { | ||
| 140 | AlertUtil.showDeftToast(fragment.getActivity(),"无法选择该日期"); | 140 | AlertUtil.showDeftToast(fragment.getActivity(),"无法选择该日期"); |
| 141 | } | 141 | } |
| 142 | } | 142 | } |
| 143 | + | ||
| 144 | + /** | ||
| 145 | + * 不允许点击 | ||
| 146 | + */ | ||
| 147 | + public void limitClickRegistBtn() { | ||
| 148 | + fragment.binding.commitInfo.setClickable(false); | ||
| 149 | + fragment.binding.commitInfo.setFocusableInTouchMode(false); | ||
| 150 | + fragment.binding.commitInfo.setFocusable(false); | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + /** | ||
| 154 | + * 允许点击 | ||
| 155 | + */ | ||
| 156 | + public void allowClickRegistBtn() { | ||
| 157 | + fragment.binding.commitInfo.setClickable(true); | ||
| 158 | + fragment.binding.commitInfo.setFocusableInTouchMode(true); | ||
| 159 | + fragment.binding.commitInfo.setFocusable(true); | ||
| 160 | + } | ||
| 143 | } | 161 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunMainFragmentView.java
| @@ -192,6 +192,7 @@ public class RunMainFragmentView implements MvpView { | @@ -192,6 +192,7 @@ public class RunMainFragmentView implements MvpView { | ||
| 192 | firstTimeFlag = true; | 192 | firstTimeFlag = true; |
| 193 | handler = new Handler(); | 193 | handler = new Handler(); |
| 194 | timeCountDown = 4; | 194 | timeCountDown = 4; |
| 195 | + fragment.binding.llRunMainRoot.setBackgroundColor(getContext().getResources().getColor(R.color.run_main_bg)); | ||
| 195 | //开始时间倒计时 | 196 | //开始时间倒计时 |
| 196 | runnable = new Runnable() { | 197 | runnable = new Runnable() { |
| 197 | @Override | 198 | @Override |
| @@ -209,7 +210,6 @@ public class RunMainFragmentView implements MvpView { | @@ -209,7 +210,6 @@ public class RunMainFragmentView implements MvpView { | ||
| 209 | } else { | 210 | } else { |
| 210 | ButtonAnimUtil.startAnimation(fragment.binding.llStartTimeTip, true); | 211 | ButtonAnimUtil.startAnimation(fragment.binding.llStartTimeTip, true); |
| 211 | fragment.binding.llRunMainRoot.setVisibility(View.VISIBLE); | 212 | fragment.binding.llRunMainRoot.setVisibility(View.VISIBLE); |
| 212 | - fragment.binding.llRunMainRoot.setBackgroundColor(getContext().getResources().getColor(R.color.run_main_bg)); | ||
| 213 | new Handler().postDelayed(new Runnable() { | 213 | new Handler().postDelayed(new Runnable() { |
| 214 | @Override | 214 | @Override |
| 215 | public void run() { | 215 | public void run() { |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunRaceDetailFragmentView.java
| @@ -39,6 +39,7 @@ import com.baidu.mapapi.utils.DistanceUtil; | @@ -39,6 +39,7 @@ import com.baidu.mapapi.utils.DistanceUtil; | ||
| 39 | import com.baidu.trace.LBSTraceClient; | 39 | import com.baidu.trace.LBSTraceClient; |
| 40 | import com.baidu.trace.model.SortType; | 40 | import com.baidu.trace.model.SortType; |
| 41 | import com.cnlive.libs.base.application.AppConfig; | 41 | import com.cnlive.libs.base.application.AppConfig; |
| 42 | +import com.cnlive.libs.base.util.AlertUtil; | ||
| 42 | import com.cnlive.libs.base.util.StatusBarUtil2; | 43 | import com.cnlive.libs.base.util.StatusBarUtil2; |
| 43 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | 44 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 44 | import com.cnlive.moudle.pedometer.model.Constant; | 45 | import com.cnlive.moudle.pedometer.model.Constant; |
| @@ -112,6 +113,14 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -112,6 +113,14 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 112 | private final float DEFAULT_MAP_AUTO_ZOOM = -0.8f;//根据点位,自动缩放的比例 | 113 | private final float DEFAULT_MAP_AUTO_ZOOM = -0.8f;//根据点位,自动缩放的比例 |
| 113 | private List<LatLng> queryResultPoints;//查询到的历史轨迹 | 114 | private List<LatLng> queryResultPoints;//查询到的历史轨迹 |
| 114 | private List<String> joinFaceIcon;//参与活动人数 | 115 | private List<String> joinFaceIcon;//参与活动人数 |
| 116 | + private final String BTN_REGIST_NOT_START = "1";//报名未开始 | ||
| 117 | + private final String BTN_REGIST_RACE = "2";//立即报名 | ||
| 118 | + private final String BTN_RACE_NOT_START = "3";//活动未开始 | ||
| 119 | + private final String BTN_REGIST_TIME_GONE = "4";//过了报名时间 | ||
| 120 | + private final String BTN_START_RACE = "5";//立即开始 | ||
| 121 | + private final String BTN_END_RACE = "6";//赛事已结束 | ||
| 122 | + private final String BTN_CONTINUE_RACE = "7";//继续运动 | ||
| 123 | + | ||
| 115 | 124 | ||
| 116 | public RunRaceDetailFragmentView(RunRaceDetailFragment fragment) { | 125 | public RunRaceDetailFragmentView(RunRaceDetailFragment fragment) { |
| 117 | this.fragment = fragment; | 126 | this.fragment = fragment; |
| @@ -171,6 +180,10 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -171,6 +180,10 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 171 | // fragment.binding.includeStreet.rlStartBtn.setVisibility(View.VISIBLE); | 180 | // fragment.binding.includeStreet.rlStartBtn.setVisibility(View.VISIBLE); |
| 172 | //设置底部卡片第一次可滑动的位置 | 181 | //设置底部卡片第一次可滑动的位置 |
| 173 | fragment.binding.slidingLayout.setAnchorPoint(0.6f); | 182 | fragment.binding.slidingLayout.setAnchorPoint(0.6f); |
| 183 | + LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); | ||
| 184 | + layoutParams.setMargins(ScreenUtil.dip2px(getContext(), 15), 0, ScreenUtil.dip2px(getContext(), 15), 0); | ||
| 185 | + fragment.binding.includeStreet.llFirstPanelRoot.setLayoutParams(layoutParams); | ||
| 186 | + fragment.binding.includeStreet.llBottomPanel.setLayoutParams(layoutParams); | ||
| 174 | fragment.binding.slidingLayout.addPanelSlideListener(new SlidingUpPanelLayout.PanelSlideListener() { | 187 | fragment.binding.slidingLayout.addPanelSlideListener(new SlidingUpPanelLayout.PanelSlideListener() { |
| 175 | @Override | 188 | @Override |
| 176 | public void onPanelSlide(View panel, float slideOffset) { | 189 | public void onPanelSlide(View panel, float slideOffset) { |
| @@ -184,7 +197,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -184,7 +197,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 184 | StatusBarUtil2.setColor(fragment.getActivity(), getContext().getResources().getColor(R.color.run_main_bg), 0); | 197 | StatusBarUtil2.setColor(fragment.getActivity(), getContext().getResources().getColor(R.color.run_main_bg), 0); |
| 185 | 198 | ||
| 186 | } | 199 | } |
| 187 | - } else if (slideOffset!=0){ | 200 | + } else if (slideOffset != 0) { |
| 188 | if (fragment.binding.flTop.getVisibility() == View.VISIBLE) { | 201 | if (fragment.binding.flTop.getVisibility() == View.VISIBLE) { |
| 189 | QMUIStatusBarHelper.setStatusBarLightMode(fragment.getActivity()); | 202 | QMUIStatusBarHelper.setStatusBarLightMode(fragment.getActivity()); |
| 190 | StatusBarUtil2.setColor(fragment.getActivity(), getContext().getResources().getColor(R.color.white), 0); | 203 | StatusBarUtil2.setColor(fragment.getActivity(), getContext().getResources().getColor(R.color.white), 0); |
| @@ -408,7 +421,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -408,7 +421,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 408 | } | 421 | } |
| 409 | //设置配速 | 422 | //设置配速 |
| 410 | if (!TextUtils.isEmpty(runRaceDetailInfo.getPace())) { | 423 | if (!TextUtils.isEmpty(runRaceDetailInfo.getPace())) { |
| 411 | - fragment.binding.includePersonScore.tvSpeed.setText(runRaceDetailInfo.getPace()); | 424 | + fragment.binding.includePersonScore.tvSpeed.setText(runRaceDetailInfo.getPace().trim()); |
| 412 | } | 425 | } |
| 413 | } else { | 426 | } else { |
| 414 | //隐藏 | 427 | //隐藏 |
| @@ -450,17 +463,20 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -450,17 +463,20 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 450 | GlideApp.with(getContext()).load(runRaceDetailInfo.getRoadmap()).into(fragment.binding.includeStreetIntroduce.ivRoadMao); | 463 | GlideApp.with(getContext()).load(runRaceDetailInfo.getRoadmap()).into(fragment.binding.includeStreetIntroduce.ivRoadMao); |
| 451 | 464 | ||
| 452 | } | 465 | } |
| 453 | - //判断用户是否报名 | ||
| 454 | - if (runRaceDetailInfo.isSignResult()) { | ||
| 455 | - fragment.binding.rlScrollViewStartBtn.setTag("1"); | ||
| 456 | - fragment.binding.tvRunNow.setText("现在开始"); | ||
| 457 | - fragment.binding.tvGoTip.setVisibility(View.VISIBLE); | ||
| 458 | - checkStartBtnState(); | ||
| 459 | - } else { | ||
| 460 | - fragment.binding.rlScrollViewStartBtn.setTag("0"); | ||
| 461 | - fragment.binding.tvRunNow.setText("立即报名"); | ||
| 462 | - fragment.binding.tvGoTip.setVisibility(View.GONE); | ||
| 463 | - } | 466 | + //判断按钮状态 |
| 467 | + initStartBtnState(runRaceDetailInfo); | ||
| 468 | + checkStartBtnState(); | ||
| 469 | +// //判断用户是否报名 | ||
| 470 | +// if (runRaceDetailInfo.isSignResult()) { | ||
| 471 | +// fragment.binding.rlScrollViewStartBtn.setTag(BTN_START_RACE); | ||
| 472 | +// fragment.binding.tvRunNow.setText("现在开始"); | ||
| 473 | +// fragment.binding.tvGoTip.setVisibility(View.VISIBLE); | ||
| 474 | +// checkStartBtnState(); | ||
| 475 | +// } else { | ||
| 476 | +// fragment.binding.rlScrollViewStartBtn.setTag(BTN_REGIST_RACE); | ||
| 477 | +// fragment.binding.tvRunNow.setText("立即报名"); | ||
| 478 | +// fragment.binding.tvGoTip.setVisibility(View.GONE); | ||
| 479 | +// } | ||
| 464 | 480 | ||
| 465 | // //开始按钮点击事件(未滑动) | 481 | // //开始按钮点击事件(未滑动) |
| 466 | // fragment.binding.includeStreet.rlStartBtn.setOnClickListener(new View.OnClickListener() { | 482 | // fragment.binding.includeStreet.rlStartBtn.setOnClickListener(new View.OnClickListener() { |
| @@ -513,14 +529,27 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -513,14 +529,27 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 513 | fragment.binding.rlScrollViewStartBtn.setOnClickListener(new View.OnClickListener() { | 529 | fragment.binding.rlScrollViewStartBtn.setOnClickListener(new View.OnClickListener() { |
| 514 | @Override | 530 | @Override |
| 515 | public void onClick(View view) { | 531 | public void onClick(View view) { |
| 532 | + //-报名未开始 | ||
| 533 | + if (BTN_REGIST_NOT_START.equals(fragment.binding.rlScrollViewStartBtn.getTag())) { | ||
| 534 | + return; | ||
| 535 | + } | ||
| 516 | //立即报名 | 536 | //立即报名 |
| 517 | - if ("0".equals(fragment.binding.rlScrollViewStartBtn.getTag())) { | 537 | + else if (BTN_REGIST_RACE.equals(fragment.binding.rlScrollViewStartBtn.getTag())) { |
| 518 | if (null != runRaceDetailInfo) { | 538 | if (null != runRaceDetailInfo) { |
| 519 | RegistrationInfoActivity.newInstance(fragment.getActivity(), runRaceDetailInfo.getFenceId()); | 539 | RegistrationInfoActivity.newInstance(fragment.getActivity(), runRaceDetailInfo.getFenceId()); |
| 520 | } | 540 | } |
| 521 | } | 541 | } |
| 542 | + //活动未开始 | ||
| 543 | + else if (BTN_RACE_NOT_START.equals(fragment.binding.rlScrollViewStartBtn.getTag())) { | ||
| 544 | + return; | ||
| 545 | + } | ||
| 546 | + //过了报名时间 | ||
| 547 | + else if (BTN_REGIST_TIME_GONE.equals(fragment.binding.rlScrollViewStartBtn.getTag())) { | ||
| 548 | + return; | ||
| 549 | + } | ||
| 550 | + // | ||
| 522 | //现在开始 | 551 | //现在开始 |
| 523 | - else if ("1".equals(fragment.binding.rlScrollViewStartBtn.getTag())) { | 552 | + else if (BTN_START_RACE.equals(fragment.binding.rlScrollViewStartBtn.getTag())) { |
| 524 | //先判断是否从百度查询到赛事轨迹 | 553 | //先判断是否从百度查询到赛事轨迹 |
| 525 | if (null != endLatLng && null != startLatLng) { | 554 | if (null != endLatLng && null != startLatLng) { |
| 526 | //开始比较距离 | 555 | //开始比较距离 |
| @@ -549,7 +578,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -549,7 +578,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 549 | } | 578 | } |
| 550 | } | 579 | } |
| 551 | //继续运动 | 580 | //继续运动 |
| 552 | - else if ("2".equals(fragment.binding.rlScrollViewStartBtn.getTag())) { | 581 | + else if (BTN_CONTINUE_RACE.equals(fragment.binding.rlScrollViewStartBtn.getTag())) { |
| 553 | if (!isDifferentStreet) { | 582 | if (!isDifferentStreet) { |
| 554 | SelectDialog continueTipDialog = new SelectDialog(getContext(), "是否继续运动", "否", new SelectDialog.DialogInterface() { | 583 | SelectDialog continueTipDialog = new SelectDialog(getContext(), "是否继续运动", "否", new SelectDialog.DialogInterface() { |
| 555 | @Override | 584 | @Override |
| @@ -563,7 +592,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -563,7 +592,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 563 | dialog.dismiss(); | 592 | dialog.dismiss(); |
| 564 | //重置按钮 | 593 | //重置按钮 |
| 565 | fragment.binding.tvRunNow.setText("立即开始"); | 594 | fragment.binding.tvRunNow.setText("立即开始"); |
| 566 | - fragment.binding.rlScrollViewStartBtn.setTag("1"); | 595 | + fragment.binding.rlScrollViewStartBtn.setTag(BTN_START_RACE); |
| 567 | } | 596 | } |
| 568 | }, "是", new SelectDialog.DialogInterface() { | 597 | }, "是", new SelectDialog.DialogInterface() { |
| 569 | @Override | 598 | @Override |
| @@ -592,7 +621,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -592,7 +621,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 592 | CommonInfo.resetRace(getContext()); | 621 | CommonInfo.resetRace(getContext()); |
| 593 | //更改当前按钮 | 622 | //更改当前按钮 |
| 594 | fragment.binding.tvRunNow.setText("立即开始"); | 623 | fragment.binding.tvRunNow.setText("立即开始"); |
| 595 | - fragment.binding.rlScrollViewStartBtn.setTag("1"); | 624 | + fragment.binding.rlScrollViewStartBtn.setTag(BTN_START_RACE); |
| 596 | 625 | ||
| 597 | } | 626 | } |
| 598 | }, "是", new SelectDialog.DialogInterface() { | 627 | }, "是", new SelectDialog.DialogInterface() { |
| @@ -606,6 +635,8 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -606,6 +635,8 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 606 | selectDialog.setCancelable(false); | 635 | selectDialog.setCancelable(false); |
| 607 | selectDialog.show(); | 636 | selectDialog.show(); |
| 608 | } | 637 | } |
| 638 | + } else if (BTN_END_RACE.equals(fragment.binding.rlScrollViewStartBtn.getTag())) { | ||
| 639 | + return; | ||
| 609 | } | 640 | } |
| 610 | } | 641 | } |
| 611 | }); | 642 | }); |
| @@ -640,6 +671,56 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -640,6 +671,56 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 640 | }); | 671 | }); |
| 641 | } | 672 | } |
| 642 | 673 | ||
| 674 | + /** | ||
| 675 | + * 设置报名按钮状态 | ||
| 676 | + * | ||
| 677 | + * @param runRaceDetailInfo | ||
| 678 | + */ | ||
| 679 | + private void initStartBtnState(RunRaceDetailInfo runRaceDetailInfo) { | ||
| 680 | + //报名未开始 | ||
| 681 | + if (BTN_REGIST_NOT_START.equals(runRaceDetailInfo.getEventState())) { | ||
| 682 | + fragment.binding.rlScrollViewStartBtn.setTag(BTN_REGIST_NOT_START); | ||
| 683 | + fragment.binding.tvRunNow.setText("报名未开始"); | ||
| 684 | + fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.gray_round)); | ||
| 685 | + fragment.binding.tvGoTip.setVisibility(View.GONE); | ||
| 686 | + } | ||
| 687 | + //立即报名 | ||
| 688 | + else if (BTN_REGIST_RACE.equals(runRaceDetailInfo.getEventState())) { | ||
| 689 | + fragment.binding.rlScrollViewStartBtn.setTag(BTN_REGIST_RACE); | ||
| 690 | + fragment.binding.tvRunNow.setText("立即报名"); | ||
| 691 | + fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.green_round)); | ||
| 692 | + fragment.binding.tvGoTip.setVisibility(View.GONE); | ||
| 693 | + } | ||
| 694 | + //活动未开始 | ||
| 695 | + else if (BTN_RACE_NOT_START.equals(runRaceDetailInfo.getEventState())) { | ||
| 696 | + fragment.binding.rlScrollViewStartBtn.setTag(BTN_RACE_NOT_START); | ||
| 697 | + fragment.binding.tvRunNow.setText("活动未开始"); | ||
| 698 | + fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.gray_round)); | ||
| 699 | + fragment.binding.tvGoTip.setVisibility(View.GONE); | ||
| 700 | + } | ||
| 701 | + //过了报名时间 | ||
| 702 | + else if (BTN_REGIST_TIME_GONE.equals(runRaceDetailInfo.getEventState())) { | ||
| 703 | + fragment.binding.rlScrollViewStartBtn.setTag(BTN_REGIST_TIME_GONE); | ||
| 704 | + fragment.binding.tvRunNow.setText("报名时间已过"); | ||
| 705 | + fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.gray_round)); | ||
| 706 | + fragment.binding.tvGoTip.setVisibility(View.GONE); | ||
| 707 | + } | ||
| 708 | + //立即开始活动 | ||
| 709 | + else if (BTN_START_RACE.equals(runRaceDetailInfo.getEventState())) { | ||
| 710 | + fragment.binding.rlScrollViewStartBtn.setTag(BTN_START_RACE); | ||
| 711 | + fragment.binding.tvRunNow.setText("立即开始"); | ||
| 712 | + fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.green_round)); | ||
| 713 | + fragment.binding.tvGoTip.setVisibility(View.VISIBLE); | ||
| 714 | + } | ||
| 715 | + //报名结束 | ||
| 716 | + else if (BTN_END_RACE.equals(runRaceDetailInfo.getEventState())) { | ||
| 717 | + fragment.binding.rlScrollViewStartBtn.setTag(BTN_START_RACE); | ||
| 718 | + fragment.binding.tvRunNow.setText("赛事已结束"); | ||
| 719 | + fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.gray_round)); | ||
| 720 | + fragment.binding.tvGoTip.setVisibility(View.VISIBLE); | ||
| 721 | + } | ||
| 722 | + } | ||
| 723 | + | ||
| 643 | private void checkBaiduServiceState() { | 724 | private void checkBaiduServiceState() { |
| 644 | CommonInfo.setIsRunKeepAliveService(getContext(), true); | 725 | CommonInfo.setIsRunKeepAliveService(getContext(), true); |
| 645 | CommonInfo.setIsRunStepService(getContext(), true); | 726 | CommonInfo.setIsRunStepService(getContext(), true); |
| @@ -1019,15 +1100,16 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -1019,15 +1100,16 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 1019 | if ((currnetTime - userPauseTime) <= (9 * 60 * 60 * 1000)) { | 1100 | if ((currnetTime - userPauseTime) <= (9 * 60 * 60 * 1000)) { |
| 1020 | Log.e(TAG, "小于9小时"); | 1101 | Log.e(TAG, "小于9小时"); |
| 1021 | fragment.binding.tvRunNow.setText("继续运动"); | 1102 | fragment.binding.tvRunNow.setText("继续运动"); |
| 1022 | - fragment.binding.rlScrollViewStartBtn.setTag("2"); | 1103 | + fragment.binding.rlScrollViewStartBtn.setTag(BTN_CONTINUE_RACE); |
| 1023 | } else { | 1104 | } else { |
| 1024 | Log.e(TAG, "大于9小时"); | 1105 | Log.e(TAG, "大于9小时"); |
| 1025 | //重置数据 | 1106 | //重置数据 |
| 1026 | CommonInfo.resetRace(getContext()); | 1107 | CommonInfo.resetRace(getContext()); |
| 1027 | //清空数据库 | 1108 | //清空数据库 |
| 1028 | StepUtil.clearRunData(getContext(), CommonInfo.getUserId(getContext())); | 1109 | StepUtil.clearRunData(getContext(), CommonInfo.getUserId(getContext())); |
| 1029 | - fragment.binding.tvRunNow.setText("立即开始"); | ||
| 1030 | - fragment.binding.rlScrollViewStartBtn.setTag("1"); | 1110 | + if (null != runRaceDetailInfo) { |
| 1111 | + initStartBtnState(runRaceDetailInfo); | ||
| 1112 | + } | ||
| 1031 | 1113 | ||
| 1032 | } | 1114 | } |
| 1033 | 1115 | ||
| @@ -1039,19 +1121,10 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -1039,19 +1121,10 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 1039 | isDifferentStreet = true; | 1121 | isDifferentStreet = true; |
| 1040 | } | 1122 | } |
| 1041 | //判断赛事是否已经结束 | 1123 | //判断赛事是否已经结束 |
| 1042 | - checkTheRaceIsEnd(); | 1124 | +// checkTheRaceIsEnd(); |
| 1043 | } else { | 1125 | } else { |
| 1044 | - if (null == runRaceDetailInfo) { | ||
| 1045 | - return; | ||
| 1046 | - } | ||
| 1047 | - if (runRaceDetailInfo.isSignResult()) { | ||
| 1048 | - fragment.binding.rlScrollViewStartBtn.setTag("1"); | ||
| 1049 | - fragment.binding.tvRunNow.setText("现在开始"); | ||
| 1050 | - fragment.binding.tvGoTip.setVisibility(View.VISIBLE); | ||
| 1051 | - } else { | ||
| 1052 | - fragment.binding.rlScrollViewStartBtn.setTag("0"); | ||
| 1053 | - fragment.binding.tvRunNow.setText("立即报名"); | ||
| 1054 | - fragment.binding.tvGoTip.setVisibility(View.GONE); | 1126 | + if (null != runRaceDetailInfo) { |
| 1127 | + initStartBtnState(runRaceDetailInfo); | ||
| 1055 | } | 1128 | } |
| 1056 | } | 1129 | } |
| 1057 | 1130 | ||
| @@ -1061,52 +1134,44 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -1061,52 +1134,44 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 1061 | /** | 1134 | /** |
| 1062 | * 判断赛事是否已经结束 | 1135 | * 判断赛事是否已经结束 |
| 1063 | */ | 1136 | */ |
| 1064 | - private void checkTheRaceIsEnd() { | ||
| 1065 | - //判断赛事是否结束 | ||
| 1066 | - if (null != userStepEntity) { | ||
| 1067 | - if (null != runRaceDetailInfo) { | ||
| 1068 | - //判断赛事id是否一致 | ||
| 1069 | - if (!TextUtils.isEmpty(userStepEntity.getStreetId())) { | ||
| 1070 | - if (userStepEntity.getStreetId().equals(CommonInfo.getStreetId(getContext()))) { | ||
| 1071 | - //判断赛事是否结束 | ||
| 1072 | - if (runRaceDetailInfo.isEndState()) { | ||
| 1073 | - //结束清除数据 | ||
| 1074 | - //清空上次保存数据 | ||
| 1075 | - StepUtil.clearRunData(getContext(), CommonInfo.getUserId(getContext())); | ||
| 1076 | - //停止服务 | ||
| 1077 | - stopStepService(); | ||
| 1078 | - //清除数据 | ||
| 1079 | - CommonInfo.resetRace(getContext()); | ||
| 1080 | - //设置按钮状态 | ||
| 1081 | - fragment.binding.rlScrollViewStartBtn.setTag("3"); | ||
| 1082 | - fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.red_round)); | ||
| 1083 | - fragment.binding.tvRunNow.setText("赛事已结束"); | ||
| 1084 | - fragment.binding.tvGoTip.setVisibility(View.GONE); | ||
| 1085 | - } | ||
| 1086 | - } | ||
| 1087 | - } | ||
| 1088 | - } | ||
| 1089 | - } else { | ||
| 1090 | - //如果数据库中没有数据,即,用户在当前赛事已经结束 | ||
| 1091 | - if (null != runRaceDetailInfo) { | ||
| 1092 | - if (runRaceDetailInfo.isEndState()) { | ||
| 1093 | - //设置按钮状态 | ||
| 1094 | - fragment.binding.rlScrollViewStartBtn.setTag("3"); | ||
| 1095 | - fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.red_round)); | ||
| 1096 | - fragment.binding.tvRunNow.setText("赛事已结束"); | ||
| 1097 | - fragment.binding.tvGoTip.setVisibility(View.GONE); | ||
| 1098 | - } | ||
| 1099 | - } | ||
| 1100 | - } | ||
| 1101 | - } | ||
| 1102 | - | ||
| 1103 | - /** | ||
| 1104 | - * 赛事已经结束 | ||
| 1105 | - */ | ||
| 1106 | - private void raceHasEnd() { | ||
| 1107 | - | ||
| 1108 | - } | ||
| 1109 | - | 1137 | +// private void checkTheRaceIsEnd() { |
| 1138 | +// //判断赛事是否结束 | ||
| 1139 | +// if (null != userStepEntity) { | ||
| 1140 | +// if (null != runRaceDetailInfo) { | ||
| 1141 | +// //判断赛事id是否一致 | ||
| 1142 | +// if (!TextUtils.isEmpty(userStepEntity.getStreetId())) { | ||
| 1143 | +// if (userStepEntity.getStreetId().equals(CommonInfo.getStreetId(getContext()))) { | ||
| 1144 | +// //判断赛事是否结束 | ||
| 1145 | +// if (runRaceDetailInfo.isEndState()) { | ||
| 1146 | +// //结束清除数据 | ||
| 1147 | +// //清空上次保存数据 | ||
| 1148 | +// StepUtil.clearRunData(getContext(), CommonInfo.getUserId(getContext())); | ||
| 1149 | +// //停止服务 | ||
| 1150 | +// stopStepService(); | ||
| 1151 | +// //清除数据 | ||
| 1152 | +// CommonInfo.resetRace(getContext()); | ||
| 1153 | +// //设置按钮状态 | ||
| 1154 | +// fragment.binding.rlScrollViewStartBtn.setTag(BTN_END_RACE); | ||
| 1155 | +// fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.red_round)); | ||
| 1156 | +// fragment.binding.tvRunNow.setText("赛事已结束"); | ||
| 1157 | +// fragment.binding.tvGoTip.setVisibility(View.GONE); | ||
| 1158 | +// } | ||
| 1159 | +// } | ||
| 1160 | +// } | ||
| 1161 | +// } | ||
| 1162 | +// } else { | ||
| 1163 | +// //如果数据库中没有数据,即,用户在当前赛事已经结束 | ||
| 1164 | +// if (null != runRaceDetailInfo) { | ||
| 1165 | +// if (runRaceDetailInfo.isEndState()) { | ||
| 1166 | +// //设置按钮状态 | ||
| 1167 | +// fragment.binding.rlScrollViewStartBtn.setTag(BTN_END_RACE); | ||
| 1168 | +// fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.red_round)); | ||
| 1169 | +// fragment.binding.tvRunNow.setText("赛事已结束"); | ||
| 1170 | +// fragment.binding.tvGoTip.setVisibility(View.GONE); | ||
| 1171 | +// } | ||
| 1172 | +// } | ||
| 1173 | +// } | ||
| 1174 | +// } | ||
| 1110 | public void onPause() { | 1175 | public void onPause() { |
| 1111 | if (mMapView != null) { | 1176 | if (mMapView != null) { |
| 1112 | mMapView.onPause(); | 1177 | mMapView.onPause(); |
| @@ -1138,7 +1203,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -1138,7 +1203,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 1138 | if (isFirstLoc) { | 1203 | if (isFirstLoc) { |
| 1139 | isFirstLoc = false; | 1204 | isFirstLoc = false; |
| 1140 | if (location.getRadius() > Constant.LOCA_ACCURACY) { | 1205 | if (location.getRadius() > Constant.LOCA_ACCURACY) { |
| 1141 | - Toast.makeText(getContext(), "当前定位精度为:" + location.getRadius() + "米,请您移动至空旷地带!", Toast.LENGTH_SHORT).show(); | 1206 | + Toast.makeText(getContext(), "当前定位误差为:" + location.getRadius() + "米,请您移动至空旷地带!", Toast.LENGTH_SHORT).show(); |
| 1142 | } | 1207 | } |
| 1143 | 1208 | ||
| 1144 | } else { | 1209 | } else { |
| @@ -1263,55 +1328,56 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -1263,55 +1328,56 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 1263 | if (getContext() == null) { | 1328 | if (getContext() == null) { |
| 1264 | return; | 1329 | return; |
| 1265 | } | 1330 | } |
| 1266 | - //更新用户头像 | ||
| 1267 | - if (null != joinFaceIcon) { | ||
| 1268 | - //获取用户头像 | ||
| 1269 | - if (TextUtils.isEmpty(CommonInfo.getUserIcon(getContext()))) { | ||
| 1270 | - //添加默认头像 | ||
| 1271 | - joinFaceIcon.add(0, "http://wjj.ys1.cnliveimg.com/769/img/2018/0416/head_c.png"); | ||
| 1272 | - } else { | ||
| 1273 | - //添加用户本身头像 | ||
| 1274 | - joinFaceIcon.add(0, CommonInfo.getUserIcon(getContext())); | ||
| 1275 | - | ||
| 1276 | - } | ||
| 1277 | - } | ||
| 1278 | - //没有一个用户头像 | ||
| 1279 | - else { | ||
| 1280 | - joinFaceIcon = new ArrayList<>(); | ||
| 1281 | - //获取用户头像 | ||
| 1282 | - if (TextUtils.isEmpty(CommonInfo.getUserIcon(getContext()))) { | ||
| 1283 | - //添加默认头像 | ||
| 1284 | - joinFaceIcon.add("http://wjj.ys1.cnliveimg.com/769/img/2018/0416/head_c.png"); | ||
| 1285 | - } else { | ||
| 1286 | - //添加用户本身头像 | ||
| 1287 | - joinFaceIcon.add(CommonInfo.getUserIcon(getContext())); | ||
| 1288 | - | ||
| 1289 | - } | ||
| 1290 | - } | ||
| 1291 | - | ||
| 1292 | - //开始更新头像 | ||
| 1293 | - if (null != joinFaceIcon) { | ||
| 1294 | - fragment.binding.includeStreet.fiveJoinPerson.setVisibility(View.VISIBLE); | ||
| 1295 | - //设置头像数据 | ||
| 1296 | - fragment.binding.includeStreet.fiveJoinPerson.initIconData(joinFaceIcon); | ||
| 1297 | - } | ||
| 1298 | - //更新参与人数 | ||
| 1299 | - if (!TextUtils.isEmpty(fragment.binding.includeStreet.tvSignPerson.getText().toString())) { | ||
| 1300 | - if ("--".equals(fragment.binding.includeStreet.tvSignPerson.getText().toString())) { | ||
| 1301 | - fragment.binding.includeStreet.tvSignPerson.setText("1"); | ||
| 1302 | - } | ||
| 1303 | - if (null != runRaceDetailInfo) { | ||
| 1304 | - fragment.binding.includeStreet.tvSignPerson.setText((runRaceDetailInfo.getSignupNum() + 1) + ""); | ||
| 1305 | - } | ||
| 1306 | - } else { | ||
| 1307 | - fragment.binding.includeStreet.tvSignPerson.setText("1"); | ||
| 1308 | - } | ||
| 1309 | - fragment.binding.rlScrollViewStartBtn.setTag("1"); | ||
| 1310 | - fragment.binding.tvRunNow.setText("现在开始"); | ||
| 1311 | - fragment.binding.tvGoTip.setVisibility(View.VISIBLE); | ||
| 1312 | - if (null != runRaceDetailInfo) { | ||
| 1313 | - runRaceDetailInfo.setSignResult(true); | ||
| 1314 | - } | 1331 | + fragment.getPresenter().getRunRaceDetailInfo(getContext(), CommonInfo.getStreetId(getContext()), CommonInfo.getUserId(getContext()), "0"); |
| 1332 | +// //更新用户头像 | ||
| 1333 | +// if (null != joinFaceIcon) { | ||
| 1334 | +// //获取用户头像 | ||
| 1335 | +// if (TextUtils.isEmpty(CommonInfo.getUserIcon(getContext()))) { | ||
| 1336 | +// //添加默认头像 | ||
| 1337 | +// joinFaceIcon.add(0, "http://wjj.ys1.cnliveimg.com/769/img/2018/0416/head_c.png"); | ||
| 1338 | +// } else { | ||
| 1339 | +// //添加用户本身头像 | ||
| 1340 | +// joinFaceIcon.add(0, CommonInfo.getUserIcon(getContext())); | ||
| 1341 | +// | ||
| 1342 | +// } | ||
| 1343 | +// } | ||
| 1344 | +// //没有一个用户头像 | ||
| 1345 | +// else { | ||
| 1346 | +// joinFaceIcon = new ArrayList<>(); | ||
| 1347 | +// //获取用户头像 | ||
| 1348 | +// if (TextUtils.isEmpty(CommonInfo.getUserIcon(getContext()))) { | ||
| 1349 | +// //添加默认头像 | ||
| 1350 | +// joinFaceIcon.add("http://wjj.ys1.cnliveimg.com/769/img/2018/0416/head_c.png"); | ||
| 1351 | +// } else { | ||
| 1352 | +// //添加用户本身头像 | ||
| 1353 | +// joinFaceIcon.add(CommonInfo.getUserIcon(getContext())); | ||
| 1354 | +// | ||
| 1355 | +// } | ||
| 1356 | +// } | ||
| 1357 | +// | ||
| 1358 | +// //开始更新头像 | ||
| 1359 | +// if (null != joinFaceIcon) { | ||
| 1360 | +// fragment.binding.includeStreet.fiveJoinPerson.setVisibility(View.VISIBLE); | ||
| 1361 | +// //设置头像数据 | ||
| 1362 | +// fragment.binding.includeStreet.fiveJoinPerson.initIconData(joinFaceIcon); | ||
| 1363 | +// } | ||
| 1364 | +// //更新参与人数 | ||
| 1365 | +// if (!TextUtils.isEmpty(fragment.binding.includeStreet.tvSignPerson.getText().toString())) { | ||
| 1366 | +// if ("--".equals(fragment.binding.includeStreet.tvSignPerson.getText().toString())) { | ||
| 1367 | +// fragment.binding.includeStreet.tvSignPerson.setText("1"); | ||
| 1368 | +// } | ||
| 1369 | +// if (null != runRaceDetailInfo) { | ||
| 1370 | +// fragment.binding.includeStreet.tvSignPerson.setText((runRaceDetailInfo.getSignupNum() + 1) + ""); | ||
| 1371 | +// } | ||
| 1372 | +// } else { | ||
| 1373 | +// fragment.binding.includeStreet.tvSignPerson.setText("1"); | ||
| 1374 | +// } | ||
| 1375 | +// if (null != runRaceDetailInfo) { | ||
| 1376 | +// runRaceDetailInfo.setSignResult(true); | ||
| 1377 | +// fragment.binding.rlScrollViewStartBtn.setTag(BTN_START_RACE); | ||
| 1378 | +// fragment.binding.tvRunNow.setText("现在开始"); | ||
| 1379 | +// fragment.binding.tvGoTip.setVisibility(View.VISIBLE); | ||
| 1380 | +// } | ||
| 1315 | } | 1381 | } |
| 1316 | 1382 | ||
| 1317 | } | 1383 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunningFinishFragmentView.java
| @@ -21,6 +21,7 @@ import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; | @@ -21,6 +21,7 @@ import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; | ||
| 21 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; | 21 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; |
| 22 | import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil; | 22 | import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil; |
| 23 | import com.cnlive.moudle.pedometer.utils.StepUtil; | 23 | import com.cnlive.moudle.pedometer.utils.StepUtil; |
| 24 | +import com.cnlive.strike.application.GlideApp; | ||
| 24 | import com.example.moudle_pedometer.R; | 25 | import com.example.moudle_pedometer.R; |
| 25 | import com.hannesdorfmann.mosby3.mvp.MvpView; | 26 | import com.hannesdorfmann.mosby3.mvp.MvpView; |
| 26 | import com.sothree.slidinguppanel.SlidingUpPanelLayout; | 27 | import com.sothree.slidinguppanel.SlidingUpPanelLayout; |
| @@ -53,7 +54,9 @@ public class RunningFinishFragmentView implements MvpView { | @@ -53,7 +54,9 @@ public class RunningFinishFragmentView implements MvpView { | ||
| 53 | //设置用户头像 | 54 | //设置用户头像 |
| 54 | String faceUrl = CommonInfo.getUserIcon(getContext()); | 55 | String faceUrl = CommonInfo.getUserIcon(getContext()); |
| 55 | if (!TextUtils.isEmpty(faceUrl)) { | 56 | if (!TextUtils.isEmpty(faceUrl)) { |
| 56 | - Glide.with(getContext()).load(faceUrl).into(fragment.binding.includeFinishUserInfo.qmIvIcon); | 57 | + GlideApp.with(getContext()).load(faceUrl).into(fragment.binding.includeFinishUserInfo.qmIvIcon); |
| 58 | + }else { | ||
| 59 | + GlideApp.with(getContext()).load(getContext().getResources().getString(R.string.default_face_url)).into(fragment.binding.includeFinishUserInfo.qmIvIcon); | ||
| 57 | } | 60 | } |
| 58 | //设置用户昵称 | 61 | //设置用户昵称 |
| 59 | String nickName = CommonInfo.getUserNickName(getContext()); | 62 | String nickName = CommonInfo.getUserNickName(getContext()); |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunningMapFragmentView.java
| @@ -318,7 +318,7 @@ public class RunningMapFragmentView implements MvpView, SensorEventListener { | @@ -318,7 +318,7 @@ public class RunningMapFragmentView implements MvpView, SensorEventListener { | ||
| 318 | if (isFirstLoc) { | 318 | if (isFirstLoc) { |
| 319 | isFirstLoc = false; | 319 | isFirstLoc = false; |
| 320 | if (location.getRadius() > Constant.LOCA_ACCURACY) { | 320 | if (location.getRadius() > Constant.LOCA_ACCURACY) { |
| 321 | - Toast.makeText(getContext(), "当前定位精度为:" + location.getRadius() + "米,请您移动至空旷地带!", Toast.LENGTH_SHORT).show(); | 321 | + Toast.makeText(getContext(), "当前定位误差为:" + location.getRadius() + "米,请您移动至空旷地带!", Toast.LENGTH_SHORT).show(); |
| 322 | } | 322 | } |
| 323 | 323 | ||
| 324 | 324 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/UploadFailDetailFragmentView.java
| @@ -13,6 +13,7 @@ import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | @@ -13,6 +13,7 @@ import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | ||
| 13 | import com.cnlive.moudle.pedometer.sql.entity.FailedEntity; | 13 | import com.cnlive.moudle.pedometer.sql.entity.FailedEntity; |
| 14 | import com.cnlive.moudle.pedometer.ui.fragment.UploadFailDetailFragment; | 14 | import com.cnlive.moudle.pedometer.ui.fragment.UploadFailDetailFragment; |
| 15 | import com.cnlive.moudle.pedometer.utils.TimeUtil; | 15 | import com.cnlive.moudle.pedometer.utils.TimeUtil; |
| 16 | +import com.cnlive.strike.application.GlideApp; | ||
| 16 | import com.example.moudle_pedometer.R; | 17 | import com.example.moudle_pedometer.R; |
| 17 | import com.hannesdorfmann.mosby3.mvp.MvpView; | 18 | import com.hannesdorfmann.mosby3.mvp.MvpView; |
| 18 | 19 | ||
| @@ -53,7 +54,9 @@ public class UploadFailDetailFragmentView implements MvpView { | @@ -53,7 +54,9 @@ public class UploadFailDetailFragmentView implements MvpView { | ||
| 53 | //设置用户头像 | 54 | //设置用户头像 |
| 54 | String faceUrl = CommonInfo.getUserIcon(getContext()); | 55 | String faceUrl = CommonInfo.getUserIcon(getContext()); |
| 55 | if (!TextUtils.isEmpty(faceUrl)) { | 56 | if (!TextUtils.isEmpty(faceUrl)) { |
| 56 | - Glide.with(getContext()).load(faceUrl).into(fragment.binding.includeFinishUserInfo.qmIvIcon); | 57 | + GlideApp.with(getContext()).load(faceUrl).into(fragment.binding.includeFinishUserInfo.qmIvIcon); |
| 58 | + }else { | ||
| 59 | + GlideApp.with(getContext()).load(getContext().getResources().getString(R.string.default_face_url)).into(fragment.binding.includeFinishUserInfo.qmIvIcon); | ||
| 57 | } | 60 | } |
| 58 | //设置赛事标题 | 61 | //设置赛事标题 |
| 59 | if (!TextUtils.isEmpty(failedEntity.getStreetTitle())) { | 62 | if (!TextUtils.isEmpty(failedEntity.getStreetTitle())) { |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/model/Constant.java
| @@ -22,10 +22,10 @@ public class Constant { | @@ -22,10 +22,10 @@ public class Constant { | ||
| 22 | public static final int DELECT_COLL_BIND_TRACE_LIST = 13;//删除已绑定列表 | 22 | public static final int DELECT_COLL_BIND_TRACE_LIST = 13;//删除已绑定列表 |
| 23 | public static final int SERVICE_STEP_COUNT_ONRESUME = 14;//用户从后台回到前台,更新步数 | 23 | public static final int SERVICE_STEP_COUNT_ONRESUME = 14;//用户从后台回到前台,更新步数 |
| 24 | public static final int COLL_SERVICE_STEP_COUNT_ONRESUME = 15;//运营从后台回到前台,更新步数 | 24 | public static final int COLL_SERVICE_STEP_COUNT_ONRESUME = 15;//运营从后台回到前台,更新步数 |
| 25 | - | ||
| 26 | - | 25 | + public static final int UPDATA_COLL_TRACE_LIST = 16;//更新轨迹列表 |
| 26 | + public static final int UPDATE_RACE_STATE_BTN = 17;//更新赛事详情页按钮数据 | ||
| 27 | /*************************************用户其他值,非标志位************************************************************/ | 27 | /*************************************用户其他值,非标志位************************************************************/ |
| 28 | - public static long SERVICE_ID = 0;//公司账号 | 28 | + public static long SERVICE_ID = 0;//公司账号 |
| 29 | // public static final long SERVICE_ID = 213553; | 29 | // public static final long SERVICE_ID = 213553; |
| 30 | public static final int TAG = 1; | 30 | public static final int TAG = 1; |
| 31 | public static final int GATHER_INTERVAL = 2;//位置采集周期 | 31 | public static final int GATHER_INTERVAL = 2;//位置采集周期 |
| @@ -42,4 +42,5 @@ public class Constant { | @@ -42,4 +42,5 @@ public class Constant { | ||
| 42 | public static final int FENCE_OFFSET = 50;//围栏偏离距离 | 42 | public static final int FENCE_OFFSET = 50;//围栏偏离距离 |
| 43 | public static final int FENCE_DENOISE = 20;//围栏去噪精度 | 43 | public static final int FENCE_DENOISE = 20;//围栏去噪精度 |
| 44 | public static final int TAKE_POINT_MAX_SIZE = 100;//最大打点数量 | 44 | public static final int TAKE_POINT_MAX_SIZE = 100;//最大打点数量 |
| 45 | + public static final int COLL_GEORESULT_RADIUS = 20;//打点逆地理半径 | ||
| 45 | } | 46 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/net/bean/RunRaceDetailInfo.java
| @@ -86,12 +86,21 @@ public class RunRaceDetailInfo implements Serializable { | @@ -86,12 +86,21 @@ public class RunRaceDetailInfo implements Serializable { | ||
| 86 | private String userMileage; | 86 | private String userMileage; |
| 87 | private List<String> faceUrl; | 87 | private List<String> faceUrl; |
| 88 | private List<String> finishFaceUrl; | 88 | private List<String> finishFaceUrl; |
| 89 | + private String eventState;//1-报名未开始 2-立即报名 3-活动未开始 4-过了报名时间 5-立即开始活动 | ||
| 89 | /*********************************后加的,非接口返回,用于*******************************************/ | 90 | /*********************************后加的,非接口返回,用于*******************************************/ |
| 90 | private String endLatLng;//终点坐标,后加的,不是后台返回,这是从百度历史轨迹查出来的 | 91 | private String endLatLng;//终点坐标,后加的,不是后台返回,这是从百度历史轨迹查出来的 |
| 91 | private boolean endState;//活动是否结束(true 结束 false 未结束 ) | 92 | private boolean endState;//活动是否结束(true 结束 false 未结束 ) |
| 92 | private String collStartLatLng;//运营打的点 | 93 | private String collStartLatLng;//运营打的点 |
| 93 | private String collStartLntLngName;//运营打点名称 | 94 | private String collStartLntLngName;//运营打点名称 |
| 94 | 95 | ||
| 96 | + public String getEventState() { | ||
| 97 | + return eventState; | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + public void setEventState(String eventState) { | ||
| 101 | + this.eventState = eventState; | ||
| 102 | + } | ||
| 103 | + | ||
| 95 | public String getCollStartLatLng() { | 104 | public String getCollStartLatLng() { |
| 96 | return collStartLatLng; | 105 | return collStartLatLng; |
| 97 | } | 106 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/service/KeepLiveService.java
| @@ -38,8 +38,8 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion | @@ -38,8 +38,8 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion | ||
| 38 | public static MediaPlayer mMediaPlayer; | 38 | public static MediaPlayer mMediaPlayer; |
| 39 | //广播 | 39 | //广播 |
| 40 | private static ServiceReceiver myReceiver; | 40 | private static ServiceReceiver myReceiver; |
| 41 | - private String CHANNEL_ONE_ID = "com.cnlive.keep"; | ||
| 42 | - private String CHANNEL_ONE_NAME = "KeepLive"; | 41 | + private String CHANNEL_ONE_ID = "com.cnlive.run.keep"; |
| 42 | + private String CHANNEL_ONE_NAME = "runKeepLive"; | ||
| 43 | private NotificationManager mNM; | 43 | private NotificationManager mNM; |
| 44 | private Notification notification = null; | 44 | private Notification notification = null; |
| 45 | //是否在后台运行 | 45 | //是否在后台运行 |
| @@ -50,7 +50,8 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion | @@ -50,7 +50,8 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion | ||
| 50 | private Handler handler; | 50 | private Handler handler; |
| 51 | private Runnable runnable; | 51 | private Runnable runnable; |
| 52 | private boolean isRegisterReceiver = false; | 52 | private boolean isRegisterReceiver = false; |
| 53 | - | 53 | + private boolean isStartForeground = false; |
| 54 | + private final int NOTIFICATION_ID = 1; | ||
| 54 | public KeepLiveService() { | 55 | public KeepLiveService() { |
| 55 | } | 56 | } |
| 56 | 57 | ||
| @@ -79,14 +80,16 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion | @@ -79,14 +80,16 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion | ||
| 79 | handler.postDelayed(this, 5000); | 80 | handler.postDelayed(this, 5000); |
| 80 | } else { | 81 | } else { |
| 81 | try { | 82 | try { |
| 82 | - if (myReceiver != null) { | 83 | + if (myReceiver != null && isRegisterReceiver) { |
| 83 | unregisterReceiver(myReceiver); | 84 | unregisterReceiver(myReceiver); |
| 84 | } | 85 | } |
| 85 | } catch (Exception e) { | 86 | } catch (Exception e) { |
| 86 | Log.e(TAG, "run: "); | 87 | Log.e(TAG, "run: "); |
| 87 | } | 88 | } |
| 88 | stopPlaySong(); | 89 | stopPlaySong(); |
| 89 | - stopForeground(true); | 90 | + if (isStartForeground) { |
| 91 | + stopForeground(true); | ||
| 92 | + } | ||
| 90 | } | 93 | } |
| 91 | 94 | ||
| 92 | } | 95 | } |
| @@ -116,7 +119,7 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion | @@ -116,7 +119,7 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion | ||
| 116 | intentFilter.addAction("com.cnlive.strike.receiver.ServiceReceiver"); | 119 | intentFilter.addAction("com.cnlive.strike.receiver.ServiceReceiver"); |
| 117 | intentFilter.addAction("close.KeepService"); | 120 | intentFilter.addAction("close.KeepService"); |
| 118 | registerReceiver(myReceiver, intentFilter); | 121 | registerReceiver(myReceiver, intentFilter); |
| 119 | - isRegisterReceiver=true; | 122 | + isRegisterReceiver = true; |
| 120 | } | 123 | } |
| 121 | 124 | ||
| 122 | /** | 125 | /** |
| @@ -227,20 +230,21 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion | @@ -227,20 +230,21 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion | ||
| 227 | .setSmallIcon(R.mipmap.ic_launcher) | 230 | .setSmallIcon(R.mipmap.ic_launcher) |
| 228 | // .setCustomContentView(remoteViews) | 231 | // .setCustomContentView(remoteViews) |
| 229 | .setContentTitle(getResources().getString(R.string.app_name)) | 232 | .setContentTitle(getResources().getString(R.string.app_name)) |
| 230 | - .setContentText("正在记录您的运动") | 233 | + .setContentText(getResources().getString(R.string.keep_service_tip)) |
| 231 | .setCategory(Notification.CATEGORY_SERVICE) | 234 | .setCategory(Notification.CATEGORY_SERVICE) |
| 232 | .setSound(null) | 235 | .setSound(null) |
| 233 | .setWhen(System.currentTimeMillis()) | 236 | .setWhen(System.currentTimeMillis()) |
| 234 | .build(); | 237 | .build(); |
| 235 | // 0 隐藏前台服务通知 | 238 | // 0 隐藏前台服务通知 |
| 236 | - startForeground(100, notification); | 239 | + startForeground(NOTIFICATION_ID, notification); |
| 240 | + isStartForeground=true; | ||
| 237 | } | 241 | } |
| 238 | 242 | ||
| 239 | @Override | 243 | @Override |
| 240 | public void onDestroy() { | 244 | public void onDestroy() { |
| 241 | super.onDestroy(); | 245 | super.onDestroy(); |
| 242 | try { | 246 | try { |
| 243 | - if (myReceiver != null&&isRegisterReceiver) { | 247 | + if (myReceiver != null && isRegisterReceiver) { |
| 244 | unregisterReceiver(myReceiver); | 248 | unregisterReceiver(myReceiver); |
| 245 | } | 249 | } |
| 246 | } catch (Exception e) { | 250 | } catch (Exception e) { |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/service/StepService.java
| @@ -80,8 +80,8 @@ public class StepService extends Service implements SensorEventListener { | @@ -80,8 +80,8 @@ public class StepService extends Service implements SensorEventListener { | ||
| 80 | /** | 80 | /** |
| 81 | * 通知栏相关 | 81 | * 通知栏相关 |
| 82 | */ | 82 | */ |
| 83 | - private String CHANNEL_ONE_ID = "com.cnlive.step"; | ||
| 84 | - private String CHANNEL_ONE_NAME = "Step"; | 83 | + private String CHANNEL_ONE_ID = "com.cnlive.run.step"; |
| 84 | + private String CHANNEL_ONE_NAME = "runStep"; | ||
| 85 | private NotificationManager mNM; | 85 | private NotificationManager mNM; |
| 86 | private Notification notification = null; | 86 | private Notification notification = null; |
| 87 | private RemoteViews remoteViews; | 87 | private RemoteViews remoteViews; |
| @@ -136,7 +136,7 @@ public class StepService extends Service implements SensorEventListener { | @@ -136,7 +136,7 @@ public class StepService extends Service implements SensorEventListener { | ||
| 136 | private String userId; | 136 | private String userId; |
| 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 = 102; |
| 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;//用于检测速度步数 |
| @@ -619,7 +619,7 @@ public class StepService extends Service implements SensorEventListener { | @@ -619,7 +619,7 @@ public class StepService extends Service implements SensorEventListener { | ||
| 619 | .setSmallIcon(R.mipmap.ic_launcher) | 619 | .setSmallIcon(R.mipmap.ic_launcher) |
| 620 | // .setCustomContentView(remoteViews) | 620 | // .setCustomContentView(remoteViews) |
| 621 | .setContentTitle(getResources().getString(R.string.app_name)) | 621 | .setContentTitle(getResources().getString(R.string.app_name)) |
| 622 | - .setContentText("正在记录您的运动") | 622 | + .setContentText(getResources().getString(R.string.step_service_tip)) |
| 623 | .setCategory(Notification.CATEGORY_SERVICE) | 623 | .setCategory(Notification.CATEGORY_SERVICE) |
| 624 | .setSound(null) | 624 | .setSound(null) |
| 625 | .setWhen(System.currentTimeMillis()) | 625 | .setWhen(System.currentTimeMillis()) |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/ALLScoreDetailActivity.java
| @@ -24,9 +24,11 @@ public class ALLScoreDetailActivity extends QMUIFragmentActivity { | @@ -24,9 +24,11 @@ public class ALLScoreDetailActivity extends QMUIFragmentActivity { | ||
| 24 | @Override | 24 | @Override |
| 25 | protected void onCreate(Bundle savedInstanceState) { | 25 | protected void onCreate(Bundle savedInstanceState) { |
| 26 | super.onCreate(savedInstanceState); | 26 | super.onCreate(savedInstanceState); |
| 27 | - RunningFinishBean runningFinishBean = (RunningFinishBean) getIntent().getExtras().getSerializable("runningFinishBean"); | ||
| 28 | - if (runningFinishBean != null) { | ||
| 29 | - addFragment(ALLScoreDetailFragment.newInstance(runningFinishBean)); | 27 | + if (null != getIntent().getExtras()) { |
| 28 | + RunningFinishBean runningFinishBean = (RunningFinishBean) getIntent().getExtras().getSerializable("runningFinishBean"); | ||
| 29 | + if (runningFinishBean != null) { | ||
| 30 | + addFragment(ALLScoreDetailFragment.newInstance(runningFinishBean)); | ||
| 31 | + } | ||
| 30 | } | 32 | } |
| 31 | } | 33 | } |
| 32 | 34 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/OnGoingActivity.java
| @@ -22,9 +22,11 @@ public class OnGoingActivity extends QMUIFragmentActivity { | @@ -22,9 +22,11 @@ public class OnGoingActivity extends QMUIFragmentActivity { | ||
| 22 | @Override | 22 | @Override |
| 23 | protected void onCreate(Bundle savedInstanceState) { | 23 | protected void onCreate(Bundle savedInstanceState) { |
| 24 | super.onCreate(savedInstanceState); | 24 | super.onCreate(savedInstanceState); |
| 25 | - String eventId = getIntent().getExtras().getString("eventId"); | ||
| 26 | - if (null != eventId) { | ||
| 27 | - addFragment(OnGoingFragment.newInstance(eventId)); | 25 | + if (null != getIntent().getExtras()) { |
| 26 | + String eventId = getIntent().getExtras().getString("eventId"); | ||
| 27 | + if (null != eventId) { | ||
| 28 | + addFragment(OnGoingFragment.newInstance(eventId)); | ||
| 29 | + } | ||
| 28 | } | 30 | } |
| 29 | } | 31 | } |
| 30 | 32 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/PedometerMainActivity.java
| @@ -35,9 +35,6 @@ import static android.provider.Settings.EXTRA_APP_PACKAGE; | @@ -35,9 +35,6 @@ import static android.provider.Settings.EXTRA_APP_PACKAGE; | ||
| 35 | @Route(path = "/moudle_pedometer/InterestActivity") | 35 | @Route(path = "/moudle_pedometer/InterestActivity") |
| 36 | public class PedometerMainActivity extends QMUIFragmentActivity { | 36 | public class PedometerMainActivity extends QMUIFragmentActivity { |
| 37 | private static final String TAG = "PedometerMainActivity"; | 37 | private static final String TAG = "PedometerMainActivity"; |
| 38 | - | ||
| 39 | - | ||
| 40 | - private PermissionsUtils mPermissionsUtils = new PermissionsUtils();//权限申请 | ||
| 41 | private RunMainFragment fragment; | 38 | private RunMainFragment fragment; |
| 42 | private List<LatLng> importStreetPoints; | 39 | private List<LatLng> importStreetPoints; |
| 43 | private RunRaceDetailInfo runRaceDetailInfo; | 40 | private RunRaceDetailInfo runRaceDetailInfo; |
| @@ -50,7 +47,16 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | @@ -50,7 +47,16 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | ||
| 50 | @Override | 47 | @Override |
| 51 | protected void onCreate(Bundle savedInstanceState) { | 48 | protected void onCreate(Bundle savedInstanceState) { |
| 52 | super.onCreate(savedInstanceState); | 49 | super.onCreate(savedInstanceState); |
| 53 | - runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().get("runRaceDetailInfo"); | 50 | + if (null != getIntent().getExtras()) { |
| 51 | + if (null != getIntent().getExtras().get("runRaceDetailInfo")) { | ||
| 52 | + runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().get("runRaceDetailInfo"); | ||
| 53 | + if (getCurrentFragment() == null) { | ||
| 54 | + if (runRaceDetailInfo != null) { | ||
| 55 | + addFragment(runRaceDetailInfo); | ||
| 56 | + } | ||
| 57 | + } | ||
| 58 | + } | ||
| 59 | + } | ||
| 54 | } | 60 | } |
| 55 | 61 | ||
| 56 | 62 | ||
| @@ -59,10 +65,6 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | @@ -59,10 +65,6 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | ||
| 59 | super.onDestroy(); | 65 | super.onDestroy(); |
| 60 | } | 66 | } |
| 61 | 67 | ||
| 62 | - private void checkIsOpenNotifiction() { | ||
| 63 | - getPermissionsWithTip(); | ||
| 64 | - } | ||
| 65 | - | ||
| 66 | 68 | ||
| 67 | @Override | 69 | @Override |
| 68 | protected void onRestart() { | 70 | protected void onRestart() { |
| @@ -73,7 +75,6 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | @@ -73,7 +75,6 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | ||
| 73 | @Override | 75 | @Override |
| 74 | protected void onResume() { | 76 | protected void onResume() { |
| 75 | super.onResume(); | 77 | super.onResume(); |
| 76 | - checkIsOpenNotifiction(); | ||
| 77 | } | 78 | } |
| 78 | 79 | ||
| 79 | private void addFragment(RunRaceDetailInfo runRaceDetailInfo) { | 80 | private void addFragment(RunRaceDetailInfo runRaceDetailInfo) { |
| @@ -85,72 +86,6 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | @@ -85,72 +86,6 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | ||
| 85 | } | 86 | } |
| 86 | 87 | ||
| 87 | 88 | ||
| 88 | - /** | ||
| 89 | - * 一次申请一组权限(使用拒绝弹框)点击事件 | ||
| 90 | - */ | ||
| 91 | - public void getPermissionsWithTip() { | ||
| 92 | - mPermissionsUtils | ||
| 93 | - .setPermissionsListener(new PermissionsListener() { | ||
| 94 | - @Override | ||
| 95 | - public void onDenied(String[] deniedPermissions) { | ||
| 96 | - getPermissionsWithTip(); | ||
| 97 | - Log.e(TAG, "onDenied: "); | ||
| 98 | - } | ||
| 99 | - | ||
| 100 | - @Override | ||
| 101 | - public void onGranted() { | ||
| 102 | - | ||
| 103 | - //判断GPS是否开启 | ||
| 104 | - if (!MyMapUtil.isOPenGps(getApplicationContext())) { | ||
| 105 | - //开启GPS | ||
| 106 | - Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); | ||
| 107 | - startActivityForResult(intent, 10); | ||
| 108 | - Toast.makeText(getApplicationContext(), getString(R.string.open_gps_tip), Toast.LENGTH_LONG).show(); | ||
| 109 | - } else { | ||
| 110 | - if (getCurrentFragment() == null) { | ||
| 111 | - if (runRaceDetailInfo != null) { | ||
| 112 | - addFragment(runRaceDetailInfo); | ||
| 113 | - } | ||
| 114 | - } | ||
| 115 | - } | ||
| 116 | - } | ||
| 117 | - }) | ||
| 118 | - .withActivity(PedometerMainActivity.this) | ||
| 119 | - .getPermissions(PedometerMainActivity.this | ||
| 120 | - , 100 | ||
| 121 | - , Manifest.permission.INTERNET | ||
| 122 | - , Manifest.permission.READ_EXTERNAL_STORAGE | ||
| 123 | - , Manifest.permission.WRITE_EXTERNAL_STORAGE | ||
| 124 | - , Manifest.permission.ACCESS_FINE_LOCATION | ||
| 125 | - , Manifest.permission.ACCESS_COARSE_LOCATION | ||
| 126 | - ); | ||
| 127 | -// .getPermissionsWithTips(MainActivity.this | ||
| 128 | -// ,100 | ||
| 129 | -// , new String[]{"人家要录音","我们需要读取你的信息,磨磨唧唧的","我要上网","我要读内存卡","我要看日历","我要定位"} | ||
| 130 | -// , Manifest.permission.RECORD_AUDIO | ||
| 131 | -// , Manifest.permission.READ_SMS | ||
| 132 | -// , Manifest.permission.INTERNET | ||
| 133 | -// , Manifest.permission.READ_EXTERNAL_STORAGE | ||
| 134 | -// , Manifest.permission.READ_CALENDAR | ||
| 135 | -// , Manifest.permission.ACCESS_FINE_LOCATION); | ||
| 136 | - } | ||
| 137 | - | ||
| 138 | - | ||
| 139 | - /** | ||
| 140 | - * 权限回调 | ||
| 141 | - * | ||
| 142 | - * @param requestCode | ||
| 143 | - * @param permissions | ||
| 144 | - * @param grantResults | ||
| 145 | - */ | ||
| 146 | - @Override | ||
| 147 | - public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, | ||
| 148 | - @NonNull int[] grantResults) { | ||
| 149 | - super.onRequestPermissionsResult(requestCode, permissions, grantResults); | ||
| 150 | - mPermissionsUtils.dealResult(requestCode, permissions, grantResults); | ||
| 151 | - } | ||
| 152 | - | ||
| 153 | - | ||
| 154 | @Override | 89 | @Override |
| 155 | public void onBackPressed() { | 90 | public void onBackPressed() { |
| 156 | return; | 91 | return; |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/RunRaceDetailActivity.java
| @@ -4,11 +4,14 @@ import android.Manifest; | @@ -4,11 +4,14 @@ import android.Manifest; | ||
| 4 | import android.app.Activity; | 4 | import android.app.Activity; |
| 5 | import android.content.Context; | 5 | import android.content.Context; |
| 6 | import android.content.Intent; | 6 | import android.content.Intent; |
| 7 | +import android.content.pm.PackageManager; | ||
| 8 | +import android.net.Uri; | ||
| 7 | import android.os.Bundle; | 9 | import android.os.Bundle; |
| 8 | import android.provider.Settings; | 10 | import android.provider.Settings; |
| 9 | import android.support.annotation.NonNull; | 11 | import android.support.annotation.NonNull; |
| 10 | import android.support.annotation.Nullable; | 12 | import android.support.annotation.Nullable; |
| 11 | import android.support.design.widget.BottomSheetDialog; | 13 | import android.support.design.widget.BottomSheetDialog; |
| 14 | +import android.support.v4.app.ActivityCompat; | ||
| 12 | import android.text.TextUtils; | 15 | import android.text.TextUtils; |
| 13 | import android.util.Log; | 16 | import android.util.Log; |
| 14 | import android.view.View; | 17 | import android.view.View; |
| @@ -29,6 +32,7 @@ import com.cnlive.moudle.pedometer.ui.fragment.RunMainFragment; | @@ -29,6 +32,7 @@ import com.cnlive.moudle.pedometer.ui.fragment.RunMainFragment; | ||
| 29 | import com.cnlive.moudle.pedometer.ui.fragment.RunRaceDetailFragment; | 32 | import com.cnlive.moudle.pedometer.ui.fragment.RunRaceDetailFragment; |
| 30 | import com.cnlive.moudle.pedometer.ui.fragment.RunningMapFragment; | 33 | import com.cnlive.moudle.pedometer.ui.fragment.RunningMapFragment; |
| 31 | import com.cnlive.moudle.pedometer.ui.widget.FivePersonIconView; | 34 | import com.cnlive.moudle.pedometer.ui.widget.FivePersonIconView; |
| 35 | +import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; | ||
| 32 | import com.cnlive.moudle.pedometer.utils.CheckUtil; | 36 | import com.cnlive.moudle.pedometer.utils.CheckUtil; |
| 33 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; | 37 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; |
| 34 | import com.cnlive.moudle.pedometer.utils.NotificationUtil; | 38 | import com.cnlive.moudle.pedometer.utils.NotificationUtil; |
| @@ -50,6 +54,8 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | @@ -50,6 +54,8 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | ||
| 50 | private QMUIFragment fragment; | 54 | private QMUIFragment fragment; |
| 51 | private PermissionsUtils mPermissionsUtils = new PermissionsUtils();//权限申请 | 55 | private PermissionsUtils mPermissionsUtils = new PermissionsUtils();//权限申请 |
| 52 | private String eventId;//赛道id | 56 | private String eventId;//赛道id |
| 57 | + private int permissionRequestCount = 0;//权限请求次数 | ||
| 58 | + private SelectDialog selectDialog; | ||
| 53 | 59 | ||
| 54 | public static void startActivity(Activity activity, String eventId, String userId, String userIcon, String userName, String userPhone) { | 60 | public static void startActivity(Activity activity, String eventId, String userId, String userIcon, String userName, String userPhone) { |
| 55 | Intent intent = new Intent(activity, RunRaceDetailActivity.class); | 61 | Intent intent = new Intent(activity, RunRaceDetailActivity.class); |
| @@ -69,16 +75,18 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | @@ -69,16 +75,18 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | ||
| 69 | @Override | 75 | @Override |
| 70 | protected void onCreate(Bundle savedInstanceState) { | 76 | protected void onCreate(Bundle savedInstanceState) { |
| 71 | super.onCreate(savedInstanceState); | 77 | super.onCreate(savedInstanceState); |
| 72 | - if (getIntent().getStringExtra("eventId") != null) { | ||
| 73 | - eventId = getIntent().getStringExtra("eventId"); | ||
| 74 | - } | ||
| 75 | - if (getIntent().getStringExtra("userId") != null) { | ||
| 76 | - CommonInfo.setUserId(this, getIntent().getStringExtra("userId")); | ||
| 77 | - CommonInfo.setUserNickName(this, getIntent().getStringExtra("userName")); | ||
| 78 | - CommonInfo.setUserIcon(this, getIntent().getStringExtra("userIcon")); | ||
| 79 | - CommonInfo.setUserPhone(this, getIntent().getStringExtra("userPhone")); | ||
| 80 | - | 78 | + if (null != getIntent().getExtras()) { |
| 79 | + if (getIntent().getStringExtra("eventId") != null) { | ||
| 80 | + eventId = getIntent().getStringExtra("eventId"); | ||
| 81 | + } | ||
| 82 | + if (getIntent().getStringExtra("userId") != null) { | ||
| 83 | + CommonInfo.setUserId(this, getIntent().getStringExtra("userId")); | ||
| 84 | + CommonInfo.setUserNickName(this, getIntent().getStringExtra("userName")); | ||
| 85 | + CommonInfo.setUserIcon(this, getIntent().getStringExtra("userIcon")); | ||
| 86 | + CommonInfo.setUserPhone(this, getIntent().getStringExtra("userPhone")); | ||
| 87 | + } | ||
| 81 | } | 88 | } |
| 89 | + initPermissionDefineTip(); | ||
| 82 | //判断用户是否结束运动 | 90 | //判断用户是否结束运动 |
| 83 | // boolean isRunStep = CommonInfo.getIsRunStepService(this); | 91 | // boolean isRunStep = CommonInfo.getIsRunStepService(this); |
| 84 | // //没有找到相关记录 | 92 | // //没有找到相关记录 |
| @@ -92,6 +100,30 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | @@ -92,6 +100,30 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | ||
| 92 | 100 | ||
| 93 | } | 101 | } |
| 94 | 102 | ||
| 103 | + private void initPermissionDefineTip() { | ||
| 104 | + selectDialog = new SelectDialog(RunRaceDetailActivity.this, "您尚未授予程序运行所需权限\n是否设置?", | ||
| 105 | + "返回", new SelectDialog.DialogInterface() { | ||
| 106 | + @Override | ||
| 107 | + public void onClick(SelectDialog dialog) { | ||
| 108 | + dialog.dismiss(); | ||
| 109 | + finish(); | ||
| 110 | + } | ||
| 111 | + }, "设置", new SelectDialog.DialogInterface() { | ||
| 112 | + @Override | ||
| 113 | + public void onClick(SelectDialog dialog) { | ||
| 114 | + dialog.dismiss(); | ||
| 115 | +// if (!ActivityCompat.shouldShowRequestPermissionRationale(this, permissions[i])) { | ||
| 116 | +// showToast("点击权限,并打开全部权限"); | ||
| 117 | + Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); | ||
| 118 | + Uri uri = Uri.fromParts("package", getPackageName(), null); | ||
| 119 | + intent.setData(uri); | ||
| 120 | + startActivityForResult(intent, 0); | ||
| 121 | + permissionRequestCount = 0; | ||
| 122 | +// } | ||
| 123 | + } | ||
| 124 | + }); | ||
| 125 | + } | ||
| 126 | + | ||
| 95 | @Override | 127 | @Override |
| 96 | protected void onResume() { | 128 | protected void onResume() { |
| 97 | super.onResume(); | 129 | super.onResume(); |
| @@ -119,6 +151,15 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | @@ -119,6 +151,15 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | ||
| 119 | 151 | ||
| 120 | } | 152 | } |
| 121 | 153 | ||
| 154 | + /** | ||
| 155 | + * 用户已经上传完成绩 | ||
| 156 | + */ | ||
| 157 | + public void onUserUpLoadRace() { | ||
| 158 | + if (!TextUtils.isEmpty(eventId)) { | ||
| 159 | + CommonInfo.setStreetId(this, eventId); | ||
| 160 | + } | ||
| 161 | + } | ||
| 162 | + | ||
| 122 | private void addFragment(QMUIFragment fragment) { | 163 | private void addFragment(QMUIFragment fragment) { |
| 123 | getSupportFragmentManager().beginTransaction() | 164 | getSupportFragmentManager().beginTransaction() |
| 124 | .add(getContextViewId(), fragment, fragment.getClass().getSimpleName()) | 165 | .add(getContextViewId(), fragment, fragment.getClass().getSimpleName()) |
| @@ -140,6 +181,9 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | @@ -140,6 +181,9 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | ||
| 140 | * 一次申请一组权限(使用拒绝弹框)点击事件 | 181 | * 一次申请一组权限(使用拒绝弹框)点击事件 |
| 141 | */ | 182 | */ |
| 142 | public void getPermissionsWithTip() { | 183 | public void getPermissionsWithTip() { |
| 184 | + if (1 == permissionRequestCount) { | ||
| 185 | + return; | ||
| 186 | + } | ||
| 143 | mPermissionsUtils | 187 | mPermissionsUtils |
| 144 | .setPermissionsListener(new PermissionsListener() { | 188 | .setPermissionsListener(new PermissionsListener() { |
| 145 | @Override | 189 | @Override |
| @@ -187,6 +231,31 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | @@ -187,6 +231,31 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | ||
| 187 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, | 231 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, |
| 188 | @NonNull int[] grantResults) { | 232 | @NonNull int[] grantResults) { |
| 189 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); | 233 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); |
| 190 | - mPermissionsUtils.dealResult(requestCode, permissions, grantResults); | 234 | + if (1 == permissionRequestCount) { |
| 235 | + return; | ||
| 236 | + } | ||
| 237 | + boolean isShowPermissionTip = true; | ||
| 238 | + for (int i = 0; i < grantResults.length; i++) {//判断权限的结果,如果有被拒绝,就return | ||
| 239 | + if (grantResults[i] == PackageManager.PERMISSION_DENIED) { | ||
| 240 | + if (!ActivityCompat.shouldShowRequestPermissionRationale(this, permissions[i])) { | ||
| 241 | + isShowPermissionTip = false; | ||
| 242 | + break; | ||
| 243 | + } | ||
| 244 | + } | ||
| 245 | + } | ||
| 246 | + if (isShowPermissionTip) { | ||
| 247 | + mPermissionsUtils.dealResult(requestCode, permissions, grantResults); | ||
| 248 | + } else { | ||
| 249 | + if (0 == permissionRequestCount) { | ||
| 250 | + selectDialog.setCancelable(false); | ||
| 251 | + selectDialog.setCanceledOnTouchOutside(false); | ||
| 252 | + if (!selectDialog.isShowing()) { | ||
| 253 | + selectDialog.show(); | ||
| 254 | + permissionRequestCount = 1; | ||
| 255 | + } | ||
| 256 | + } else { | ||
| 257 | + return; | ||
| 258 | + } | ||
| 259 | + } | ||
| 191 | } | 260 | } |
| 192 | -} | 261 | -} |
| 262 | +} | ||
| 193 | \ No newline at end of file | 263 | \ No newline at end of file |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/RunningFinishActivity.java
| @@ -32,8 +32,10 @@ public class RunningFinishActivity extends QMUIFragmentActivity { | @@ -32,8 +32,10 @@ public class RunningFinishActivity extends QMUIFragmentActivity { | ||
| 32 | protected void onCreate(Bundle savedInstanceState) { | 32 | protected void onCreate(Bundle savedInstanceState) { |
| 33 | super.onCreate(savedInstanceState); | 33 | super.onCreate(savedInstanceState); |
| 34 | StatusBarUtil2.setColor(this, getResources().getColor(R.color.run_main_bg), 0); | 34 | StatusBarUtil2.setColor(this, getResources().getColor(R.color.run_main_bg), 0); |
| 35 | - if (getIntent().getSerializableExtra("runningFinishBean") != null) { | ||
| 36 | - addFragment((RunningFinishBean) getIntent().getSerializableExtra("runningFinishBean")); | 35 | + if (null != getIntent().getExtras()) { |
| 36 | + if (getIntent().getSerializableExtra("runningFinishBean") != null) { | ||
| 37 | + addFragment((RunningFinishBean) getIntent().getSerializableExtra("runningFinishBean")); | ||
| 38 | + } | ||
| 37 | } | 39 | } |
| 38 | 40 | ||
| 39 | 41 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/RunningMapActivity.java
| @@ -27,9 +27,11 @@ public class RunningMapActivity extends QMUIFragmentActivity { | @@ -27,9 +27,11 @@ public class RunningMapActivity extends QMUIFragmentActivity { | ||
| 27 | super.onCreate(savedInstanceState); | 27 | super.onCreate(savedInstanceState); |
| 28 | 28 | ||
| 29 | StatusBarUtil2.setColor(this, getResources().getColor(R.color.run_main_bg), 0); | 29 | StatusBarUtil2.setColor(this, getResources().getColor(R.color.run_main_bg), 0); |
| 30 | - RunningMapBean chronometerBean = (RunningMapBean) getIntent().getExtras().getSerializable("runningMapBean"); | ||
| 31 | - if (chronometerBean != null) { | ||
| 32 | - addFragment(chronometerBean); | 30 | + if (null != getIntent().getExtras()) { |
| 31 | + RunningMapBean chronometerBean = (RunningMapBean) getIntent().getExtras().getSerializable("runningMapBean"); | ||
| 32 | + if (chronometerBean != null) { | ||
| 33 | + addFragment(chronometerBean); | ||
| 34 | + } | ||
| 33 | } | 35 | } |
| 34 | } | 36 | } |
| 35 | 37 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/UploadFailDetailActivity.java
| @@ -21,17 +21,21 @@ public class UploadFailDetailActivity extends QMUIFragmentActivity { | @@ -21,17 +21,21 @@ public class UploadFailDetailActivity extends QMUIFragmentActivity { | ||
| 21 | @Override | 21 | @Override |
| 22 | protected void onCreate(Bundle savedInstanceState) { | 22 | protected void onCreate(Bundle savedInstanceState) { |
| 23 | super.onCreate(savedInstanceState); | 23 | super.onCreate(savedInstanceState); |
| 24 | - FailedEntity failedEntity = (FailedEntity) getIntent().getExtras().getSerializable("failedEntity"); | ||
| 25 | - if (failedEntity != null) { | ||
| 26 | - addFragment(UploadFailDetailFragment.newInstance(failedEntity)); | 24 | + if (null != getIntent().getExtras()) { |
| 25 | + FailedEntity failedEntity = (FailedEntity) getIntent().getExtras().getSerializable("failedEntity"); | ||
| 26 | + if (failedEntity != null) { | ||
| 27 | + addFragment(UploadFailDetailFragment.newInstance(failedEntity)); | ||
| 28 | + } | ||
| 27 | } | 29 | } |
| 28 | } | 30 | } |
| 31 | + | ||
| 29 | private void addFragment(QMUIFragment fragment) { | 32 | private void addFragment(QMUIFragment fragment) { |
| 30 | getSupportFragmentManager().beginTransaction() | 33 | getSupportFragmentManager().beginTransaction() |
| 31 | .add(getContextViewId(), fragment, fragment.getClass().getSimpleName()) | 34 | .add(getContextViewId(), fragment, fragment.getClass().getSimpleName()) |
| 32 | .addToBackStack(fragment.getClass().getSimpleName()) | 35 | .addToBackStack(fragment.getClass().getSimpleName()) |
| 33 | .commit(); | 36 | .commit(); |
| 34 | } | 37 | } |
| 38 | + | ||
| 35 | public static void startActivity(Activity activity, FailedEntity failedEntity) { | 39 | public static void startActivity(Activity activity, FailedEntity failedEntity) { |
| 36 | Intent intent = new Intent(activity, UploadFailDetailActivity.class); | 40 | Intent intent = new Intent(activity, UploadFailDetailActivity.class); |
| 37 | intent.putExtra("failedEntity", (Serializable) failedEntity); | 41 | intent.putExtra("failedEntity", (Serializable) failedEntity); |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/adapter/MyRecordAdapter.java
| @@ -8,6 +8,7 @@ import android.view.LayoutInflater; | @@ -8,6 +8,7 @@ import android.view.LayoutInflater; | ||
| 8 | import android.view.View; | 8 | import android.view.View; |
| 9 | import android.view.ViewGroup; | 9 | import android.view.ViewGroup; |
| 10 | import android.widget.ImageView; | 10 | import android.widget.ImageView; |
| 11 | +import android.widget.LinearLayout; | ||
| 11 | import android.widget.RelativeLayout; | 12 | import android.widget.RelativeLayout; |
| 12 | import android.widget.TextView; | 13 | import android.widget.TextView; |
| 13 | 14 | ||
| @@ -18,6 +19,7 @@ import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | @@ -18,6 +19,7 @@ import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | ||
| 18 | import com.cnlive.moudle.pedometer.net.bean.MyRecordInfo; | 19 | import com.cnlive.moudle.pedometer.net.bean.MyRecordInfo; |
| 19 | import com.cnlive.moudle.pedometer.ui.activity.RaceRecordActivity; | 20 | import com.cnlive.moudle.pedometer.ui.activity.RaceRecordActivity; |
| 20 | import com.cnlive.moudle.pedometer.ui.widget.FivePersonIconView; | 21 | import com.cnlive.moudle.pedometer.ui.widget.FivePersonIconView; |
| 22 | +import com.cnlive.moudle.pedometer.utils.ScreenUtil; | ||
| 21 | import com.cnlive.moudle.pedometer.utils.TimeUtil; | 23 | import com.cnlive.moudle.pedometer.utils.TimeUtil; |
| 22 | import com.example.moudle_pedometer.R; | 24 | import com.example.moudle_pedometer.R; |
| 23 | 25 | ||
| @@ -70,7 +72,17 @@ public class MyRecordAdapter extends RecyclerView.Adapter<MyRecordAdapter.MyView | @@ -70,7 +72,17 @@ public class MyRecordAdapter extends RecyclerView.Adapter<MyRecordAdapter.MyView | ||
| 70 | myViewHolder.line_address.setText(list.get(i).getAddress()); | 72 | myViewHolder.line_address.setText(list.get(i).getAddress()); |
| 71 | } | 73 | } |
| 72 | myViewHolder.people_part.setText(list.get(i).getSignupNum() + ""); | 74 | myViewHolder.people_part.setText(list.get(i).getSignupNum() + ""); |
| 73 | - myViewHolder.join_person.initIconData(list.get(i).getFaceUrl()); | 75 | + if (null != list.get(i).getFaceUrl() && list.get(i).getFaceUrl().size() > 0) { |
| 76 | + myViewHolder.join_person.initIconData(list.get(i).getFaceUrl()); | ||
| 77 | + LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ScreenUtil.dip2px(context, 150), ViewGroup.LayoutParams.WRAP_CONTENT); | ||
| 78 | + if (list.get(i).getFaceUrl().size() < 5) { | ||
| 79 | + params.rightMargin = -ScreenUtil.dip2px(context, 28 * (5 - list.get(i).getFaceUrl().size())); | ||
| 80 | + } | ||
| 81 | + myViewHolder.join_person.setLayoutParams(params); | ||
| 82 | + myViewHolder.join_person.setVisibility(View.VISIBLE); | ||
| 83 | + } else { | ||
| 84 | + myViewHolder.join_person.setVisibility(View.GONE); | ||
| 85 | + } | ||
| 74 | if(state.equals("0")){ | 86 | if(state.equals("0")){ |
| 75 | myViewHolder.day_num.setVisibility(View.VISIBLE); | 87 | myViewHolder.day_num.setVisibility(View.VISIBLE); |
| 76 | myViewHolder.after_finish.setVisibility(View.GONE); | 88 | myViewHolder.after_finish.setVisibility(View.GONE); |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/adapter/RunLineAdapter.java
| @@ -8,11 +8,13 @@ import android.view.LayoutInflater; | @@ -8,11 +8,13 @@ import android.view.LayoutInflater; | ||
| 8 | import android.view.View; | 8 | import android.view.View; |
| 9 | import android.view.ViewGroup; | 9 | import android.view.ViewGroup; |
| 10 | import android.widget.ImageView; | 10 | import android.widget.ImageView; |
| 11 | +import android.widget.LinearLayout; | ||
| 11 | import android.widget.RelativeLayout; | 12 | import android.widget.RelativeLayout; |
| 12 | import android.widget.TextView; | 13 | import android.widget.TextView; |
| 13 | 14 | ||
| 14 | import com.cnlive.moudle.pedometer.net.bean.RunLineInfo; | 15 | import com.cnlive.moudle.pedometer.net.bean.RunLineInfo; |
| 15 | import com.cnlive.moudle.pedometer.ui.widget.FivePersonIconView; | 16 | import com.cnlive.moudle.pedometer.ui.widget.FivePersonIconView; |
| 17 | +import com.cnlive.moudle.pedometer.utils.ScreenUtil; | ||
| 16 | import com.cnlive.moudle.pedometer.utils.TimeUtil; | 18 | import com.cnlive.moudle.pedometer.utils.TimeUtil; |
| 17 | import com.example.moudle_pedometer.R; | 19 | import com.example.moudle_pedometer.R; |
| 18 | 20 | ||
| @@ -65,7 +67,17 @@ public class RunLineAdapter extends RecyclerView.Adapter<RunLineAdapter.MyViewHo | @@ -65,7 +67,17 @@ public class RunLineAdapter extends RecyclerView.Adapter<RunLineAdapter.MyViewHo | ||
| 65 | myViewHolder.line_address.setText(list.get(i).getAddress()); | 67 | myViewHolder.line_address.setText(list.get(i).getAddress()); |
| 66 | } | 68 | } |
| 67 | myViewHolder.people_part.setText(list.get(i).getSignupNum() + ""); | 69 | myViewHolder.people_part.setText(list.get(i).getSignupNum() + ""); |
| 68 | - myViewHolder.join_person.initIconData(list.get(i).getFaceUrl()); | 70 | + if (null != list.get(i).getFaceUrl() && list.get(i).getFaceUrl().size() > 0) { |
| 71 | + myViewHolder.join_person.initIconData(list.get(i).getFaceUrl()); | ||
| 72 | + LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ScreenUtil.dip2px(context, 150), ViewGroup.LayoutParams.WRAP_CONTENT); | ||
| 73 | + if (list.get(i).getFaceUrl().size() < 5) { | ||
| 74 | + params.rightMargin = -ScreenUtil.dip2px(context, 28 * (5 - list.get(i).getFaceUrl().size())); | ||
| 75 | + } | ||
| 76 | + myViewHolder.join_person.setLayoutParams(params); | ||
| 77 | + myViewHolder.join_person.setVisibility(View.VISIBLE); | ||
| 78 | + } else { | ||
| 79 | + myViewHolder.join_person.setVisibility(View.GONE); | ||
| 80 | + } | ||
| 69 | } | 81 | } |
| 70 | 82 | ||
| 71 | 83 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/adapter/TakePartAdapter.java
| @@ -3,6 +3,7 @@ package com.cnlive.moudle.pedometer.ui.adapter; | @@ -3,6 +3,7 @@ package com.cnlive.moudle.pedometer.ui.adapter; | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | import android.support.annotation.NonNull; | 4 | import android.support.annotation.NonNull; |
| 5 | import android.support.v7.widget.RecyclerView; | 5 | import android.support.v7.widget.RecyclerView; |
| 6 | +import android.text.TextUtils; | ||
| 6 | import android.view.LayoutInflater; | 7 | import android.view.LayoutInflater; |
| 7 | import android.view.View; | 8 | import android.view.View; |
| 8 | import android.view.ViewGroup; | 9 | import android.view.ViewGroup; |
| @@ -33,14 +34,19 @@ public class TakePartAdapter extends RecyclerView.Adapter<TakePartAdapter.MyHold | @@ -33,14 +34,19 @@ public class TakePartAdapter extends RecyclerView.Adapter<TakePartAdapter.MyHold | ||
| 33 | @NonNull | 34 | @NonNull |
| 34 | @Override | 35 | @Override |
| 35 | public TakePartAdapter.MyHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { | 36 | public TakePartAdapter.MyHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { |
| 36 | - View view = LayoutInflater.from(context).inflate(R.layout.item_tabke_part,viewGroup,false); | 37 | + View view = LayoutInflater.from(context).inflate(R.layout.item_tabke_part, viewGroup, false); |
| 37 | return new MyHolder(view); | 38 | return new MyHolder(view); |
| 38 | } | 39 | } |
| 39 | 40 | ||
| 40 | @Override | 41 | @Override |
| 41 | public void onBindViewHolder(@NonNull TakePartAdapter.MyHolder myViewHolder, int i) { | 42 | public void onBindViewHolder(@NonNull TakePartAdapter.MyHolder myViewHolder, int i) { |
| 42 | - Glide.with(context).load(list.get(i).getImage()) | ||
| 43 | - .apply(RequestOptions.bitmapTransform(new CircleCrop()).placeholder(R.drawable.ic_icon)).into(myViewHolder.icon_img); | 43 | + if (!TextUtils.isEmpty(list.get(i).getImage())) { |
| 44 | + Glide.with(context).load(list.get(i).getImage()) | ||
| 45 | + .apply(RequestOptions.bitmapTransform(new CircleCrop()).placeholder(R.drawable.ic_icon)).into(myViewHolder.icon_img); | ||
| 46 | + } else { | ||
| 47 | + Glide.with(context).load(context.getResources().getString(R.string.default_face_url)) | ||
| 48 | + .apply(RequestOptions.bitmapTransform(new CircleCrop()).placeholder(R.drawable.ic_icon)).into(myViewHolder.icon_img); | ||
| 49 | + } | ||
| 44 | myViewHolder.nickname.setText(list.get(i).getNickName()); | 50 | myViewHolder.nickname.setText(list.get(i).getNickName()); |
| 45 | } | 51 | } |
| 46 | 52 | ||
| @@ -49,10 +55,11 @@ public class TakePartAdapter extends RecyclerView.Adapter<TakePartAdapter.MyHold | @@ -49,10 +55,11 @@ public class TakePartAdapter extends RecyclerView.Adapter<TakePartAdapter.MyHold | ||
| 49 | return list.size(); | 55 | return list.size(); |
| 50 | } | 56 | } |
| 51 | 57 | ||
| 52 | - class MyHolder extends RecyclerView.ViewHolder{ | 58 | + class MyHolder extends RecyclerView.ViewHolder { |
| 53 | 59 | ||
| 54 | ImageView icon_img; | 60 | ImageView icon_img; |
| 55 | TextView nickname; | 61 | TextView nickname; |
| 62 | + | ||
| 56 | public MyHolder(@NonNull View itemView) { | 63 | public MyHolder(@NonNull View itemView) { |
| 57 | super(itemView); | 64 | super(itemView); |
| 58 | icon_img = itemView.findViewById(R.id.icon_img); | 65 | icon_img = itemView.findViewById(R.id.icon_img); |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/LineUpAgainFragment.java
| @@ -61,7 +61,6 @@ public class LineUpAgainFragment extends MvpBindingFragment<LineUpAgainView, Lin | @@ -61,7 +61,6 @@ public class LineUpAgainFragment extends MvpBindingFragment<LineUpAgainView, Lin | ||
| 61 | @Override | 61 | @Override |
| 62 | public void onResume() { | 62 | public void onResume() { |
| 63 | super.onResume(); | 63 | super.onResume(); |
| 64 | - Log.e(TAG, "onResume: "); | ||
| 65 | List<FailedEntity> failedEntities = StepUtil.getFailListData(getActivity(), CommonInfo.getUserId(getActivity())); | 64 | List<FailedEntity> failedEntities = StepUtil.getFailListData(getActivity(), CommonInfo.getUserId(getActivity())); |
| 66 | if (getMvpView() != null) { | 65 | if (getMvpView() != null) { |
| 67 | if (failedEntities == null || failedEntities.size() < 1) { | 66 | if (failedEntities == null || failedEntities.size() < 1) { |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RegistrationInfoFragment.java
| @@ -79,6 +79,9 @@ public class RegistrationInfoFragment extends MvpBindingFragment<RegistrationInf | @@ -79,6 +79,9 @@ public class RegistrationInfoFragment extends MvpBindingFragment<RegistrationInf | ||
| 79 | * @param fenceId | 79 | * @param fenceId |
| 80 | */ | 80 | */ |
| 81 | public void addMonitorToFence(int fenceId) { | 81 | public void addMonitorToFence(int fenceId) { |
| 82 | + if (null!=getMvpView()){ | ||
| 83 | + getMvpView().limitClickRegistBtn(); | ||
| 84 | + } | ||
| 82 | if (null == getPresenter()) { | 85 | if (null == getPresenter()) { |
| 83 | return; | 86 | return; |
| 84 | } | 87 | } |
| @@ -145,6 +148,9 @@ public class RegistrationInfoFragment extends MvpBindingFragment<RegistrationInf | @@ -145,6 +148,9 @@ public class RegistrationInfoFragment extends MvpBindingFragment<RegistrationInf | ||
| 145 | binding.sexText.getText().toString().trim().equals("未选择") ? "" : binding.sexText.getText().toString().trim(), | 148 | binding.sexText.getText().toString().trim().equals("未选择") ? "" : binding.sexText.getText().toString().trim(), |
| 146 | binding.birthday.getText().toString().trim().equals("未选择") ? "" : binding.birthday.getText().toString().trim()); | 149 | binding.birthday.getText().toString().trim().equals("未选择") ? "" : binding.birthday.getText().toString().trim()); |
| 147 | } else { | 150 | } else { |
| 151 | + if (null!=getMvpView()){ | ||
| 152 | + getMvpView().allowClickRegistBtn(); | ||
| 153 | + } | ||
| 148 | QMUITipDialogUtil.dismessDialog(); | 154 | QMUITipDialogUtil.dismessDialog(); |
| 149 | QMUITipDialogUtil.messageDialog(getContext(), addMonitoredPersonResponse.getMessage(), 2); | 155 | QMUITipDialogUtil.messageDialog(getContext(), addMonitoredPersonResponse.getMessage(), 2); |
| 150 | } | 156 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RunRaceDetailFragment.java
| @@ -16,6 +16,7 @@ import com.cnlive.moudle.pedometer.frame.view.RunRaceDetailFragmentView; | @@ -16,6 +16,7 @@ import com.cnlive.moudle.pedometer.frame.view.RunRaceDetailFragmentView; | ||
| 16 | import com.cnlive.moudle.pedometer.model.Constant; | 16 | import com.cnlive.moudle.pedometer.model.Constant; |
| 17 | import com.cnlive.moudle.pedometer.model.MessageEvent; | 17 | import com.cnlive.moudle.pedometer.model.MessageEvent; |
| 18 | import com.cnlive.moudle.pedometer.ui.activity.PedometerMainActivity; | 18 | import com.cnlive.moudle.pedometer.ui.activity.PedometerMainActivity; |
| 19 | +import com.cnlive.moudle.pedometer.ui.activity.RunRaceDetailActivity; | ||
| 19 | import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil; | 20 | import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil; |
| 20 | import com.example.moudle_pedometer.R; | 21 | import com.example.moudle_pedometer.R; |
| 21 | import com.example.moudle_pedometer.databinding.FragmentRunRaceDetailBinding; | 22 | import com.example.moudle_pedometer.databinding.FragmentRunRaceDetailBinding; |
| @@ -196,5 +197,22 @@ public class RunRaceDetailFragment extends QMUIFragment<RunRaceDetailFragmentVie | @@ -196,5 +197,22 @@ public class RunRaceDetailFragment extends QMUIFragment<RunRaceDetailFragmentVie | ||
| 196 | getMvpView().setRegistrationBtn(); | 197 | getMvpView().setRegistrationBtn(); |
| 197 | } | 198 | } |
| 198 | } | 199 | } |
| 200 | + //用户跑完了,更新一下按钮 | ||
| 201 | + else if (messageEvent.getMessageType() == Constant.UPDATE_RACE_STATE_BTN) { | ||
| 202 | + if (null != getActivity()) { | ||
| 203 | + if (getActivity() instanceof RunRaceDetailActivity) { | ||
| 204 | + RunRaceDetailActivity activity = (RunRaceDetailActivity) getActivity(); | ||
| 205 | + if (null != activity) { | ||
| 206 | + activity.onUserUpLoadRace(); | ||
| 207 | + } | ||
| 208 | + } | ||
| 209 | + } | ||
| 210 | + if (getMvpView() != null && null != getPresenter()) { | ||
| 211 | + if (!TextUtils.isEmpty(CommonInfo.getStreetId(getActivity()))) { | ||
| 212 | + getPresenter().getRunRaceDetailInfo(getActivity(), CommonInfo.getStreetId(getActivity()), CommonInfo.getUserId(getActivity()), "0"); | ||
| 213 | + } | ||
| 214 | + } | ||
| 215 | + } | ||
| 216 | + | ||
| 199 | } | 217 | } |
| 200 | } | 218 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/widget/FivePersonIconView.java
| @@ -52,6 +52,17 @@ public class FivePersonIconView extends LinearLayout { | @@ -52,6 +52,17 @@ public class FivePersonIconView extends LinearLayout { | ||
| 52 | qr4 = findViewById(R.id.qm_iv4); | 52 | qr4 = findViewById(R.id.qm_iv4); |
| 53 | qr5 = findViewById(R.id.qm_iv5); | 53 | qr5 = findViewById(R.id.qm_iv5); |
| 54 | iv_right = findViewById(R.id.iv_right); | 54 | iv_right = findViewById(R.id.iv_right); |
| 55 | + qr1.setVisibility(GONE); | ||
| 56 | + qr2.setVisibility(GONE); | ||
| 57 | + qr3.setVisibility(GONE); | ||
| 58 | + qr4.setVisibility(GONE); | ||
| 59 | + qr5.setVisibility(GONE); | ||
| 60 | + //设置默认显示图片 | ||
| 61 | + GlideApp.with(context).load(getResources().getDrawable(R.drawable.tc_ic_workout_level_adjust_coach)).into(qr1); | ||
| 62 | + GlideApp.with(context).load(getResources().getDrawable(R.drawable.tc_ic_workout_level_adjust_coach)).into(qr2); | ||
| 63 | + GlideApp.with(context).load(getResources().getDrawable(R.drawable.tc_ic_workout_level_adjust_coach)).into(qr3); | ||
| 64 | + GlideApp.with(context).load(getResources().getDrawable(R.drawable.tc_ic_workout_level_adjust_coach)).into(qr4); | ||
| 65 | + GlideApp.with(context).load(getResources().getDrawable(R.drawable.tc_ic_workout_level_adjust_coach)).into(qr5); | ||
| 55 | //获取自定义属性 | 66 | //获取自定义属性 |
| 56 | TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.FivePersonIconView); | 67 | TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.FivePersonIconView); |
| 57 | isShowRight = attributes.getBoolean(R.styleable.FivePersonIconView_showRightFlag, true); | 68 | isShowRight = attributes.getBoolean(R.styleable.FivePersonIconView_showRightFlag, true); |
| @@ -72,12 +83,6 @@ public class FivePersonIconView extends LinearLayout { | @@ -72,12 +83,6 @@ public class FivePersonIconView extends LinearLayout { | ||
| 72 | if (qr1 == null || qr2 == null || qr3 == null || qr4 == null || qr5 == null) { | 83 | if (qr1 == null || qr2 == null || qr3 == null || qr4 == null || qr5 == null) { |
| 73 | return; | 84 | return; |
| 74 | } | 85 | } |
| 75 | - //设置默认显示图片 | ||
| 76 | - GlideApp.with(context).load(getResources().getDrawable(R.drawable.tc_ic_workout_level_adjust_coach)).into(qr1); | ||
| 77 | - GlideApp.with(context).load(getResources().getDrawable(R.drawable.tc_ic_workout_level_adjust_coach)).into(qr2); | ||
| 78 | - GlideApp.with(context).load(getResources().getDrawable(R.drawable.tc_ic_workout_level_adjust_coach)).into(qr3); | ||
| 79 | - GlideApp.with(context).load(getResources().getDrawable(R.drawable.tc_ic_workout_level_adjust_coach)).into(qr4); | ||
| 80 | - GlideApp.with(context).load(getResources().getDrawable(R.drawable.tc_ic_workout_level_adjust_coach)).into(qr5); | ||
| 81 | //开始设置集合里面的图片 | 86 | //开始设置集合里面的图片 |
| 82 | if (iconList != null && iconList.size() > 0) { | 87 | if (iconList != null && iconList.size() > 0) { |
| 83 | for (int i = 0; i < iconList.size(); i++) { | 88 | for (int i = 0; i < iconList.size(); i++) { |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/MyMapUtil.java
| @@ -5,6 +5,7 @@ import android.graphics.Bitmap; | @@ -5,6 +5,7 @@ import android.graphics.Bitmap; | ||
| 5 | import android.graphics.BitmapFactory; | 5 | import android.graphics.BitmapFactory; |
| 6 | import android.location.LocationManager; | 6 | import android.location.LocationManager; |
| 7 | import android.os.Handler; | 7 | import android.os.Handler; |
| 8 | +import android.text.TextUtils; | ||
| 8 | import android.util.Log; | 9 | import android.util.Log; |
| 9 | import android.widget.Toast; | 10 | import android.widget.Toast; |
| 10 | 11 | ||
| @@ -18,6 +19,12 @@ import com.baidu.mapapi.map.OverlayOptions; | @@ -18,6 +19,12 @@ import com.baidu.mapapi.map.OverlayOptions; | ||
| 18 | import com.baidu.mapapi.map.PolylineOptions; | 19 | import com.baidu.mapapi.map.PolylineOptions; |
| 19 | import com.baidu.mapapi.model.LatLng; | 20 | import com.baidu.mapapi.model.LatLng; |
| 20 | import com.baidu.mapapi.model.LatLngBounds; | 21 | import com.baidu.mapapi.model.LatLngBounds; |
| 22 | +import com.baidu.mapapi.search.core.PoiInfo; | ||
| 23 | +import com.baidu.mapapi.search.geocode.GeoCodeResult; | ||
| 24 | +import com.baidu.mapapi.search.geocode.GeoCoder; | ||
| 25 | +import com.baidu.mapapi.search.geocode.OnGetGeoCoderResultListener; | ||
| 26 | +import com.baidu.mapapi.search.geocode.ReverseGeoCodeOption; | ||
| 27 | +import com.baidu.mapapi.search.geocode.ReverseGeoCodeResult; | ||
| 21 | import com.baidu.mapapi.utils.DistanceUtil; | 28 | import com.baidu.mapapi.utils.DistanceUtil; |
| 22 | import com.baidu.trace.LBSTraceClient; | 29 | import com.baidu.trace.LBSTraceClient; |
| 23 | import com.baidu.trace.api.track.DistanceRequest; | 30 | import com.baidu.trace.api.track.DistanceRequest; |
| @@ -52,7 +59,86 @@ public class MyMapUtil { | @@ -52,7 +59,86 @@ public class MyMapUtil { | ||
| 52 | //分页索引 | 59 | //分页索引 |
| 53 | private static int pageIndex = 1; | 60 | private static int pageIndex = 1; |
| 54 | private static List<LatLng> trackPoints; | 61 | private static List<LatLng> trackPoints; |
| 62 | + private static GeoCoder mSearch = null; // 搜索模块,也可去掉地图模块独立使用 | ||
| 63 | + private static int queryGeoCount = 0; | ||
| 55 | 64 | ||
| 65 | + /** | ||
| 66 | + * 进行逆地理查询 | ||
| 67 | + * | ||
| 68 | + * @param latLng | ||
| 69 | + * @param geoCodeResult | ||
| 70 | + */ | ||
| 71 | + public static void getGeoCoderResult(LatLng latLng, GeoCodeResult geoCodeResult) { | ||
| 72 | + if (null == latLng) { | ||
| 73 | + return; | ||
| 74 | + } | ||
| 75 | + if (null == mSearch) { | ||
| 76 | + mSearch = GeoCoder.newInstance(); | ||
| 77 | + } | ||
| 78 | + mSearch.setOnGetGeoCodeResultListener(new OnGetGeoCoderResultListener() { | ||
| 79 | + | ||
| 80 | + @Override | ||
| 81 | + public void onGetGeoCodeResult(com.baidu.mapapi.search.geocode.GeoCodeResult geoCodeResult) { | ||
| 82 | + | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + @Override | ||
| 86 | + public void onGetReverseGeoCodeResult(ReverseGeoCodeResult reverseGeoCodeResult) { | ||
| 87 | +// Log.e(TAG, "status:" + reverseGeoCodeResult.status + ",error" + reverseGeoCodeResult.error); | ||
| 88 | + //成功 | ||
| 89 | + if (0 == reverseGeoCodeResult.status) { | ||
| 90 | + queryGeoCount = 0; | ||
| 91 | + if (null != geoCodeResult) { | ||
| 92 | + List<PoiInfo> pois = reverseGeoCodeResult.getPoiList(); | ||
| 93 | + if (null != pois && pois.size() > 0) { | ||
| 94 | + if (!TextUtils.isEmpty(pois.get(0).name)) { | ||
| 95 | + geoCodeResult.success(pois.get(0).name); | ||
| 96 | + } else { | ||
| 97 | + geoCodeResult.success(null); | ||
| 98 | + } | ||
| 99 | + } else { | ||
| 100 | + //如果街道号或者街道为空 | ||
| 101 | + if ((null == reverseGeoCodeResult.getAddressDetail().street || TextUtils.isEmpty(reverseGeoCodeResult.getAddressDetail().street)) && (null == reverseGeoCodeResult.getAddressDetail().streetNumber || TextUtils.isEmpty(reverseGeoCodeResult.getAddressDetail().streetNumber))) { | ||
| 102 | + if (!TextUtils.isEmpty(reverseGeoCodeResult.getAddress()) && !TextUtils.isEmpty(reverseGeoCodeResult.getSematicDescription())) { | ||
| 103 | + geoCodeResult.success(reverseGeoCodeResult.getAddress() + "," + reverseGeoCodeResult.getSematicDescription()); | ||
| 104 | + } else if (!TextUtils.isEmpty(reverseGeoCodeResult.getAddress())) { | ||
| 105 | + geoCodeResult.success(reverseGeoCodeResult.getAddress()); | ||
| 106 | + } else { | ||
| 107 | + geoCodeResult.success(null); | ||
| 108 | + } | ||
| 109 | + } else { | ||
| 110 | + if (!TextUtils.isEmpty(reverseGeoCodeResult.getAddress())) { | ||
| 111 | + geoCodeResult.success(reverseGeoCodeResult.getAddress()); | ||
| 112 | + } else { | ||
| 113 | + geoCodeResult.success(null); | ||
| 114 | + } | ||
| 115 | + } | ||
| 116 | + } | ||
| 117 | + } | ||
| 118 | + } else if (104 == reverseGeoCodeResult.status) { | ||
| 119 | + if (0 == queryGeoCount) { | ||
| 120 | + queryGeoCount = 1; | ||
| 121 | + new Handler().postDelayed(new Runnable() { | ||
| 122 | + @Override | ||
| 123 | + public void run() { | ||
| 124 | + getGeoCoderResult(latLng, geoCodeResult); | ||
| 125 | + } | ||
| 126 | + }, 1000); | ||
| 127 | + } | ||
| 128 | + } | ||
| 129 | + //失败 | ||
| 130 | + else { | ||
| 131 | + queryGeoCount = 0; | ||
| 132 | + if (null != geoCodeResult) { | ||
| 133 | + geoCodeResult.success(null); | ||
| 134 | + } | ||
| 135 | + } | ||
| 136 | + } | ||
| 137 | + }); | ||
| 138 | + mSearch.reverseGeoCode(new ReverseGeoCodeOption() | ||
| 139 | + .location(latLng) | ||
| 140 | + .radius(Constant.COLL_GEORESULT_RADIUS)); | ||
| 141 | + } | ||
| 56 | 142 | ||
| 57 | /** | 143 | /** |
| 58 | * 在地图上进行打点 | 144 | * 在地图上进行打点 |
| @@ -64,7 +150,7 @@ public class MyMapUtil { | @@ -64,7 +150,7 @@ public class MyMapUtil { | ||
| 64 | * @return | 150 | * @return |
| 65 | */ | 151 | */ |
| 66 | public static Overlay setMapMarker(Context context, BaiduMap baiduMap, LatLng startLatLng, int startIconRes) { | 152 | public static Overlay setMapMarker(Context context, BaiduMap baiduMap, LatLng startLatLng, int startIconRes) { |
| 67 | - if (0 == startIconRes || null == startLatLng || null == context || null == baiduMap) { | 153 | + if (0 == startIconRes || null == startLatLng || null == context || null == baiduMap || null == startLatLng) { |
| 68 | return null; | 154 | return null; |
| 69 | } | 155 | } |
| 70 | try { | 156 | try { |
| @@ -99,7 +185,7 @@ public class MyMapUtil { | @@ -99,7 +185,7 @@ public class MyMapUtil { | ||
| 99 | * @return | 185 | * @return |
| 100 | */ | 186 | */ |
| 101 | public static List<Overlay> setStartMarker(Context context, BaiduMap baiduMap, LatLng startLatLng, int startIconRes) { | 187 | public static List<Overlay> setStartMarker(Context context, BaiduMap baiduMap, LatLng startLatLng, int startIconRes) { |
| 102 | - if (0 == startIconRes || null == startLatLng || null == context || null == baiduMap) { | 188 | + if (0 == startIconRes || null == startLatLng || null == context || null == baiduMap || null == startLatLng) { |
| 103 | return null; | 189 | return null; |
| 104 | } | 190 | } |
| 105 | List<Overlay> resultOverlays = new ArrayList<>(); | 191 | List<Overlay> resultOverlays = new ArrayList<>(); |
| @@ -151,6 +237,9 @@ public class MyMapUtil { | @@ -151,6 +237,9 @@ public class MyMapUtil { | ||
| 151 | * @param zoomBy | 237 | * @param zoomBy |
| 152 | */ | 238 | */ |
| 153 | public static float setMapAutoZoom(BaiduMap baiduMap, List<LatLng> trackPoints, float zoomBy) { | 239 | public static float setMapAutoZoom(BaiduMap baiduMap, List<LatLng> trackPoints, float zoomBy) { |
| 240 | + if (null == baiduMap || null == trackPoints) { | ||
| 241 | + return 0; | ||
| 242 | + } | ||
| 154 | LatLngBounds.Builder builder = new LatLngBounds.Builder(); | 243 | LatLngBounds.Builder builder = new LatLngBounds.Builder(); |
| 155 | for (LatLng latLng : trackPoints) { | 244 | for (LatLng latLng : trackPoints) { |
| 156 | builder.include(latLng); | 245 | builder.include(latLng); |
| @@ -178,6 +267,9 @@ public class MyMapUtil { | @@ -178,6 +267,9 @@ public class MyMapUtil { | ||
| 178 | * @param zoomBy | 267 | * @param zoomBy |
| 179 | */ | 268 | */ |
| 180 | public static void setCollMapAutoZoom(BaiduMap baiduMap, List<CollectPoint> trackPoints, float zoomBy) { | 269 | public static void setCollMapAutoZoom(BaiduMap baiduMap, List<CollectPoint> trackPoints, float zoomBy) { |
| 270 | + if (null == baiduMap || null == trackPoints) { | ||
| 271 | + return; | ||
| 272 | + } | ||
| 181 | LatLngBounds.Builder builder = new LatLngBounds.Builder(); | 273 | LatLngBounds.Builder builder = new LatLngBounds.Builder(); |
| 182 | List<LatLng> latLngs = new ArrayList<>(); | 274 | List<LatLng> latLngs = new ArrayList<>(); |
| 183 | for (int i = 0; i < trackPoints.size(); i++) { | 275 | for (int i = 0; i < trackPoints.size(); i++) { |
| @@ -209,6 +301,9 @@ public class MyMapUtil { | @@ -209,6 +301,9 @@ public class MyMapUtil { | ||
| 209 | * @return | 301 | * @return |
| 210 | */ | 302 | */ |
| 211 | public static boolean checkIsFinishTrace(List<LatLng> importPoints, List<LatLng> trackPoints, double passRate) { | 303 | public static boolean checkIsFinishTrace(List<LatLng> importPoints, List<LatLng> trackPoints, double passRate) { |
| 304 | + if (null == importPoints || null == trackPoints) { | ||
| 305 | + return false; | ||
| 306 | + } | ||
| 212 | HashMap<Integer, Boolean> importHash = new HashMap<>(); | 307 | HashMap<Integer, Boolean> importHash = new HashMap<>(); |
| 213 | for (int i = 0; i < importPoints.size(); i++) { | 308 | for (int i = 0; i < importPoints.size(); i++) { |
| 214 | importHash.put(i, false); | 309 | importHash.put(i, false); |
| @@ -258,6 +353,16 @@ public class MyMapUtil { | @@ -258,6 +353,16 @@ public class MyMapUtil { | ||
| 258 | private static int queryNum = 0;//查询次数 | 353 | private static int queryNum = 0;//查询次数 |
| 259 | 354 | ||
| 260 | public static void queryHistoryTrace(Context context, LBSTraceClient mClient, String entityName, long startTime, long endTime, CallBack callBack) { | 355 | public static void queryHistoryTrace(Context context, LBSTraceClient mClient, String entityName, long startTime, long endTime, CallBack callBack) { |
| 356 | + if (null == context || null == mClient) { | ||
| 357 | + return; | ||
| 358 | + } | ||
| 359 | + if (0 == startTime || 0 == endTime) { | ||
| 360 | + if (callBack != null) { | ||
| 361 | + callBack.success(null); | ||
| 362 | + } else { | ||
| 363 | + return; | ||
| 364 | + } | ||
| 365 | + } | ||
| 261 | HistoryTrackRequest historyTrackRequest = new HistoryTrackRequest(Constant.TAG, Constant.SERVICE_ID, entityName); | 366 | HistoryTrackRequest historyTrackRequest = new HistoryTrackRequest(Constant.TAG, Constant.SERVICE_ID, entityName); |
| 262 | //设置查询设备名称 | 367 | //设置查询设备名称 |
| 263 | historyTrackRequest.setEntityName(entityName); | 368 | historyTrackRequest.setEntityName(entityName); |
| @@ -408,15 +513,20 @@ public class MyMapUtil { | @@ -408,15 +513,20 @@ public class MyMapUtil { | ||
| 408 | */ | 513 | */ |
| 409 | public static List<Overlay> drawHistoryTrack(Context context, BaiduMap baiduMap, List<LatLng> points, SortType sortType, int lineColor, int startIconRes, int endIconRes) { | 514 | public static List<Overlay> drawHistoryTrack(Context context, BaiduMap baiduMap, List<LatLng> points, SortType sortType, int lineColor, int startIconRes, int endIconRes) { |
| 410 | // 绘制新覆盖物前,清空之前的覆盖物 | 515 | // 绘制新覆盖物前,清空之前的覆盖物 |
| 411 | - if (points == null || points.size() == 0 || lineColor == 0) { | 516 | + if (points == null || points.size() == 0 || lineColor == 0 || null == context) { |
| 412 | return null; | 517 | return null; |
| 413 | } | 518 | } |
| 414 | List<Overlay> overlayList = new ArrayList<>(); | 519 | List<Overlay> overlayList = new ArrayList<>(); |
| 415 | //只有一个点 | 520 | //只有一个点 |
| 416 | if (points.size() == 1) { | 521 | if (points.size() == 1) { |
| 417 | if (startIconRes != 0) { | 522 | if (startIconRes != 0) { |
| 418 | - Bitmap pointBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), startIconRes), 24, 30); | ||
| 419 | - OverlayOptions startOptions = new MarkerOptions().position(points.get(0)).icon(BitmapDescriptorFactory.fromBitmap(pointBitmap)); | 523 | + |
| 524 | + Bitmap pointBitmap = null; | ||
| 525 | + pointBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), startIconRes), 24, 30); | ||
| 526 | + OverlayOptions startOptions = null; | ||
| 527 | + if (null != pointBitmap) { | ||
| 528 | + startOptions = new MarkerOptions().position(points.get(0)).icon(BitmapDescriptorFactory.fromBitmap(pointBitmap)); | ||
| 529 | + } | ||
| 420 | if (null != startOptions) { | 530 | if (null != startOptions) { |
| 421 | overlayList.add(baiduMap.addOverlay(startOptions)); | 531 | overlayList.add(baiduMap.addOverlay(startOptions)); |
| 422 | } | 532 | } |
| @@ -465,15 +575,15 @@ public class MyMapUtil { | @@ -465,15 +575,15 @@ public class MyMapUtil { | ||
| 465 | polylineOptions = new PolylineOptions().width(10) | 575 | polylineOptions = new PolylineOptions().width(10) |
| 466 | .color(context.getResources().getColor(lineColor)).points(points); | 576 | .color(context.getResources().getColor(lineColor)).points(points); |
| 467 | } | 577 | } |
| 578 | + if (null != polylineOptions) { | ||
| 579 | + overlayList.add(baiduMap.addOverlay(polylineOptions)); | ||
| 580 | + } | ||
| 468 | if (startOptions != null) { | 581 | if (startOptions != null) { |
| 469 | overlayList.add(baiduMap.addOverlay(startOptions)); | 582 | overlayList.add(baiduMap.addOverlay(startOptions)); |
| 470 | } | 583 | } |
| 471 | if (endOptions != null) { | 584 | if (endOptions != null) { |
| 472 | overlayList.add(baiduMap.addOverlay(endOptions)); | 585 | overlayList.add(baiduMap.addOverlay(endOptions)); |
| 473 | } | 586 | } |
| 474 | - if (null != polylineOptions) { | ||
| 475 | - overlayList.add(baiduMap.addOverlay(polylineOptions)); | ||
| 476 | - } | ||
| 477 | if (null != overlayList) { | 587 | if (null != overlayList) { |
| 478 | return overlayList; | 588 | return overlayList; |
| 479 | } else if (overlayList.size() == 0) { | 589 | } else if (overlayList.size() == 0) { |
| @@ -488,7 +598,7 @@ public class MyMapUtil { | @@ -488,7 +598,7 @@ public class MyMapUtil { | ||
| 488 | */ | 598 | */ |
| 489 | public static Overlay drawRealTimeTrack(Context context, BaiduMap baiduMap, List<LatLng> points, SortType sortType, int lineColor, int startIconRes) { | 599 | public static Overlay drawRealTimeTrack(Context context, BaiduMap baiduMap, List<LatLng> points, SortType sortType, int lineColor, int startIconRes) { |
| 490 | // 绘制新覆盖物前,清空之前的覆盖物 | 600 | // 绘制新覆盖物前,清空之前的覆盖物 |
| 491 | - if (points == null || points.size() == 0 || lineColor == 0) { | 601 | + if (points == null || points.size() == 0 || lineColor == 0 || null == context) { |
| 492 | return null; | 602 | return null; |
| 493 | } | 603 | } |
| 494 | //只有一个点 | 604 | //只有一个点 |
| @@ -535,6 +645,9 @@ public class MyMapUtil { | @@ -535,6 +645,9 @@ public class MyMapUtil { | ||
| 535 | * 绘制服务器传过来的轨迹 | 645 | * 绘制服务器传过来的轨迹 |
| 536 | */ | 646 | */ |
| 537 | public static List<Overlay> drawServerLineTrack(Context context, BaiduMap baiduMap, List<LatLng> points, SortType sortType, int lineColor, int startIconRes, int endIconRes) { | 647 | public static List<Overlay> drawServerLineTrack(Context context, BaiduMap baiduMap, List<LatLng> points, SortType sortType, int lineColor, int startIconRes, int endIconRes) { |
| 648 | + if (null == context || null == baiduMap || null == points) { | ||
| 649 | + return null; | ||
| 650 | + } | ||
| 538 | try { | 651 | try { |
| 539 | // 绘制新覆盖物前,清空之前的覆盖物 | 652 | // 绘制新覆盖物前,清空之前的覆盖物 |
| 540 | if (points == null || points.size() == 0) { | 653 | if (points == null || points.size() == 0) { |
| @@ -1085,4 +1198,8 @@ public class MyMapUtil { | @@ -1085,4 +1198,8 @@ public class MyMapUtil { | ||
| 1085 | public interface CallBack { | 1198 | public interface CallBack { |
| 1086 | public void success(List<LatLng> resultPoints); | 1199 | public void success(List<LatLng> resultPoints); |
| 1087 | } | 1200 | } |
| 1201 | + | ||
| 1202 | + public interface GeoCodeResult { | ||
| 1203 | + void success(String address); | ||
| 1204 | + } | ||
| 1088 | } | 1205 | } |
moudle_pedometer/src/main/res/layout/activity_my_record.xml
| @@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
| 11 | <com.qmuiteam.qmui.widget.QMUITopBar | 11 | <com.qmuiteam.qmui.widget.QMUITopBar |
| 12 | android:id="@+id/topbar" | 12 | android:id="@+id/topbar" |
| 13 | android:layout_width="match_parent" | 13 | android:layout_width="match_parent" |
| 14 | - android:layout_height="?attr/qmui_topbar_height" /> | 14 | + android:layout_height="48dp" /> |
| 15 | 15 | ||
| 16 | <android.support.design.widget.TabLayout | 16 | <android.support.design.widget.TabLayout |
| 17 | android:id="@+id/tabs" | 17 | android:id="@+id/tabs" |
moudle_pedometer/src/main/res/layout/five_persion_icon.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 4 | - android:layout_width="match_parent" | 4 | + android:layout_width="wrap_content" |
| 5 | android:layout_height="wrap_content" | 5 | android:layout_height="wrap_content" |
| 6 | - android:gravity="center_vertical|right"> | 6 | + android:gravity="center_vertical"> |
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | <com.qmuiteam.qmui.widget.QMUIRadiusImageView | 9 | <com.qmuiteam.qmui.widget.QMUIRadiusImageView |
| @@ -11,7 +11,6 @@ | @@ -11,7 +11,6 @@ | ||
| 11 | android:layout_width="40dp" | 11 | android:layout_width="40dp" |
| 12 | android:layout_height="40dp" | 12 | android:layout_height="40dp" |
| 13 | android:layout_marginLeft="10dp" | 13 | android:layout_marginLeft="10dp" |
| 14 | - android:background="@drawable/tc_ic_workout_level_adjust_coach" | ||
| 15 | app:qmui_corner_radius="100dp" /> | 14 | app:qmui_corner_radius="100dp" /> |
| 16 | 15 | ||
| 17 | <com.qmuiteam.qmui.widget.QMUIRadiusImageView | 16 | <com.qmuiteam.qmui.widget.QMUIRadiusImageView |
| @@ -19,7 +18,6 @@ | @@ -19,7 +18,6 @@ | ||
| 19 | android:layout_width="40dp" | 18 | android:layout_width="40dp" |
| 20 | android:layout_height="40dp" | 19 | android:layout_height="40dp" |
| 21 | android:layout_marginLeft="-10dp" | 20 | android:layout_marginLeft="-10dp" |
| 22 | - android:background="@drawable/tc_ic_workout_level_adjust_coach" | ||
| 23 | app:qmui_corner_radius="100dp" /> | 21 | app:qmui_corner_radius="100dp" /> |
| 24 | 22 | ||
| 25 | <com.qmuiteam.qmui.widget.QMUIRadiusImageView | 23 | <com.qmuiteam.qmui.widget.QMUIRadiusImageView |
| @@ -27,7 +25,6 @@ | @@ -27,7 +25,6 @@ | ||
| 27 | android:layout_width="40dp" | 25 | android:layout_width="40dp" |
| 28 | android:layout_height="40dp" | 26 | android:layout_height="40dp" |
| 29 | android:layout_marginLeft="-10dp" | 27 | android:layout_marginLeft="-10dp" |
| 30 | - android:background="@drawable/tc_ic_workout_level_adjust_coach" | ||
| 31 | app:qmui_corner_radius="100dp" /> | 28 | app:qmui_corner_radius="100dp" /> |
| 32 | 29 | ||
| 33 | <com.qmuiteam.qmui.widget.QMUIRadiusImageView | 30 | <com.qmuiteam.qmui.widget.QMUIRadiusImageView |
| @@ -35,7 +32,6 @@ | @@ -35,7 +32,6 @@ | ||
| 35 | android:layout_width="40dp" | 32 | android:layout_width="40dp" |
| 36 | android:layout_height="40dp" | 33 | android:layout_height="40dp" |
| 37 | android:layout_marginLeft="-10dp" | 34 | android:layout_marginLeft="-10dp" |
| 38 | - android:background="@drawable/tc_ic_workout_level_adjust_coach" | ||
| 39 | app:qmui_corner_radius="100dp" /> | 35 | app:qmui_corner_radius="100dp" /> |
| 40 | 36 | ||
| 41 | <com.qmuiteam.qmui.widget.QMUIRadiusImageView | 37 | <com.qmuiteam.qmui.widget.QMUIRadiusImageView |
| @@ -43,7 +39,6 @@ | @@ -43,7 +39,6 @@ | ||
| 43 | android:layout_width="40dp" | 39 | android:layout_width="40dp" |
| 44 | android:layout_height="40dp" | 40 | android:layout_height="40dp" |
| 45 | android:layout_marginLeft="-10dp" | 41 | android:layout_marginLeft="-10dp" |
| 46 | - android:background="@drawable/tc_ic_workout_level_adjust_coach" | ||
| 47 | app:qmui_corner_radius="100dp" /> | 42 | app:qmui_corner_radius="100dp" /> |
| 48 | 43 | ||
| 49 | <ImageView | 44 | <ImageView |
moudle_pedometer/src/main/res/layout/fragment_run_main.xml
| @@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
| 2 | <layout xmlns:android="http://schemas.android.com/apk/res/android"> | 2 | <layout xmlns:android="http://schemas.android.com/apk/res/android"> |
| 3 | 3 | ||
| 4 | <LinearLayout | 4 | <LinearLayout |
| 5 | + android:id="@+id/ll_root" | ||
| 5 | android:layout_width="match_parent" | 6 | android:layout_width="match_parent" |
| 6 | android:layout_height="match_parent" | 7 | android:layout_height="match_parent" |
| 7 | android:background="@color/run_main_bg" | 8 | android:background="@color/run_main_bg" |
| @@ -9,14 +10,12 @@ | @@ -9,14 +10,12 @@ | ||
| 9 | 10 | ||
| 10 | <FrameLayout | 11 | <FrameLayout |
| 11 | android:layout_width="match_parent" | 12 | android:layout_width="match_parent" |
| 12 | - android:background="@color/run_main_bg" | ||
| 13 | android:layout_height="match_parent"> | 13 | android:layout_height="match_parent"> |
| 14 | 14 | ||
| 15 | <LinearLayout | 15 | <LinearLayout |
| 16 | android:id="@+id/ll_run_main_root" | 16 | android:id="@+id/ll_run_main_root" |
| 17 | android:layout_width="match_parent" | 17 | android:layout_width="match_parent" |
| 18 | android:layout_height="match_parent" | 18 | android:layout_height="match_parent" |
| 19 | - android:background="@color/run_main_bg" | ||
| 20 | android:orientation="vertical"> | 19 | android:orientation="vertical"> |
| 21 | 20 | ||
| 22 | <RelativeLayout | 21 | <RelativeLayout |
moudle_pedometer/src/main/res/layout/fragment_run_race_detail.xml
| @@ -117,7 +117,7 @@ | @@ -117,7 +117,7 @@ | ||
| 117 | android:layout_height="40sp" | 117 | android:layout_height="40sp" |
| 118 | android:layout_gravity="bottom" | 118 | android:layout_gravity="bottom" |
| 119 | android:background="@color/green_round" | 119 | android:background="@color/green_round" |
| 120 | - android:tag="0"> | 120 | + android:tag="1"> |
| 121 | 121 | ||
| 122 | <TextView | 122 | <TextView |
| 123 | android:id="@+id/tv_run_now" | 123 | android:id="@+id/tv_run_now" |
moudle_pedometer/src/main/res/layout/item_my_record.xml
| @@ -80,9 +80,9 @@ | @@ -80,9 +80,9 @@ | ||
| 80 | 80 | ||
| 81 | <com.cnlive.moudle.pedometer.ui.widget.FivePersonIconView | 81 | <com.cnlive.moudle.pedometer.ui.widget.FivePersonIconView |
| 82 | android:id="@+id/join_person" | 82 | android:id="@+id/join_person" |
| 83 | - android:layout_width="wrap_content" | 83 | + android:layout_width="150dp" |
| 84 | android:layout_height="40dp" | 84 | android:layout_height="40dp" |
| 85 | - android:layout_marginRight="10dp" | 85 | + android:gravity="left" |
| 86 | FivePersonIconView:showRightFlag="false" /> | 86 | FivePersonIconView:showRightFlag="false" /> |
| 87 | 87 | ||
| 88 | <TextView | 88 | <TextView |
moudle_pedometer/src/main/res/layout/layout_coll_finish_user_info.xml
| @@ -112,7 +112,6 @@ | @@ -112,7 +112,6 @@ | ||
| 112 | android:layout_width="60dp" | 112 | android:layout_width="60dp" |
| 113 | android:layout_height="60dp" | 113 | android:layout_height="60dp" |
| 114 | android:layout_marginLeft="10dp" | 114 | android:layout_marginLeft="10dp" |
| 115 | - android:background="@drawable/tc_ic_workout_level_adjust_coach" | ||
| 116 | app:qmui_corner_radius="100dp" /> | 115 | app:qmui_corner_radius="100dp" /> |
| 117 | </FrameLayout> | 116 | </FrameLayout> |
| 118 | </layout> | 117 | </layout> |
| 119 | \ No newline at end of file | 118 | \ No newline at end of file |
moudle_pedometer/src/main/res/layout/layout_run_detail_rank.xml
| @@ -59,8 +59,11 @@ | @@ -59,8 +59,11 @@ | ||
| 59 | 59 | ||
| 60 | <com.cnlive.moudle.pedometer.ui.widget.FivePersonIconView | 60 | <com.cnlive.moudle.pedometer.ui.widget.FivePersonIconView |
| 61 | android:id="@+id/five_rank_person" | 61 | android:id="@+id/five_rank_person" |
| 62 | - android:layout_width="wrap_content" | 62 | + android:layout_width="150dp" |
| 63 | android:layout_height="35dp" | 63 | android:layout_height="35dp" |
| 64 | + android:layout_marginLeft="1dp" | ||
| 65 | + android:layout_marginRight="1dp" | ||
| 66 | + android:gravity="center" | ||
| 64 | FivePersonIconView:showRightFlag="false"></com.cnlive.moudle.pedometer.ui.widget.FivePersonIconView> | 67 | FivePersonIconView:showRightFlag="false"></com.cnlive.moudle.pedometer.ui.widget.FivePersonIconView> |
| 65 | 68 | ||
| 66 | <LinearLayout | 69 | <LinearLayout |
moudle_pedometer/src/main/res/layout/layout_run_detail_street.xml
| @@ -446,6 +446,7 @@ | @@ -446,6 +446,7 @@ | ||
| 446 | android:id="@+id/five_join_person" | 446 | android:id="@+id/five_join_person" |
| 447 | android:layout_width="180dp" | 447 | android:layout_width="180dp" |
| 448 | android:layout_height="40dp" | 448 | android:layout_height="40dp" |
| 449 | + android:gravity="right" | ||
| 449 | android:layout_marginRight="10dp" | 450 | android:layout_marginRight="10dp" |
| 450 | FivePersonIconView:showRightFlag="true" /> | 451 | FivePersonIconView:showRightFlag="true" /> |
| 451 | 452 |
moudle_pedometer/src/main/res/values/strings.xml
| @@ -92,6 +92,8 @@ | @@ -92,6 +92,8 @@ | ||
| 92 | <string name="run_race_far_tip">您距离起点较远\n请到达起点附近再开始</string> | 92 | <string name="run_race_far_tip">您距离起点较远\n请到达起点附近再开始</string> |
| 93 | <string name="run_race_arrive_end_tip">您已到达终点附近\n可以结束运动了</string> | 93 | <string name="run_race_arrive_end_tip">您已到达终点附近\n可以结束运动了</string> |
| 94 | <string name="layout_coll_take_point_text">(打点)</string> | 94 | <string name="layout_coll_take_point_text">(打点)</string> |
| 95 | - | ||
| 96 | - | 95 | + <!--默认头像url--> |
| 96 | + <string name="default_face_url">http://wjj.ys1.cnliveimg.com/769/img/2018/0416/head_c.png</string> | ||
| 97 | + <string name="step_service_tip">正在记录您的运动</string> | ||
| 98 | + <string name="keep_service_tip">正在运行,请不要停止,否则无法记录您的轨迹</string> | ||
| 97 | </resources> | 99 | </resources> |