Commit f2a8606fbb2ef1949085edd9615c6117bf065a06
1 parent
f4c87264
1 修改BUG
Showing
15 changed files
with
213 additions
and
153 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 | 0 | \ No newline at end of file |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/presenter/CollRunningFinishFragmetPresenter.java
| ... | ... | @@ -39,6 +39,9 @@ import io.reactivex.disposables.Disposable; |
| 39 | 39 | public class CollRunningFinishFragmetPresenter extends MvpBasePresenter<CollRunningFinishFragmentView> { |
| 40 | 40 | |
| 41 | 41 | public void uploadTraceDateToServer(Activity context, CollUserStepEntity userStepEntity, String roadmap) { |
| 42 | + if (null != getView()) { | |
| 43 | + getView().limitUploadBtnTouch(); | |
| 44 | + } | |
| 42 | 45 | QMUITipDialogUtil.loadingDialog(context, "正在上传数据", false); |
| 43 | 46 | Map<String, String> paramsMap = new HashMap<>(); |
| 44 | 47 | //赛事id |
| ... | ... | @@ -84,10 +87,10 @@ public class CollRunningFinishFragmetPresenter extends MvpBasePresenter<CollRunn |
| 84 | 87 | if (!TextUtils.isEmpty(userStepEntity.getStepCount())) { |
| 85 | 88 | double mileage = CollStepUtil.getWalkDistanceKM(Long.parseLong(userStepEntity.getStepCount())); |
| 86 | 89 | paramsMap.put("mileage", mileage + ""); |
| 87 | - if (0==mileage){ | |
| 90 | + if (0 == mileage) { | |
| 88 | 91 | paramsMap.put("mileage", "0"); |
| 89 | 92 | } |
| 90 | - }else { | |
| 93 | + } else { | |
| 91 | 94 | paramsMap.put("mileage", "0"); |
| 92 | 95 | } |
| 93 | 96 | //开始时间 |
| ... | ... | @@ -113,6 +116,9 @@ public class CollRunningFinishFragmetPresenter extends MvpBasePresenter<CollRunn |
| 113 | 116 | if (getView() == null) { |
| 114 | 117 | return; |
| 115 | 118 | } |
| 119 | + if (null != getView()) { | |
| 120 | + getView().allowUploadBtnTouch(); | |
| 121 | + } | |
| 116 | 122 | QMUITipDialogUtil.dismessDialog(); |
| 117 | 123 | SelectDialog selectDialog = new SelectDialog(context, "数据上传失败,是否重试?", "取消", new SelectDialog.DialogInterface() { |
| 118 | 124 | @Override | ... | ... |
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 | 2 | |
| 3 | 3 | import android.content.Context; |
| 4 | 4 | import android.graphics.Bitmap; |
| 5 | -import android.graphics.BitmapFactory; | |
| 6 | 5 | import android.os.Handler; |
| 7 | 6 | import android.support.v7.widget.LinearLayoutManager; |
| 8 | 7 | import android.text.TextUtils; |
| 9 | 8 | import android.util.Log; |
| 10 | 9 | import android.view.MotionEvent; |
| 11 | 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 | 12 | import com.baidu.mapapi.map.BaiduMap; |
| 17 | -import com.baidu.mapapi.map.BitmapDescriptorFactory; | |
| 18 | 13 | import com.baidu.mapapi.map.MapView; |
| 19 | -import com.baidu.mapapi.map.MyLocationConfiguration; | |
| 20 | 14 | import com.baidu.mapapi.map.Overlay; |
| 21 | 15 | import com.baidu.mapapi.map.UiSettings; |
| 22 | 16 | import com.baidu.mapapi.model.LatLng; |
| 23 | 17 | import com.baidu.trace.LBSTraceClient; |
| 24 | 18 | import com.baidu.trace.api.fence.AddMonitoredPersonResponse; |
| 25 | -import com.baidu.trace.api.fence.CreateFenceRequest; | |
| 26 | 19 | import com.baidu.trace.api.fence.CreateFenceResponse; |
| 27 | 20 | import com.baidu.trace.api.fence.DeleteFenceResponse; |
| 28 | 21 | import com.baidu.trace.api.fence.DeleteMonitoredPersonResponse; |
| ... | ... | @@ -33,7 +26,6 @@ import com.baidu.trace.api.fence.MonitoredStatusByLocationResponse; |
| 33 | 26 | import com.baidu.trace.api.fence.MonitoredStatusResponse; |
| 34 | 27 | import com.baidu.trace.api.fence.OnFenceListener; |
| 35 | 28 | import com.baidu.trace.api.fence.UpdateFenceResponse; |
| 36 | -import com.baidu.trace.model.CoordType; | |
| 37 | 29 | import com.baidu.trace.model.SortType; |
| 38 | 30 | import com.cnlive.libs.base.logic.Event; |
| 39 | 31 | import com.cnlive.libs.base.logic.callback.FailureCallback; |
| ... | ... | @@ -44,13 +36,9 @@ import com.cnlive.moudle.collectionTrace.ui.adapter.CollFinishDetaiAdapter; |
| 44 | 36 | import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunningFinishFragment; |
| 45 | 37 | import com.cnlive.moudle.collectionTrace.utils.CollStepUtil; |
| 46 | 38 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 47 | -import com.cnlive.moudle.pedometer.model.Constant; | |
| 48 | -import com.cnlive.moudle.pedometer.model.RunningFinishBean; | |
| 49 | 39 | import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity; |
| 50 | -import com.cnlive.moudle.pedometer.ui.fragment.RunningFinishFragment; | |
| 51 | 40 | import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; |
| 52 | 41 | import com.cnlive.moudle.pedometer.upload.UploadLogic; |
| 53 | -import com.cnlive.moudle.pedometer.utils.BitmapUtil; | |
| 54 | 42 | import com.cnlive.moudle.pedometer.utils.GsonUtil; |
| 55 | 43 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; |
| 56 | 44 | import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil; |
| ... | ... | @@ -59,7 +47,6 @@ import com.cnlive.moudle.pedometer.utils.TimeUtil; |
| 59 | 47 | import com.cnlive.strike.application.GlideApp; |
| 60 | 48 | import com.example.moudle_pedometer.R; |
| 61 | 49 | import com.hannesdorfmann.mosby3.mvp.MvpView; |
| 62 | -import com.qmuiteam.qmui.widget.dialog.QMUITipDialog; | |
| 63 | 50 | import com.sothree.slidinguppanel.SlidingUpPanelLayout; |
| 64 | 51 | |
| 65 | 52 | import java.io.File; |
| ... | ... | @@ -198,10 +185,14 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { |
| 198 | 185 | @Override |
| 199 | 186 | public void onClick(SelectDialog dialog) { |
| 200 | 187 | dialog.dismiss(); |
| 188 | + //允许点击 | |
| 189 | + allowUploadBtnTouch(); | |
| 201 | 190 | } |
| 202 | 191 | }, "是", new SelectDialog.DialogInterface() { |
| 203 | 192 | @Override |
| 204 | 193 | public void onClick(SelectDialog dialog) { |
| 194 | + //不让点击上传轨迹按钮 | |
| 195 | + limitUploadBtnTouch(); | |
| 205 | 196 | if (null != allMapOverlays) { |
| 206 | 197 | for (Overlay overlay : allMapOverlays) { |
| 207 | 198 | overlay.remove(); |
| ... | ... | @@ -303,6 +294,24 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { |
| 303 | 294 | |
| 304 | 295 | } |
| 305 | 296 | |
| 297 | + /** | |
| 298 | + * 屏蔽上传轨迹按钮 | |
| 299 | + */ | |
| 300 | + public void limitUploadBtnTouch() { | |
| 301 | + fragment.binding.rlScrollViewStartBtn.setFocusable(false); | |
| 302 | + fragment.binding.rlScrollViewStartBtn.setClickable(false); | |
| 303 | + fragment.binding.rlScrollViewStartBtn.setFocusableInTouchMode(false); | |
| 304 | + } | |
| 305 | + | |
| 306 | + /** | |
| 307 | + * 允许上传轨迹按钮 | |
| 308 | + */ | |
| 309 | + public void allowUploadBtnTouch() { | |
| 310 | + fragment.binding.rlScrollViewStartBtn.setFocusable(true); | |
| 311 | + fragment.binding.rlScrollViewStartBtn.setClickable(true); | |
| 312 | + fragment.binding.rlScrollViewStartBtn.setFocusableInTouchMode(true); | |
| 313 | + } | |
| 314 | + | |
| 306 | 315 | private void queryWalkTrace(long startTime, long endTime) { |
| 307 | 316 | MyMapUtil.queryHistoryTrace(getContext(), mClient, CommonInfo.getUserId(getContext()), startTime, endTime, new MyMapUtil.CallBack() { |
| 308 | 317 | @Override |
| ... | ... | @@ -362,6 +371,8 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { |
| 362 | 371 | } catch (Exception e) { |
| 363 | 372 | QMUITipDialogUtil.dismessDialog(); |
| 364 | 373 | QMUITipDialogUtil.failedDialog(getContext(), "赛事图片截取失败,请重试", 2); |
| 374 | + //允许点击 | |
| 375 | + allowUploadBtnTouch(); | |
| 365 | 376 | e.printStackTrace(); |
| 366 | 377 | } |
| 367 | 378 | } |
| ... | ... | @@ -374,6 +385,8 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { |
| 374 | 385 | * @param roadMapPath |
| 375 | 386 | */ |
| 376 | 387 | private void uploadRoadMapPic(String roadMapPath) { |
| 388 | + //禁止点击 | |
| 389 | + limitUploadBtnTouch(); | |
| 377 | 390 | if (!TextUtils.isEmpty(roadMapPath)) { |
| 378 | 391 | QMUITipDialogUtil.loadingDialog(getContext(), "正在上传赛事图片,请稍后", false); |
| 379 | 392 | List<String> imagePaths = new ArrayList<>(); |
| ... | ... | @@ -387,6 +400,8 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { |
| 387 | 400 | @Override |
| 388 | 401 | public void onClick(SelectDialog dialog) { |
| 389 | 402 | dialog.dismiss(); |
| 403 | + //允许点击 | |
| 404 | + allowUploadBtnTouch(); | |
| 390 | 405 | } |
| 391 | 406 | }, "重试", new SelectDialog.DialogInterface() { |
| 392 | 407 | @Override | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollRunningMapFragmentView.java
| ... | ... | @@ -631,7 +631,7 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener |
| 631 | 631 | if (isShowFollowAddress && !TextUtils.isEmpty(currentAddress)) { |
| 632 | 632 | if (isShowFollowAddress && selectDialog != null && !selectDialog.isShowing()) { |
| 633 | 633 | if (!TextUtils.isEmpty(currentAddress)) { |
| 634 | - selectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设置开始地点?"); | |
| 634 | + selectDialog.setTipMessage("确定在" + "\"" + currentAddress + "\"" + "打点?"); | |
| 635 | 635 | if (!selectDialog.isShowing()) { |
| 636 | 636 | selectDialog.show(); |
| 637 | 637 | } | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollTraceListDetailFragmentView.java
| ... | ... | @@ -197,6 +197,34 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener |
| 197 | 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 | + } | |
| 208 | + //设置终点 | |
| 209 | + CollectPoint endLocation = null; | |
| 210 | + if (!TextUtils.isEmpty(eventShoeLinesBean.getEndLocation())) { | |
| 211 | + endLocation = new CollectPoint(); | |
| 212 | + endLocation.setPointName(eventShoeLinesBean.getEndLocation()); | |
| 213 | + endLocation.setLatitude(0); | |
| 214 | + endLocation.setLongitude(0); | |
| 215 | + } | |
| 216 | + if (null != startLocation) { | |
| 217 | + if (null == allCollectPoints) { | |
| 218 | + allCollectPoints = new ArrayList<>(); | |
| 219 | + } | |
| 220 | + allCollectPoints.add(0, startLocation); | |
| 221 | + } | |
| 222 | + if (null != endLocation) { | |
| 223 | + if (null == allCollectPoints) { | |
| 224 | + allCollectPoints = new ArrayList<>(); | |
| 225 | + } | |
| 226 | + allCollectPoints.add(endLocation); | |
| 227 | + } | |
| 200 | 228 | //设置打点liebiao |
| 201 | 229 | if (null != allCollectPoints && allCollectPoints.size() > 1) { |
| 202 | 230 | //设置适配器 |
| ... | ... | @@ -251,10 +279,6 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener |
| 251 | 279 | |
| 252 | 280 | //获取打点不为空 |
| 253 | 281 | if (null != finalResultCollectPoints && finalResultCollectPoints.size() > 1) { |
| 254 | - //移除起点 | |
| 255 | - finalResultCollectPoints.remove(0); | |
| 256 | - //移除终点 | |
| 257 | - finalResultCollectPoints.remove(finalResultCollectPoints.size() - 1); | |
| 258 | 282 | //开始在地图上绘制打点信息 |
| 259 | 283 | for (int i = 0; i < finalResultCollectPoints.size(); i++) { |
| 260 | 284 | LatLng latLng = new LatLng(finalResultCollectPoints.get(i).getLatitude(), finalResultCollectPoints.get(i).getLongitude()); | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/service/CollKeepLiveService.java
| ... | ... | @@ -48,6 +48,7 @@ public class CollKeepLiveService extends Service implements MediaPlayer.OnComple |
| 48 | 48 | private Handler handler; |
| 49 | 49 | private Runnable runnable; |
| 50 | 50 | private boolean isRegisterReceiver = false; |
| 51 | + private boolean isStartForegroundService = false; | |
| 51 | 52 | |
| 52 | 53 | public CollKeepLiveService() { |
| 53 | 54 | } |
| ... | ... | @@ -69,14 +70,16 @@ public class CollKeepLiveService extends Service implements MediaPlayer.OnComple |
| 69 | 70 | handler.postDelayed(this, 5000); |
| 70 | 71 | } else { |
| 71 | 72 | try { |
| 72 | - if (myReceiver != null) { | |
| 73 | + if (myReceiver != null&&isRegisterReceiver) { | |
| 73 | 74 | unregisterReceiver(myReceiver); |
| 74 | 75 | } |
| 75 | 76 | } catch (Exception e) { |
| 76 | 77 | Log.e(TAG, "run: "); |
| 77 | 78 | } |
| 78 | 79 | stopPlaySong(); |
| 79 | - stopForeground(true); | |
| 80 | + if (isStartForegroundService) { | |
| 81 | + stopForeground(true); | |
| 82 | + } | |
| 80 | 83 | } |
| 81 | 84 | |
| 82 | 85 | } |
| ... | ... | @@ -210,6 +213,7 @@ public class CollKeepLiveService extends Service implements MediaPlayer.OnComple |
| 210 | 213 | .build(); |
| 211 | 214 | // 0 隐藏前台服务通知 |
| 212 | 215 | startForeground(100, notification); |
| 216 | + isStartForegroundService = true; | |
| 213 | 217 | // stopForeground(true); |
| 214 | 218 | } |
| 215 | 219 | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/RegistrationInfoPresenter.java
| ... | ... | @@ -33,6 +33,9 @@ import io.reactivex.disposables.Disposable; |
| 33 | 33 | public class RegistrationInfoPresenter extends MvpBasePresenter<RegistrationInfoView> { |
| 34 | 34 | |
| 35 | 35 | public void commitInfo(Context context, String eventId, String sid, String mobile, String sex, String birthday) { |
| 36 | + if (null!=getView()){ | |
| 37 | + getView().limitClickRegistBtn(); | |
| 38 | + } | |
| 36 | 39 | HashMap<String, String> map = new HashMap<>(); |
| 37 | 40 | map.put("eventId", eventId); |
| 38 | 41 | map.put("sid", sid); |
| ... | ... | @@ -55,6 +58,9 @@ public class RegistrationInfoPresenter extends MvpBasePresenter<RegistrationInfo |
| 55 | 58 | }).<BaseInfo>event().setFailureCallback(new FailureCallback() { |
| 56 | 59 | @Override |
| 57 | 60 | public void onFailure(int code, String message) { |
| 61 | + if (null!=getView()){ | |
| 62 | + getView().allowClickRegistBtn(); | |
| 63 | + } | |
| 58 | 64 | // if (408 == code) { |
| 59 | 65 | // if (getView() != null) { |
| 60 | 66 | // getView().toResult(); | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RegistrationInfoView.java
| ... | ... | @@ -44,17 +44,17 @@ public class RegistrationInfoView implements MvpView, OnDateSetListener { |
| 44 | 44 | fragment.getActivity().finish(); |
| 45 | 45 | }); |
| 46 | 46 | fragment.binding.topbar.setTitle("填写报名信息"); |
| 47 | - if(CommonInfo.getUserNickName(fragment.getActivity()) != null && CommonInfo.getUserNickName(fragment.getActivity()).trim().length() > 0){ | |
| 47 | + if (CommonInfo.getUserNickName(fragment.getActivity()) != null && CommonInfo.getUserNickName(fragment.getActivity()).trim().length() > 0) { | |
| 48 | 48 | fragment.binding.userName.setText(CommonInfo.getUserNickName(fragment.getActivity())); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - if(CommonInfo.getUserPhone(fragment.getActivity()) != null && CommonInfo.getUserPhone(fragment.getActivity()).trim().length() > 0){ | |
| 51 | + if (CommonInfo.getUserPhone(fragment.getActivity()) != null && CommonInfo.getUserPhone(fragment.getActivity()).trim().length() > 0) { | |
| 52 | 52 | fragment.binding.phoneNum.setText(CommonInfo.getUserPhone(fragment.getActivity())); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - if(CommonInfo.getUserIcon(fragment.getActivity()) != null && CommonInfo.getUserIcon(fragment.getActivity()).trim().length() > 0){ | |
| 55 | + if (CommonInfo.getUserIcon(fragment.getActivity()) != null && CommonInfo.getUserIcon(fragment.getActivity()).trim().length() > 0) { | |
| 56 | 56 | Glide.with(fragment.getActivity()).load(CommonInfo.getUserIcon(fragment.getActivity())) |
| 57 | - .apply(RequestOptions.bitmapTransform(new CircleCrop()).placeholder(R.drawable.ic_icon)).into( fragment.binding.userIcon); | |
| 57 | + .apply(RequestOptions.bitmapTransform(new CircleCrop()).placeholder(R.drawable.ic_icon)).into(fragment.binding.userIcon); | |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | fragment.binding.commitInfo.setOnClickListener(v -> fragment.commitInfo()); |
| ... | ... | @@ -111,7 +111,7 @@ public class RegistrationInfoView implements MvpView, OnDateSetListener { |
| 111 | 111 | |
| 112 | 112 | public void toResult() { |
| 113 | 113 | EventBus.getDefault().post(new MessageEvent(Constant.REGISTRATION_SUCCESS, "")); |
| 114 | - AlertUtil.showLongToast(fragment.getActivity(),"恭喜你报名成功",3000); | |
| 114 | + AlertUtil.showLongToast(fragment.getActivity(), "恭喜你报名成功", 3000); | |
| 115 | 115 | fragment.getActivity().finish(); |
| 116 | 116 | } |
| 117 | 117 | |
| ... | ... | @@ -121,4 +121,22 @@ public class RegistrationInfoView implements MvpView, OnDateSetListener { |
| 121 | 121 | // 生日(非必填) 未选择 |
| 122 | 122 | fragment.binding.birthday.setText(DateTimeUtil.formatDateTime(millseconds, "yyyy年MM月dd日")); |
| 123 | 123 | } |
| 124 | + | |
| 125 | + /** | |
| 126 | + * 不允许点击 | |
| 127 | + */ | |
| 128 | + public void limitClickRegistBtn() { | |
| 129 | + fragment.binding.commitInfo.setClickable(false); | |
| 130 | + fragment.binding.commitInfo.setFocusableInTouchMode(false); | |
| 131 | + fragment.binding.commitInfo.setFocusable(false); | |
| 132 | + } | |
| 133 | + | |
| 134 | + /** | |
| 135 | + * 允许点击 | |
| 136 | + */ | |
| 137 | + public void allowClickRegistBtn() { | |
| 138 | + fragment.binding.commitInfo.setClickable(true); | |
| 139 | + fragment.binding.commitInfo.setFocusableInTouchMode(true); | |
| 140 | + fragment.binding.commitInfo.setFocusable(true); | |
| 141 | + } | |
| 124 | 142 | } | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunRaceDetailFragmentView.java
| ... | ... | @@ -39,6 +39,7 @@ import com.baidu.mapapi.utils.DistanceUtil; |
| 39 | 39 | import com.baidu.trace.LBSTraceClient; |
| 40 | 40 | import com.baidu.trace.model.SortType; |
| 41 | 41 | import com.cnlive.libs.base.application.AppConfig; |
| 42 | +import com.cnlive.libs.base.util.AlertUtil; | |
| 42 | 43 | import com.cnlive.libs.base.util.StatusBarUtil2; |
| 43 | 44 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 44 | 45 | import com.cnlive.moudle.pedometer.model.Constant; |
| ... | ... | @@ -112,6 +113,10 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 112 | 113 | private final float DEFAULT_MAP_AUTO_ZOOM = -0.8f;//根据点位,自动缩放的比例 |
| 113 | 114 | private List<LatLng> queryResultPoints;//查询到的历史轨迹 |
| 114 | 115 | private List<String> joinFaceIcon;//参与活动人数 |
| 116 | + private final String REGIST_RACE = "0";//立即报名 | |
| 117 | + private final String START_RACE = "1";//立即开始 | |
| 118 | + private final String CONTINUE_RACE = "2";//继续运动 | |
| 119 | + private final String END_RACE = "3";//运动已结束 | |
| 115 | 120 | |
| 116 | 121 | public RunRaceDetailFragmentView(RunRaceDetailFragment fragment) { |
| 117 | 122 | this.fragment = fragment; |
| ... | ... | @@ -184,7 +189,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 184 | 189 | StatusBarUtil2.setColor(fragment.getActivity(), getContext().getResources().getColor(R.color.run_main_bg), 0); |
| 185 | 190 | |
| 186 | 191 | } |
| 187 | - } else if (slideOffset!=0){ | |
| 192 | + } else if (slideOffset != 0) { | |
| 188 | 193 | if (fragment.binding.flTop.getVisibility() == View.VISIBLE) { |
| 189 | 194 | QMUIStatusBarHelper.setStatusBarLightMode(fragment.getActivity()); |
| 190 | 195 | StatusBarUtil2.setColor(fragment.getActivity(), getContext().getResources().getColor(R.color.white), 0); |
| ... | ... | @@ -452,12 +457,12 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 452 | 457 | } |
| 453 | 458 | //判断用户是否报名 |
| 454 | 459 | if (runRaceDetailInfo.isSignResult()) { |
| 455 | - fragment.binding.rlScrollViewStartBtn.setTag("1"); | |
| 460 | + fragment.binding.rlScrollViewStartBtn.setTag(START_RACE); | |
| 456 | 461 | fragment.binding.tvRunNow.setText("现在开始"); |
| 457 | 462 | fragment.binding.tvGoTip.setVisibility(View.VISIBLE); |
| 458 | 463 | checkStartBtnState(); |
| 459 | 464 | } else { |
| 460 | - fragment.binding.rlScrollViewStartBtn.setTag("0"); | |
| 465 | + fragment.binding.rlScrollViewStartBtn.setTag(REGIST_RACE); | |
| 461 | 466 | fragment.binding.tvRunNow.setText("立即报名"); |
| 462 | 467 | fragment.binding.tvGoTip.setVisibility(View.GONE); |
| 463 | 468 | } |
| ... | ... | @@ -514,13 +519,13 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 514 | 519 | @Override |
| 515 | 520 | public void onClick(View view) { |
| 516 | 521 | //立即报名 |
| 517 | - if ("0".equals(fragment.binding.rlScrollViewStartBtn.getTag())) { | |
| 522 | + if (REGIST_RACE.equals(fragment.binding.rlScrollViewStartBtn.getTag())) { | |
| 518 | 523 | if (null != runRaceDetailInfo) { |
| 519 | 524 | RegistrationInfoActivity.newInstance(fragment.getActivity(), runRaceDetailInfo.getFenceId()); |
| 520 | 525 | } |
| 521 | 526 | } |
| 522 | 527 | //现在开始 |
| 523 | - else if ("1".equals(fragment.binding.rlScrollViewStartBtn.getTag())) { | |
| 528 | + else if (START_RACE.equals(fragment.binding.rlScrollViewStartBtn.getTag())) { | |
| 524 | 529 | //先判断是否从百度查询到赛事轨迹 |
| 525 | 530 | if (null != endLatLng && null != startLatLng) { |
| 526 | 531 | //开始比较距离 |
| ... | ... | @@ -549,7 +554,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 549 | 554 | } |
| 550 | 555 | } |
| 551 | 556 | //继续运动 |
| 552 | - else if ("2".equals(fragment.binding.rlScrollViewStartBtn.getTag())) { | |
| 557 | + else if (CONTINUE_RACE.equals(fragment.binding.rlScrollViewStartBtn.getTag())) { | |
| 553 | 558 | if (!isDifferentStreet) { |
| 554 | 559 | SelectDialog continueTipDialog = new SelectDialog(getContext(), "是否继续运动", "否", new SelectDialog.DialogInterface() { |
| 555 | 560 | @Override |
| ... | ... | @@ -563,7 +568,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 563 | 568 | dialog.dismiss(); |
| 564 | 569 | //重置按钮 |
| 565 | 570 | fragment.binding.tvRunNow.setText("立即开始"); |
| 566 | - fragment.binding.rlScrollViewStartBtn.setTag("1"); | |
| 571 | + fragment.binding.rlScrollViewStartBtn.setTag(START_RACE); | |
| 567 | 572 | } |
| 568 | 573 | }, "是", new SelectDialog.DialogInterface() { |
| 569 | 574 | @Override |
| ... | ... | @@ -592,7 +597,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 592 | 597 | CommonInfo.resetRace(getContext()); |
| 593 | 598 | //更改当前按钮 |
| 594 | 599 | fragment.binding.tvRunNow.setText("立即开始"); |
| 595 | - fragment.binding.rlScrollViewStartBtn.setTag("1"); | |
| 600 | + fragment.binding.rlScrollViewStartBtn.setTag(START_RACE); | |
| 596 | 601 | |
| 597 | 602 | } |
| 598 | 603 | }, "是", new SelectDialog.DialogInterface() { |
| ... | ... | @@ -606,6 +611,9 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 606 | 611 | selectDialog.setCancelable(false); |
| 607 | 612 | selectDialog.show(); |
| 608 | 613 | } |
| 614 | + } else if (END_RACE.equals(fragment.binding.rlScrollViewStartBtn.getTag())) { | |
| 615 | + AlertUtil.showDeftToast(getContext(), "赛事已结束"); | |
| 616 | + return; | |
| 609 | 617 | } |
| 610 | 618 | } |
| 611 | 619 | }); |
| ... | ... | @@ -1019,7 +1027,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 1019 | 1027 | if ((currnetTime - userPauseTime) <= (9 * 60 * 60 * 1000)) { |
| 1020 | 1028 | Log.e(TAG, "小于9小时"); |
| 1021 | 1029 | fragment.binding.tvRunNow.setText("继续运动"); |
| 1022 | - fragment.binding.rlScrollViewStartBtn.setTag("2"); | |
| 1030 | + fragment.binding.rlScrollViewStartBtn.setTag(CONTINUE_RACE); | |
| 1023 | 1031 | } else { |
| 1024 | 1032 | Log.e(TAG, "大于9小时"); |
| 1025 | 1033 | //重置数据 |
| ... | ... | @@ -1027,7 +1035,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 1027 | 1035 | //清空数据库 |
| 1028 | 1036 | StepUtil.clearRunData(getContext(), CommonInfo.getUserId(getContext())); |
| 1029 | 1037 | fragment.binding.tvRunNow.setText("立即开始"); |
| 1030 | - fragment.binding.rlScrollViewStartBtn.setTag("1"); | |
| 1038 | + fragment.binding.rlScrollViewStartBtn.setTag(START_RACE); | |
| 1031 | 1039 | |
| 1032 | 1040 | } |
| 1033 | 1041 | |
| ... | ... | @@ -1045,11 +1053,11 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 1045 | 1053 | return; |
| 1046 | 1054 | } |
| 1047 | 1055 | if (runRaceDetailInfo.isSignResult()) { |
| 1048 | - fragment.binding.rlScrollViewStartBtn.setTag("1"); | |
| 1056 | + fragment.binding.rlScrollViewStartBtn.setTag(START_RACE); | |
| 1049 | 1057 | fragment.binding.tvRunNow.setText("现在开始"); |
| 1050 | 1058 | fragment.binding.tvGoTip.setVisibility(View.VISIBLE); |
| 1051 | 1059 | } else { |
| 1052 | - fragment.binding.rlScrollViewStartBtn.setTag("0"); | |
| 1060 | + fragment.binding.rlScrollViewStartBtn.setTag(REGIST_RACE); | |
| 1053 | 1061 | fragment.binding.tvRunNow.setText("立即报名"); |
| 1054 | 1062 | fragment.binding.tvGoTip.setVisibility(View.GONE); |
| 1055 | 1063 | } |
| ... | ... | @@ -1078,7 +1086,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 1078 | 1086 | //清除数据 |
| 1079 | 1087 | CommonInfo.resetRace(getContext()); |
| 1080 | 1088 | //设置按钮状态 |
| 1081 | - fragment.binding.rlScrollViewStartBtn.setTag("3"); | |
| 1089 | + fragment.binding.rlScrollViewStartBtn.setTag(END_RACE); | |
| 1082 | 1090 | fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.red_round)); |
| 1083 | 1091 | fragment.binding.tvRunNow.setText("赛事已结束"); |
| 1084 | 1092 | fragment.binding.tvGoTip.setVisibility(View.GONE); |
| ... | ... | @@ -1091,7 +1099,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 1091 | 1099 | if (null != runRaceDetailInfo) { |
| 1092 | 1100 | if (runRaceDetailInfo.isEndState()) { |
| 1093 | 1101 | //设置按钮状态 |
| 1094 | - fragment.binding.rlScrollViewStartBtn.setTag("3"); | |
| 1102 | + fragment.binding.rlScrollViewStartBtn.setTag(END_RACE); | |
| 1095 | 1103 | fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.red_round)); |
| 1096 | 1104 | fragment.binding.tvRunNow.setText("赛事已结束"); |
| 1097 | 1105 | fragment.binding.tvGoTip.setVisibility(View.GONE); |
| ... | ... | @@ -1306,7 +1314,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 1306 | 1314 | } else { |
| 1307 | 1315 | fragment.binding.includeStreet.tvSignPerson.setText("1"); |
| 1308 | 1316 | } |
| 1309 | - fragment.binding.rlScrollViewStartBtn.setTag("1"); | |
| 1317 | + fragment.binding.rlScrollViewStartBtn.setTag(START_RACE); | |
| 1310 | 1318 | fragment.binding.tvRunNow.setText("现在开始"); |
| 1311 | 1319 | fragment.binding.tvGoTip.setVisibility(View.VISIBLE); |
| 1312 | 1320 | if (null != runRaceDetailInfo) { | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/service/KeepLiveService.java
| ... | ... | @@ -79,7 +79,7 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion |
| 79 | 79 | handler.postDelayed(this, 5000); |
| 80 | 80 | } else { |
| 81 | 81 | try { |
| 82 | - if (myReceiver != null) { | |
| 82 | + if (myReceiver != null && isRegisterReceiver) { | |
| 83 | 83 | unregisterReceiver(myReceiver); |
| 84 | 84 | } |
| 85 | 85 | } catch (Exception e) { |
| ... | ... | @@ -116,7 +116,7 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion |
| 116 | 116 | intentFilter.addAction("com.cnlive.strike.receiver.ServiceReceiver"); |
| 117 | 117 | intentFilter.addAction("close.KeepService"); |
| 118 | 118 | registerReceiver(myReceiver, intentFilter); |
| 119 | - isRegisterReceiver=true; | |
| 119 | + isRegisterReceiver = true; | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
| ... | ... | @@ -240,7 +240,7 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion |
| 240 | 240 | public void onDestroy() { |
| 241 | 241 | super.onDestroy(); |
| 242 | 242 | try { |
| 243 | - if (myReceiver != null&&isRegisterReceiver) { | |
| 243 | + if (myReceiver != null && isRegisterReceiver) { | |
| 244 | 244 | unregisterReceiver(myReceiver); |
| 245 | 245 | } |
| 246 | 246 | } catch (Exception e) { | ... | ... |
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 | 35 | @Route(path = "/moudle_pedometer/InterestActivity") |
| 36 | 36 | public class PedometerMainActivity extends QMUIFragmentActivity { |
| 37 | 37 | private static final String TAG = "PedometerMainActivity"; |
| 38 | - | |
| 39 | - | |
| 40 | - private PermissionsUtils mPermissionsUtils = new PermissionsUtils();//权限申请 | |
| 41 | 38 | private RunMainFragment fragment; |
| 42 | 39 | private List<LatLng> importStreetPoints; |
| 43 | 40 | private RunRaceDetailInfo runRaceDetailInfo; |
| ... | ... | @@ -50,7 +47,14 @@ public class PedometerMainActivity extends QMUIFragmentActivity { |
| 50 | 47 | @Override |
| 51 | 48 | protected void onCreate(Bundle savedInstanceState) { |
| 52 | 49 | super.onCreate(savedInstanceState); |
| 53 | - runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().get("runRaceDetailInfo"); | |
| 50 | + if (null != getIntent().getExtras().get("runRaceDetailInfo")) { | |
| 51 | + runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().get("runRaceDetailInfo"); | |
| 52 | + if (getCurrentFragment() == null) { | |
| 53 | + if (runRaceDetailInfo != null) { | |
| 54 | + addFragment(runRaceDetailInfo); | |
| 55 | + } | |
| 56 | + } | |
| 57 | + } | |
| 54 | 58 | } |
| 55 | 59 | |
| 56 | 60 | |
| ... | ... | @@ -59,10 +63,6 @@ public class PedometerMainActivity extends QMUIFragmentActivity { |
| 59 | 63 | super.onDestroy(); |
| 60 | 64 | } |
| 61 | 65 | |
| 62 | - private void checkIsOpenNotifiction() { | |
| 63 | - getPermissionsWithTip(); | |
| 64 | - } | |
| 65 | - | |
| 66 | 66 | |
| 67 | 67 | @Override |
| 68 | 68 | protected void onRestart() { |
| ... | ... | @@ -73,7 +73,6 @@ public class PedometerMainActivity extends QMUIFragmentActivity { |
| 73 | 73 | @Override |
| 74 | 74 | protected void onResume() { |
| 75 | 75 | super.onResume(); |
| 76 | - checkIsOpenNotifiction(); | |
| 77 | 76 | } |
| 78 | 77 | |
| 79 | 78 | private void addFragment(RunRaceDetailInfo runRaceDetailInfo) { |
| ... | ... | @@ -85,72 +84,6 @@ public class PedometerMainActivity extends QMUIFragmentActivity { |
| 85 | 84 | } |
| 86 | 85 | |
| 87 | 86 | |
| 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 | 87 | @Override |
| 155 | 88 | public void onBackPressed() { |
| 156 | 89 | return; | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/RunRaceDetailActivity.java
| ... | ... | @@ -4,11 +4,14 @@ import android.Manifest; |
| 4 | 4 | import android.app.Activity; |
| 5 | 5 | import android.content.Context; |
| 6 | 6 | import android.content.Intent; |
| 7 | +import android.content.pm.PackageManager; | |
| 8 | +import android.net.Uri; | |
| 7 | 9 | import android.os.Bundle; |
| 8 | 10 | import android.provider.Settings; |
| 9 | 11 | import android.support.annotation.NonNull; |
| 10 | 12 | import android.support.annotation.Nullable; |
| 11 | 13 | import android.support.design.widget.BottomSheetDialog; |
| 14 | +import android.support.v4.app.ActivityCompat; | |
| 12 | 15 | import android.text.TextUtils; |
| 13 | 16 | import android.util.Log; |
| 14 | 17 | import android.view.View; |
| ... | ... | @@ -29,6 +32,7 @@ import com.cnlive.moudle.pedometer.ui.fragment.RunMainFragment; |
| 29 | 32 | import com.cnlive.moudle.pedometer.ui.fragment.RunRaceDetailFragment; |
| 30 | 33 | import com.cnlive.moudle.pedometer.ui.fragment.RunningMapFragment; |
| 31 | 34 | import com.cnlive.moudle.pedometer.ui.widget.FivePersonIconView; |
| 35 | +import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; | |
| 32 | 36 | import com.cnlive.moudle.pedometer.utils.CheckUtil; |
| 33 | 37 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; |
| 34 | 38 | import com.cnlive.moudle.pedometer.utils.NotificationUtil; |
| ... | ... | @@ -50,6 +54,8 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { |
| 50 | 54 | private QMUIFragment fragment; |
| 51 | 55 | private PermissionsUtils mPermissionsUtils = new PermissionsUtils();//权限申请 |
| 52 | 56 | private String eventId;//赛道id |
| 57 | + private int permissionRequestCount = 0;//权限请求次数 | |
| 58 | + private SelectDialog selectDialog; | |
| 53 | 59 | |
| 54 | 60 | public static void startActivity(Activity activity, String eventId, String userId, String userIcon, String userName, String userPhone) { |
| 55 | 61 | Intent intent = new Intent(activity, RunRaceDetailActivity.class); |
| ... | ... | @@ -77,8 +83,8 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { |
| 77 | 83 | CommonInfo.setUserNickName(this, getIntent().getStringExtra("userName")); |
| 78 | 84 | CommonInfo.setUserIcon(this, getIntent().getStringExtra("userIcon")); |
| 79 | 85 | CommonInfo.setUserPhone(this, getIntent().getStringExtra("userPhone")); |
| 80 | - | |
| 81 | 86 | } |
| 87 | + initPermissionDefineTip(); | |
| 82 | 88 | //判断用户是否结束运动 |
| 83 | 89 | // boolean isRunStep = CommonInfo.getIsRunStepService(this); |
| 84 | 90 | // //没有找到相关记录 |
| ... | ... | @@ -92,6 +98,30 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { |
| 92 | 98 | |
| 93 | 99 | } |
| 94 | 100 | |
| 101 | + private void initPermissionDefineTip() { | |
| 102 | + selectDialog = new SelectDialog(RunRaceDetailActivity.this, "您尚未授予程序运行所需权限\n是否设置?", | |
| 103 | + "返回", new SelectDialog.DialogInterface() { | |
| 104 | + @Override | |
| 105 | + public void onClick(SelectDialog dialog) { | |
| 106 | + dialog.dismiss(); | |
| 107 | + finish(); | |
| 108 | + } | |
| 109 | + }, "设置", new SelectDialog.DialogInterface() { | |
| 110 | + @Override | |
| 111 | + public void onClick(SelectDialog dialog) { | |
| 112 | + dialog.dismiss(); | |
| 113 | +// if (!ActivityCompat.shouldShowRequestPermissionRationale(this, permissions[i])) { | |
| 114 | +// showToast("点击权限,并打开全部权限"); | |
| 115 | + Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); | |
| 116 | + Uri uri = Uri.fromParts("package", getPackageName(), null); | |
| 117 | + intent.setData(uri); | |
| 118 | + startActivityForResult(intent, 0); | |
| 119 | + permissionRequestCount = 0; | |
| 120 | +// } | |
| 121 | + } | |
| 122 | + }); | |
| 123 | + } | |
| 124 | + | |
| 95 | 125 | @Override |
| 96 | 126 | protected void onResume() { |
| 97 | 127 | super.onResume(); |
| ... | ... | @@ -140,6 +170,9 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { |
| 140 | 170 | * 一次申请一组权限(使用拒绝弹框)点击事件 |
| 141 | 171 | */ |
| 142 | 172 | public void getPermissionsWithTip() { |
| 173 | + if (1 == permissionRequestCount) { | |
| 174 | + return; | |
| 175 | + } | |
| 143 | 176 | mPermissionsUtils |
| 144 | 177 | .setPermissionsListener(new PermissionsListener() { |
| 145 | 178 | @Override |
| ... | ... | @@ -187,6 +220,36 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { |
| 187 | 220 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, |
| 188 | 221 | @NonNull int[] grantResults) { |
| 189 | 222 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); |
| 190 | - mPermissionsUtils.dealResult(requestCode, permissions, grantResults); | |
| 223 | + if (1 == permissionRequestCount) { | |
| 224 | + return; | |
| 225 | + } | |
| 226 | + boolean isShowPermissionTip = true; | |
| 227 | + for (int i = 0; i < grantResults.length; i++) {//判断权限的结果,如果有被拒绝,就return | |
| 228 | + if (grantResults[i] == PackageManager.PERMISSION_DENIED) { | |
| 229 | + if (!ActivityCompat.shouldShowRequestPermissionRationale(this, permissions[i])) { | |
| 230 | + isShowPermissionTip = false; | |
| 231 | + break; | |
| 232 | +//// showToast("点击权限,并打开全部权限"); | |
| 233 | +// Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); | |
| 234 | +// Uri uri = Uri.fromParts("package", getPackageName(), null); | |
| 235 | +// intent.setData(uri); | |
| 236 | +// startActivityForResult(intent, 0); | |
| 237 | + } | |
| 238 | + } | |
| 239 | + } | |
| 240 | + if (isShowPermissionTip) { | |
| 241 | + mPermissionsUtils.dealResult(requestCode, permissions, grantResults); | |
| 242 | + } else { | |
| 243 | + if (0 == permissionRequestCount) { | |
| 244 | + selectDialog.setCancelable(false); | |
| 245 | + selectDialog.setCanceledOnTouchOutside(false); | |
| 246 | + if (!selectDialog.isShowing()) { | |
| 247 | + selectDialog.show(); | |
| 248 | + permissionRequestCount = 1; | |
| 249 | + } | |
| 250 | + } else { | |
| 251 | + return; | |
| 252 | + } | |
| 253 | + } | |
| 191 | 254 | } |
| 192 | 255 | -} |
| 256 | +} | |
| 193 | 257 | \ No newline at end of file | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/adapter/RunLineAdapter.java
| ... | ... | @@ -65,7 +65,12 @@ public class RunLineAdapter extends RecyclerView.Adapter<RunLineAdapter.MyViewHo |
| 65 | 65 | myViewHolder.line_address.setText(list.get(i).getAddress()); |
| 66 | 66 | } |
| 67 | 67 | myViewHolder.people_part.setText(list.get(i).getSignupNum() + ""); |
| 68 | - myViewHolder.join_person.initIconData(list.get(i).getFaceUrl()); | |
| 68 | + if (null != list.get(i).getFaceUrl() && list.get(i).getFaceUrl().size() > 0) { | |
| 69 | + myViewHolder.join_person.initIconData(list.get(i).getFaceUrl()); | |
| 70 | + myViewHolder.join_person.setVisibility(View.VISIBLE); | |
| 71 | + } else { | |
| 72 | + myViewHolder.join_person.setVisibility(View.GONE); | |
| 73 | + } | |
| 69 | 74 | } |
| 70 | 75 | |
| 71 | 76 | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RegistrationInfoFragment.java
| ... | ... | @@ -79,6 +79,9 @@ public class RegistrationInfoFragment extends MvpBindingFragment<RegistrationInf |
| 79 | 79 | * @param fenceId |
| 80 | 80 | */ |
| 81 | 81 | public void addMonitorToFence(int fenceId) { |
| 82 | + if (null!=getMvpView()){ | |
| 83 | + getMvpView().limitClickRegistBtn(); | |
| 84 | + } | |
| 82 | 85 | if (null == getPresenter()) { |
| 83 | 86 | return; |
| 84 | 87 | } |
| ... | ... | @@ -145,6 +148,9 @@ public class RegistrationInfoFragment extends MvpBindingFragment<RegistrationInf |
| 145 | 148 | binding.sexText.getText().toString().trim().equals("未选择") ? "" : binding.sexText.getText().toString().trim(), |
| 146 | 149 | binding.birthday.getText().toString().trim().equals("未选择") ? "" : binding.birthday.getText().toString().trim()); |
| 147 | 150 | } else { |
| 151 | + if (null!=getMvpView()){ | |
| 152 | + getMvpView().allowClickRegistBtn(); | |
| 153 | + } | |
| 148 | 154 | QMUITipDialogUtil.dismessDialog(); |
| 149 | 155 | QMUITipDialogUtil.messageDialog(getContext(), addMonitoredPersonResponse.getMessage(), 2); |
| 150 | 156 | } | ... | ... |
moudle_pedometer/src/main/res/layout/item_my_record.xml
| ... | ... | @@ -80,7 +80,7 @@ |
| 80 | 80 | |
| 81 | 81 | <com.cnlive.moudle.pedometer.ui.widget.FivePersonIconView |
| 82 | 82 | android:id="@+id/join_person" |
| 83 | - android:layout_width="wrap_content" | |
| 83 | + android:layout_width="150dp" | |
| 84 | 84 | android:layout_height="40dp" |
| 85 | 85 | android:layout_marginRight="10dp" |
| 86 | 86 | FivePersonIconView:showRightFlag="false" /> | ... | ... |