Commit 447fd4309fcee93435de4da870d4c4c2f37537ca
1 parent
3765c74e
1.对接运动赛事详情页接口
Showing
11 changed files
with
220 additions
and
61 deletions
library_baidumap/build.gradle
moudle_pedometer/build.gradle
| @@ -110,9 +110,11 @@ dependencies { | @@ -110,9 +110,11 @@ dependencies { | ||
| 110 | implementation project(':library_baidumap') | 110 | implementation project(':library_baidumap') |
| 111 | implementation project(':share') | 111 | implementation project(':share') |
| 112 | implementation project(':lib_network') | 112 | implementation project(':lib_network') |
| 113 | + compile project(path: ':lib_network') | ||
| 113 | 114 | ||
| 114 | } | 115 | } |
| 115 | 116 | ||
| 117 | + | ||
| 116 | configurations { | 118 | configurations { |
| 117 | all*.exclude group: 'com.squareup.okhttp3', module: 'okhttp' | 119 | all*.exclude group: 'com.squareup.okhttp3', module: 'okhttp' |
| 118 | all*.exclude group: 'com.squareup.okio' | 120 | all*.exclude group: 'com.squareup.okio' |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/RunRaceDetailFragmentPresenter.java
| 1 | package com.cnlive.moudle.pedometer.frame.presenter; | 1 | package com.cnlive.moudle.pedometer.frame.presenter; |
| 2 | 2 | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | +import android.view.View; | ||
| 5 | +import android.widget.Toast; | ||
| 4 | 6 | ||
| 7 | +import com.cnlive.libs.base.logic.Config; | ||
| 5 | import com.cnlive.libs.base.logic.Logic; | 8 | import com.cnlive.libs.base.logic.Logic; |
| 9 | +import com.cnlive.libs.base.logic.callback.DataCallback; | ||
| 6 | import com.cnlive.libs.base.logic.callback.FailureCallback; | 10 | import com.cnlive.libs.base.logic.callback.FailureCallback; |
| 11 | +import com.cnlive.libs.base.logic.callback.StateCallback; | ||
| 12 | +import com.cnlive.libs.base.logic.callback.SuccessCallback; | ||
| 7 | import com.cnlive.libs.data.network.model.IBaseInfo; | 13 | import com.cnlive.libs.data.network.model.IBaseInfo; |
| 8 | import com.cnlive.moudle.pedometer.frame.view.RunRaceDetailFragmentView; | 14 | import com.cnlive.moudle.pedometer.frame.view.RunRaceDetailFragmentView; |
| 9 | import com.cnlive.moudle.pedometer.frame.view.RunningMapFragmentView; | 15 | import com.cnlive.moudle.pedometer.frame.view.RunningMapFragmentView; |
| 16 | +import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil; | ||
| 17 | +import com.cnlive.strike.data.network.api.ApiRequest; | ||
| 18 | +import com.cnlive.strike.data.network.api.ApiServiceDaren; | ||
| 19 | +import com.cnlive.strike.data.network.model.BaseInfo; | ||
| 20 | +import com.cnlive.strike.data.network.model.runAbout.RunRaceDetailInfo; | ||
| 10 | import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; | 21 | import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; |
| 11 | 22 | ||
| 12 | import java.util.HashMap; | 23 | import java.util.HashMap; |
| @@ -14,6 +25,9 @@ import java.util.Map; | @@ -14,6 +25,9 @@ import java.util.Map; | ||
| 14 | 25 | ||
| 15 | import io.reactivex.disposables.Disposable; | 26 | import io.reactivex.disposables.Disposable; |
| 16 | 27 | ||
| 28 | +import static com.cnlive.libs.base.logic.Config.STATE_IDLE; | ||
| 29 | +import static com.cnlive.libs.base.logic.Config.STATE_LOAD; | ||
| 30 | + | ||
| 17 | public class RunRaceDetailFragmentPresenter extends MvpBasePresenter<RunRaceDetailFragmentView> { | 31 | public class RunRaceDetailFragmentPresenter extends MvpBasePresenter<RunRaceDetailFragmentView> { |
| 18 | 32 | ||
| 19 | public void getRunRaceDetailInfo(Context context, String id, String userId) { | 33 | public void getRunRaceDetailInfo(Context context, String id, String userId) { |
| @@ -21,41 +35,87 @@ public class RunRaceDetailFragmentPresenter extends MvpBasePresenter<RunRaceDeta | @@ -21,41 +35,87 @@ public class RunRaceDetailFragmentPresenter extends MvpBasePresenter<RunRaceDeta | ||
| 21 | Map<String, String> paramsMap = new HashMap<>(); | 35 | Map<String, String> paramsMap = new HashMap<>(); |
| 22 | //赛事id | 36 | //赛事id |
| 23 | paramsMap.put("id", id); | 37 | paramsMap.put("id", id); |
| 24 | - paramsMap.put("userId", userId); | 38 | + paramsMap.put("sid", userId); |
| 25 | 39 | ||
| 26 | // Logic.create(paramsMap) | 40 | // Logic.create(paramsMap) |
| 27 | -// .action(new Logic.Action<Map<String, String>, BaseInfo>() { | 41 | +// .action(new Logic.Action<Map<String, String>, BaseInfo<RunRaceDetailInfo>>() { |
| 28 | // @Override | 42 | // @Override |
| 29 | -// public Disposable action(Map<String, String> paramsMap, DataCallback<SubscriptionBaseInfo> dataCallback) { | ||
| 30 | -// return SubscriptionRequest.service(ApiServiceInterest.class, api -> api.userFollowAddGroup(paramsMap)).subscribe(context, dataCallback); | 43 | +// public Disposable action(Map<String, String> paramsMap, DataCallback<BaseInfo<RunRaceDetailInfo>> dataCallback) { |
| 44 | +// return ApiRequest.service(ApiServiceDaren.class, api -> api.getRunRaceDetail(paramsMap)).subscribe(context, dataCallback); | ||
| 31 | // } | 45 | // } |
| 32 | -// }).<SubscriptionBaseInfo>event() | ||
| 33 | -// .setSuccessCallback(new SuccessCallback<SubscriptionBaseInfo>() { | 46 | +// }).<BaseInfo<RunRaceDetailInfo>>event() |
| 47 | +// .setStateCallback(new StateCallback() { | ||
| 34 | // @Override | 48 | // @Override |
| 35 | -// public void onSuccess(SubscriptionBaseInfo subscriptionBaseInfo) { | ||
| 36 | -// if (getView() != null) { | ||
| 37 | -// getView().hideQmuiDialog(); | 49 | +// public void onState(int i) { |
| 50 | +// if (getView() == null) { | ||
| 51 | +// return; | ||
| 52 | +// } | ||
| 53 | +// if (i == STATE_LOAD) { | ||
| 54 | +// QMUITipDialogUtil.loadingDialog(context, "正在获取赛事详情", false); | ||
| 55 | +// } else if (i == STATE_IDLE) { | ||
| 38 | // } | 56 | // } |
| 39 | -// callBack.onSuccess(); | ||
| 40 | -// } | ||
| 41 | // | 57 | // |
| 58 | +// } | ||
| 42 | // }) | 59 | // }) |
| 43 | -// .setFailureCallback(new FailureCallback() { | 60 | +// .setSuccessCallback(new SuccessCallback<BaseInfo<RunRaceDetailInfo>>() { |
| 44 | // @Override | 61 | // @Override |
| 45 | -// public void onFailure(int i, String s) { | ||
| 46 | -// if (getView() != null) { | ||
| 47 | -// getView().hideQmuiDialog(); | ||
| 48 | -// getView().showFailDailog("网络请求失败,请稍后重试", 2); | ||
| 49 | -// if (!TextUtils.isEmpty(s)) { | ||
| 50 | -// callBack.onFailed(s); | ||
| 51 | -// } else { | ||
| 52 | -// callBack.onFailed("接口请求失败,请重试!"); | ||
| 53 | -// } | 62 | +// public void onSuccess(BaseInfo<RunRaceDetailInfo> runRaceDetailInfoBaseInfo) { |
| 63 | +// if (getView() == null) { | ||
| 64 | +// return; | ||
| 54 | // } | 65 | // } |
| 55 | // } | 66 | // } |
| 56 | -// }) | ||
| 57 | -// | ||
| 58 | -// .start(); | 67 | +// }).setFailureCallback(new FailureCallback() { |
| 68 | +// @Override | ||
| 69 | +// public void onFailure(int i, String s) { | ||
| 70 | +// if (getView() == null) { | ||
| 71 | +// return; | ||
| 72 | +// } | ||
| 73 | +// } | ||
| 74 | +// }).start(); | ||
| 75 | + Logic.create(paramsMap).action(new Logic.Action<Map<String, String>, BaseInfo<RunRaceDetailInfo>>() { | ||
| 76 | + @Override | ||
| 77 | + public Disposable action(Map<String, String> stringStringMap, DataCallback<BaseInfo<RunRaceDetailInfo>> dataCallback) { | ||
| 78 | + return ApiRequest.observable(ApiServiceDaren.class, api -> api.getRunRaceDetail(stringStringMap)).subscribe(context, dataCallback); | ||
| 79 | + } | ||
| 80 | + }).<BaseInfo<RunRaceDetailInfo>>event() | ||
| 81 | + .setStateCallback(new StateCallback() { | ||
| 82 | + @Override | ||
| 83 | + public void onState(int i) { | ||
| 84 | + if (getView() == null) { | ||
| 85 | + return; | ||
| 86 | + } | ||
| 87 | + if (i == STATE_LOAD) { | ||
| 88 | + getView().showLoadingView(); | ||
| 89 | + } else if (i == STATE_IDLE) { | ||
| 90 | + getView().hideLoadingView(); | ||
| 91 | + } | ||
| 92 | + } | ||
| 93 | + }) | ||
| 94 | + .setFailureCallback(new FailureCallback() { | ||
| 95 | + @Override | ||
| 96 | + public void onFailure(int code, String message) { | ||
| 97 | + if (getView() == null) { | ||
| 98 | + return; | ||
| 99 | + } | ||
| 100 | + getView().hideLoadingView(); | ||
| 101 | + getView().showRetryView(code, new View.OnClickListener() { | ||
| 102 | + @Override | ||
| 103 | + public void onClick(View view) { | ||
| 104 | + getRunRaceDetailInfo(context, id, userId); | ||
| 105 | + } | ||
| 106 | + }); | ||
| 107 | + } | ||
| 108 | + }).setSuccessCallback(new SuccessCallback<BaseInfo<RunRaceDetailInfo>>() { | ||
| 109 | + @Override | ||
| 110 | + public void onSuccess(BaseInfo<RunRaceDetailInfo> baseInfo) { | ||
| 111 | + if (getView() == null) { | ||
| 112 | + return; | ||
| 113 | + } | ||
| 114 | + if (baseInfo.getData() != null) { | ||
| 115 | + getView().initView(baseInfo.getData()); | ||
| 116 | + } | ||
| 117 | + } | ||
| 118 | + }).start(); | ||
| 59 | 119 | ||
| 60 | } | 120 | } |
| 61 | } | 121 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunRaceDetailFragmentView.java
| @@ -9,6 +9,7 @@ import android.hardware.Sensor; | @@ -9,6 +9,7 @@ import android.hardware.Sensor; | ||
| 9 | import android.hardware.SensorEvent; | 9 | import android.hardware.SensorEvent; |
| 10 | import android.hardware.SensorEventListener; | 10 | import android.hardware.SensorEventListener; |
| 11 | import android.hardware.SensorManager; | 11 | import android.hardware.SensorManager; |
| 12 | +import android.text.TextUtils; | ||
| 12 | import android.util.Log; | 13 | import android.util.Log; |
| 13 | import android.view.LayoutInflater; | 14 | import android.view.LayoutInflater; |
| 14 | import android.view.View; | 15 | import android.view.View; |
| @@ -63,6 +64,7 @@ import com.cnlive.moudle.pedometer.utils.BitmapUtil; | @@ -63,6 +64,7 @@ import com.cnlive.moudle.pedometer.utils.BitmapUtil; | ||
| 63 | import com.cnlive.moudle.pedometer.utils.GsonUtil; | 64 | import com.cnlive.moudle.pedometer.utils.GsonUtil; |
| 64 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; | 65 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; |
| 65 | import com.cnlive.moudle.pedometer.utils.ScreenUtil; | 66 | import com.cnlive.moudle.pedometer.utils.ScreenUtil; |
| 67 | +import com.cnlive.strike.data.network.model.runAbout.RunRaceDetailInfo; | ||
| 66 | import com.example.moudle_pedometer.R; | 68 | import com.example.moudle_pedometer.R; |
| 67 | import com.hannesdorfmann.mosby3.mvp.MvpView; | 69 | import com.hannesdorfmann.mosby3.mvp.MvpView; |
| 68 | import com.sothree.slidinguppanel.SlidingUpPanelLayout; | 70 | import com.sothree.slidinguppanel.SlidingUpPanelLayout; |
| @@ -110,6 +112,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -110,6 +112,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 110 | private LinkedList<LatLng> importLatLngs;//关键点 | 112 | private LinkedList<LatLng> importLatLngs;//关键点 |
| 111 | private LatLng startLatLng = new LatLng(39.934733, 116.308646);//起始点 | 113 | private LatLng startLatLng = new LatLng(39.934733, 116.308646);//起始点 |
| 112 | private List<LatLng> trackPoints; | 114 | private List<LatLng> trackPoints; |
| 115 | + private RunRaceDetailInfo runRaceDetailInfo; | ||
| 113 | 116 | ||
| 114 | public RunRaceDetailFragmentView(RunRaceDetailFragment fragment) { | 117 | public RunRaceDetailFragmentView(RunRaceDetailFragment fragment) { |
| 115 | this.fragment = fragment; | 118 | this.fragment = fragment; |
| @@ -119,19 +122,25 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -119,19 +122,25 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 119 | return fragment == null ? null : fragment.getActivity(); | 122 | return fragment == null ? null : fragment.getActivity(); |
| 120 | } | 123 | } |
| 121 | 124 | ||
| 122 | - public void initView() { | 125 | + |
| 126 | + public void initView(RunRaceDetailInfo runRaceDetailInfo) { | ||
| 123 | if (fragment.getActivity() == null) { | 127 | if (fragment.getActivity() == null) { |
| 124 | return; | 128 | return; |
| 125 | } | 129 | } |
| 126 | - //初始化运营人员所选的关键点 | ||
| 127 | - trackPoints = GsonUtil.jsonToList(test, LatLng.class); | ||
| 128 | - initMap(); | ||
| 129 | - MyMapUtil.drawServerLineTrack(getContext(), baiduMap, trackPoints, SortType.asc, R.color.green_round, R.drawable.icon_start, R.drawable.icon_end); | 130 | + this.runRaceDetailInfo = runRaceDetailInfo; |
| 131 | +// //初始化运营人员所选的关键点 | ||
| 132 | +// trackPoints = GsonUtil.jsonToList(test, LatLng.class); | ||
| 133 | +// MyMapUtil.drawServerLineTrack(getContext(), baiduMap, trackPoints, SortType.asc, R.color.green_round, R.drawable.icon_start, R.drawable.icon_end); | ||
| 134 | + //显示地图 | ||
| 135 | + fragment.binding.mapView.setVisibility(View.VISIBLE); | ||
| 136 | + //隐藏底部滑动卡片 | ||
| 137 | + fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED); | ||
| 138 | + //隐藏空视图 | ||
| 139 | + fragment.binding.emptyLayout.setVisibility(View.GONE); | ||
| 140 | + //显示立即报名按钮 | ||
| 141 | + fragment.binding.includeStreet.rlStartBtn.setVisibility(View.VISIBLE); | ||
| 130 | //设置底部卡片第一次可滑动的位置 | 142 | //设置底部卡片第一次可滑动的位置 |
| 131 | fragment.binding.slidingLayout.setAnchorPoint(0.6f); | 143 | fragment.binding.slidingLayout.setAnchorPoint(0.6f); |
| 132 | - //设置底部卡片初始位置 | ||
| 133 | -// fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(fragment.getActivity(), 140)); | ||
| 134 | - fragment.binding.includeStreet.rlStartBtn.setVisibility(View.VISIBLE); | ||
| 135 | fragment.binding.slidingLayout.addPanelSlideListener(new SlidingUpPanelLayout.PanelSlideListener() { | 144 | fragment.binding.slidingLayout.addPanelSlideListener(new SlidingUpPanelLayout.PanelSlideListener() { |
| 136 | @Override | 145 | @Override |
| 137 | public void onPanelSlide(View panel, float slideOffset) { | 146 | public void onPanelSlide(View panel, float slideOffset) { |
| @@ -176,6 +185,33 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -176,6 +185,33 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 176 | public void onPanelStateChanged(View panel, SlidingUpPanelLayout.PanelState previousState, SlidingUpPanelLayout.PanelState newState) { | 185 | public void onPanelStateChanged(View panel, SlidingUpPanelLayout.PanelState previousState, SlidingUpPanelLayout.PanelState newState) { |
| 177 | } | 186 | } |
| 178 | }); | 187 | }); |
| 188 | + /*************************设置相关页面数据***************************/ | ||
| 189 | + //设置标题 | ||
| 190 | + if (!TextUtils.isEmpty(runRaceDetailInfo.getTitle())) { | ||
| 191 | + fragment.binding.includeStreet.tvRaceTitle.setText(runRaceDetailInfo.getTitle()); | ||
| 192 | + } | ||
| 193 | + //设置活动地点 | ||
| 194 | + if (!TextUtils.isEmpty(runRaceDetailInfo.getAddress())) { | ||
| 195 | + fragment.binding.includeStreet.tvAddress.setText(runRaceDetailInfo.getAddress()); | ||
| 196 | + } | ||
| 197 | + //设置活动距离 | ||
| 198 | + if (!TextUtils.isEmpty(runRaceDetailInfo.getMileage())) { | ||
| 199 | + fragment.binding.includeStreet.tvMileage.setText(runRaceDetailInfo.getMileage()); | ||
| 200 | + } | ||
| 201 | + //设置起点 | ||
| 202 | + if (!TextUtils.isEmpty(runRaceDetailInfo.getStartLocation())) { | ||
| 203 | + fragment.binding.includeStreet.tvStartAddr.setText(runRaceDetailInfo.getStartLocation()); | ||
| 204 | + } | ||
| 205 | + //设置终点 | ||
| 206 | + if (!TextUtils.isEmpty(runRaceDetailInfo.getEndLocation())) { | ||
| 207 | + fragment.binding.includeStreet.tvEndAddr.setText(runRaceDetailInfo.getEndLocation()); | ||
| 208 | + } | ||
| 209 | + //设置起始报名时间 | ||
| 210 | + if (!TextUtils.isEmpty(runRaceDetailInfo.getEndLocation())) { | ||
| 211 | + fragment.binding.includeStreet.tvEndAddr.setText(runRaceDetailInfo.getEndLocation()); | ||
| 212 | + } | ||
| 213 | + | ||
| 214 | + //设置 | ||
| 179 | //开始按钮点击事件(未滑动) | 215 | //开始按钮点击事件(未滑动) |
| 180 | fragment.binding.includeStreet.rlStartBtn.setOnClickListener(new View.OnClickListener() { | 216 | fragment.binding.includeStreet.rlStartBtn.setOnClickListener(new View.OnClickListener() { |
| 181 | @Override | 217 | @Override |
| @@ -272,14 +308,15 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -272,14 +308,15 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 272 | }); | 308 | }); |
| 273 | } | 309 | } |
| 274 | 310 | ||
| 275 | - private void initMap() { | 311 | + public void initMap() { |
| 276 | List<String> icons = new ArrayList<>(); | 312 | List<String> icons = new ArrayList<>(); |
| 277 | icons.add("http://yweb0.cnliveimg.com/images/headImg/2019/0505/1557039035723_small.jpg"); | 313 | icons.add("http://yweb0.cnliveimg.com/images/headImg/2019/0505/1557039035723_small.jpg"); |
| 278 | icons.add("http://yweb0.cnliveimg.com/images/headImg/2019/0505/1557034319038_small.jpg"); | 314 | icons.add("http://yweb0.cnliveimg.com/images/headImg/2019/0505/1557034319038_small.jpg"); |
| 279 | icons.add("http://yweb0.cnliveimg.com/images/headImg/2018/0902/1535858459612_small.jpg"); | 315 | icons.add("http://yweb0.cnliveimg.com/images/headImg/2018/0902/1535858459612_small.jpg"); |
| 280 | icons.add("http://yweb0.cnliveimg.com/images/headImg/2019/0523/1558599016203_small.jpg"); | 316 | icons.add("http://yweb0.cnliveimg.com/images/headImg/2019/0523/1558599016203_small.jpg"); |
| 281 | icons.add("http://yweb0.cnliveimg.com/images/headImg/2019/0505/1557039035723_small.jpg"); | 317 | icons.add("http://yweb0.cnliveimg.com/images/headImg/2019/0505/1557039035723_small.jpg"); |
| 282 | - | 318 | + //隐藏底部滑动卡片 |
| 319 | + fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN); | ||
| 283 | fragment.binding.includeStreet.fiveJoinPerson.initIconData(icons); | 320 | fragment.binding.includeStreet.fiveJoinPerson.initIconData(icons); |
| 284 | this.mMapView = fragment.binding.mapView; | 321 | this.mMapView = fragment.binding.mapView; |
| 285 | if (baiduMap == null) { | 322 | if (baiduMap == null) { |
| @@ -295,13 +332,6 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -295,13 +332,6 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 295 | mCurrentMode = MyLocationConfiguration.LocationMode.NORMAL; | 332 | mCurrentMode = MyLocationConfiguration.LocationMode.NORMAL; |
| 296 | // 设置定位图标修改为自定义marker | 333 | // 设置定位图标修改为自定义marker |
| 297 | Bitmap pointBitmap = BitmapUtil.getBitmapFromDp(getContext(), BitmapFactory.decodeResource(getContext().getResources(), R.drawable.rt_ic_location), 50, 50); | 334 | Bitmap pointBitmap = BitmapUtil.getBitmapFromDp(getContext(), BitmapFactory.decodeResource(getContext().getResources(), R.drawable.rt_ic_location), 50, 50); |
| 298 | -// View view = LayoutInflater.from(getContext()).inflate(R.layout.layout_anim, null); | ||
| 299 | -// ImageView image = (ImageView) view.findViewById(R.id.iv_anim); | ||
| 300 | -//// image.setBackgroundResource(R.drawable.fat_po); | ||
| 301 | -// image.setImageResource(R.drawable.fat_po); | ||
| 302 | -// AnimationDrawable anim = (AnimationDrawable) image.getDrawable(); | ||
| 303 | -// anim.start(); | ||
| 304 | -// BitmapDescriptorFactory.fromView(view); | ||
| 305 | mCurrentMarker = BitmapDescriptorFactory.fromBitmap(pointBitmap); | 335 | mCurrentMarker = BitmapDescriptorFactory.fromBitmap(pointBitmap); |
| 306 | //设置定位蓝点精度圆圈的填充颜色为透明色 | 336 | //设置定位蓝点精度圆圈的填充颜色为透明色 |
| 307 | accuracyCircleFillColor = getContext().getResources().getColor(R.color.transparent); | 337 | accuracyCircleFillColor = getContext().getResources().getColor(R.color.transparent); |
| @@ -346,11 +376,11 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -346,11 +376,11 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 346 | baiduMap.setOnMapLoadedCallback(new BaiduMap.OnMapLoadedCallback() { | 376 | baiduMap.setOnMapLoadedCallback(new BaiduMap.OnMapLoadedCallback() { |
| 347 | @Override | 377 | @Override |
| 348 | public void onMapLoaded() { | 378 | public void onMapLoaded() { |
| 349 | - //自动计算地图缩放 | ||
| 350 | - MapStatus.Builder builder = new MapStatus.Builder(); | ||
| 351 | - builder.target(MyMapUtil.getCenterZoomPosition(trackPoints)); | ||
| 352 | - builder.zoom(MyMapUtil.getZoom(trackPoints)); | ||
| 353 | - baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build())); | 379 | +// //自动计算地图缩放 |
| 380 | +// MapStatus.Builder builder = new MapStatus.Builder(); | ||
| 381 | +// builder.target(MyMapUtil.getCenterZoomPosition(trackPoints)); | ||
| 382 | +// builder.zoom(MyMapUtil.getZoom(trackPoints)); | ||
| 383 | +// baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build())); | ||
| 354 | 384 | ||
| 355 | } | 385 | } |
| 356 | }); | 386 | }); |
| @@ -689,4 +719,54 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -689,4 +719,54 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 689 | // } | 719 | // } |
| 690 | } | 720 | } |
| 691 | } | 721 | } |
| 722 | + | ||
| 723 | + /** | ||
| 724 | + * 显示loading | ||
| 725 | + */ | ||
| 726 | + public void showLoadingView() { | ||
| 727 | + if (fragment.binding.emptyLayout == null) { | ||
| 728 | + return; | ||
| 729 | + } | ||
| 730 | + fragment.binding.emptyLayout.show(true); | ||
| 731 | + } | ||
| 732 | + | ||
| 733 | + /** | ||
| 734 | + * 隐藏loading | ||
| 735 | + */ | ||
| 736 | + public void hideLoadingView() { | ||
| 737 | + if (fragment.binding.emptyLayout == null) { | ||
| 738 | + return; | ||
| 739 | + } | ||
| 740 | + fragment.binding.emptyLayout.hide(); | ||
| 741 | + } | ||
| 742 | + | ||
| 743 | + /** | ||
| 744 | + * 显示重试页面 | ||
| 745 | + * | ||
| 746 | + * @param errorCode | ||
| 747 | + * @param listener | ||
| 748 | + */ | ||
| 749 | + public void showRetryView(int errorCode, View.OnClickListener listener) { | ||
| 750 | + if (getContext() == null) { | ||
| 751 | + return; | ||
| 752 | + } | ||
| 753 | + //隐藏地图 | ||
| 754 | + fragment.binding.mapView.setVisibility(View.GONE); | ||
| 755 | + //显示空视图 | ||
| 756 | + fragment.binding.emptyLayout.setVisibility(View.VISIBLE); | ||
| 757 | + //隐藏底部卡片 | ||
| 758 | + fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN); | ||
| 759 | + if (fragment.binding.emptyLayout == null) return; | ||
| 760 | + String titleText = ""; | ||
| 761 | + String detailText = ""; | ||
| 762 | + if (errorCode == -3) { | ||
| 763 | + titleText = getContext().getString(R.string.msg_failed_network_title); | ||
| 764 | + detailText = getContext().getString(R.string.msg_failed_network_detail); | ||
| 765 | + } else { | ||
| 766 | + titleText = getContext().getString(R.string.msg_failed_other_title); | ||
| 767 | + detailText = getContext().getString(R.string.msg_failed_other_detail); | ||
| 768 | + } | ||
| 769 | + fragment.binding.emptyLayout.show(false, titleText, detailText, getContext().getString(R.string.retry), R.drawable.wufalianjie, listener); | ||
| 770 | + } | ||
| 771 | + | ||
| 692 | } | 772 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RaceRecorFragment.java
| @@ -14,7 +14,7 @@ import com.example.moudle_pedometer.databinding.FragmentRaceRecorBinding; | @@ -14,7 +14,7 @@ import com.example.moudle_pedometer.databinding.FragmentRaceRecorBinding; | ||
| 14 | /** | 14 | /** |
| 15 | * Created by hanyayun 019/05/30. | 15 | * Created by hanyayun 019/05/30. |
| 16 | */ | 16 | */ |
| 17 | -public class RaceRecorFragment extends MvpBindingFragment<RaceRecorView, RaceRecorPresenter,Object, FragmentRaceRecorBinding> { | 17 | +public class RaceRecorFragment extends MvpBindingFragment<RaceRecorView, RaceRecorPresenter, Object, FragmentRaceRecorBinding> { |
| 18 | 18 | ||
| 19 | 19 | ||
| 20 | public RaceRecorFragment() { | 20 | public RaceRecorFragment() { |
| @@ -25,8 +25,7 @@ public class RaceRecorFragment extends MvpBindingFragment<RaceRecorView, RaceRec | @@ -25,8 +25,7 @@ public class RaceRecorFragment extends MvpBindingFragment<RaceRecorView, RaceRec | ||
| 25 | @Override | 25 | @Override |
| 26 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | 26 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 27 | super.onViewCreated(view, savedInstanceState); | 27 | super.onViewCreated(view, savedInstanceState); |
| 28 | - if(getMvpView() != null) getMvpView().initView(); | ||
| 29 | - getPresenter().getData(); | 28 | + if (getMvpView() != null) getMvpView().initView(); |
| 30 | } | 29 | } |
| 31 | 30 | ||
| 32 | @Override | 31 | @Override |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RunRaceDetailFragment.java
| @@ -61,7 +61,10 @@ public class RunRaceDetailFragment extends QMUIFragment<RunRaceDetailFragmentVie | @@ -61,7 +61,10 @@ public class RunRaceDetailFragment extends QMUIFragment<RunRaceDetailFragmentVie | ||
| 61 | 61 | ||
| 62 | mSensorManager = (SensorManager) getActivity().getSystemService(SENSOR_SERVICE);//获取传感器管理服务 | 62 | mSensorManager = (SensorManager) getActivity().getSystemService(SENSOR_SERVICE);//获取传感器管理服务 |
| 63 | if (getMvpView() != null) { | 63 | if (getMvpView() != null) { |
| 64 | - getMvpView().initView(); | 64 | + getMvpView().initMap();; |
| 65 | + } | ||
| 66 | + if (getPresenter()!=null){ | ||
| 67 | + getPresenter().getRunRaceDetailInfo(getActivity(),"116","10513196"); | ||
| 65 | } | 68 | } |
| 66 | 69 | ||
| 67 | } | 70 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/QMUITipDialogUtil.java
| @@ -141,7 +141,9 @@ public class QMUITipDialogUtil { | @@ -141,7 +141,9 @@ public class QMUITipDialogUtil { | ||
| 141 | 141 | ||
| 142 | public static void dismessDialog() { | 142 | public static void dismessDialog() { |
| 143 | if (tipDialog != null) { | 143 | if (tipDialog != null) { |
| 144 | - tipDialog.dismiss(); | 144 | + if (tipDialog.isShowing()) { |
| 145 | + tipDialog.dismiss(); | ||
| 146 | + } | ||
| 145 | } | 147 | } |
| 146 | } | 148 | } |
| 147 | } | 149 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/TimeUtil.java
moudle_pedometer/src/main/res/layout/fragment_run_race_detail.xml
| @@ -17,6 +17,7 @@ | @@ -17,6 +17,7 @@ | ||
| 17 | 17 | ||
| 18 | <!-- MAIN CONTENT --> | 18 | <!-- MAIN CONTENT --> |
| 19 | <FrameLayout | 19 | <FrameLayout |
| 20 | + android:id="@+id/fl_root" | ||
| 20 | android:layout_width="match_parent" | 21 | android:layout_width="match_parent" |
| 21 | android:layout_height="match_parent"> | 22 | android:layout_height="match_parent"> |
| 22 | 23 | ||
| @@ -50,7 +51,14 @@ | @@ -50,7 +51,14 @@ | ||
| 50 | android:layout_margin="10dp" | 51 | android:layout_margin="10dp" |
| 51 | android:background="@drawable/xqt_share" /> | 52 | android:background="@drawable/xqt_share" /> |
| 52 | <!----> | 53 | <!----> |
| 53 | - | 54 | + <com.cnlive.strike.ui.widget.UIEmptyView |
| 55 | + android:id="@+id/empty_layout" | ||
| 56 | + android:layout_width="match_parent" | ||
| 57 | + android:layout_height="match_parent" | ||
| 58 | + android:focusable="true" | ||
| 59 | + android:focusableInTouchMode="true" | ||
| 60 | + android:background="@color/color_fff" | ||
| 61 | + android:visibility="gone" /> | ||
| 54 | 62 | ||
| 55 | </FrameLayout> | 63 | </FrameLayout> |
| 56 | 64 |
moudle_pedometer/src/main/res/layout/layout_run_detail_street.xml
| @@ -66,15 +66,9 @@ | @@ -66,15 +66,9 @@ | ||
| 66 | android:layout_marginTop="10dp" | 66 | android:layout_marginTop="10dp" |
| 67 | android:layout_marginBottom="10dp"> | 67 | android:layout_marginBottom="10dp"> |
| 68 | 68 | ||
| 69 | - <TextView | ||
| 70 | - android:layout_width="wrap_content" | ||
| 71 | - android:layout_height="wrap_content" | ||
| 72 | - android:layout_marginLeft="25dp" | ||
| 73 | - android:text="北京" | ||
| 74 | - android:textColor="@color/text_black" | ||
| 75 | - android:textSize="15sp" /> | ||
| 76 | 69 | ||
| 77 | <TextView | 70 | <TextView |
| 71 | + android:id="@+id/tv_address" | ||
| 78 | android:layout_width="wrap_content" | 72 | android:layout_width="wrap_content" |
| 79 | android:layout_height="wrap_content" | 73 | android:layout_height="wrap_content" |
| 80 | android:layout_marginLeft="25dp" | 74 | android:layout_marginLeft="25dp" |
| @@ -83,6 +77,7 @@ | @@ -83,6 +77,7 @@ | ||
| 83 | android:textSize="15sp" /> | 77 | android:textSize="15sp" /> |
| 84 | 78 | ||
| 85 | <TextView | 79 | <TextView |
| 80 | + android:id="@+id/tv_mileage" | ||
| 86 | android:layout_width="wrap_content" | 81 | android:layout_width="wrap_content" |
| 87 | android:layout_height="wrap_content" | 82 | android:layout_height="wrap_content" |
| 88 | android:layout_marginLeft="25dp" | 83 | android:layout_marginLeft="25dp" |
| @@ -154,6 +149,7 @@ | @@ -154,6 +149,7 @@ | ||
| 154 | android:textSize="14sp" /> | 149 | android:textSize="14sp" /> |
| 155 | 150 | ||
| 156 | <TextView | 151 | <TextView |
| 152 | + android:id="@+id/tv_start_addr" | ||
| 157 | android:layout_width="wrap_content" | 153 | android:layout_width="wrap_content" |
| 158 | android:layout_height="wrap_content" | 154 | android:layout_height="wrap_content" |
| 159 | android:layout_marginLeft="10dp" | 155 | android:layout_marginLeft="10dp" |
| @@ -185,6 +181,7 @@ | @@ -185,6 +181,7 @@ | ||
| 185 | android:textSize="14sp" /> | 181 | android:textSize="14sp" /> |
| 186 | 182 | ||
| 187 | <TextView | 183 | <TextView |
| 184 | + android:id="@+id/tv_end_addr" | ||
| 188 | android:layout_width="wrap_content" | 185 | android:layout_width="wrap_content" |
| 189 | android:layout_height="wrap_content" | 186 | android:layout_height="wrap_content" |
| 190 | android:layout_marginLeft="10dp" | 187 | android:layout_marginLeft="10dp" |
| @@ -223,6 +220,7 @@ | @@ -223,6 +220,7 @@ | ||
| 223 | android:layout_marginTop="10dp"> | 220 | android:layout_marginTop="10dp"> |
| 224 | 221 | ||
| 225 | <TextView | 222 | <TextView |
| 223 | + android:id="@+id/tv_sign_up_start_time" | ||
| 226 | android:layout_width="wrap_content" | 224 | android:layout_width="wrap_content" |
| 227 | android:layout_height="wrap_content" | 225 | android:layout_height="wrap_content" |
| 228 | android:layout_marginLeft="25dp" | 226 | android:layout_marginLeft="25dp" |
| @@ -239,6 +237,7 @@ | @@ -239,6 +237,7 @@ | ||
| 239 | android:textSize="15sp" /> | 237 | android:textSize="15sp" /> |
| 240 | 238 | ||
| 241 | <TextView | 239 | <TextView |
| 240 | + android:id="@+id/tv_sign_up_end_time" | ||
| 242 | android:layout_width="wrap_content" | 241 | android:layout_width="wrap_content" |
| 243 | android:layout_height="wrap_content" | 242 | android:layout_height="wrap_content" |
| 244 | android:layout_marginLeft="5dp" | 243 | android:layout_marginLeft="5dp" |
| @@ -348,8 +347,8 @@ | @@ -348,8 +347,8 @@ | ||
| 348 | android:layout_marginLeft="25dp" | 347 | android:layout_marginLeft="25dp" |
| 349 | android:text="徒步" | 348 | android:text="徒步" |
| 350 | android:textColor="@color/text_black" | 349 | android:textColor="@color/text_black" |
| 351 | - android:textStyle="bold" | ||
| 352 | - android:textSize="15sp" /> | 350 | + android:textSize="15sp" |
| 351 | + android:textStyle="bold" /> | ||
| 353 | 352 | ||
| 354 | </LinearLayout> | 353 | </LinearLayout> |
| 355 | <!--参与人数--> | 354 | <!--参与人数--> |
moudle_pedometer/src/main/res/values/strings.xml
| @@ -70,4 +70,8 @@ | @@ -70,4 +70,8 @@ | ||
| 70 | <string name="layout_street_active_type">活动类型</string> | 70 | <string name="layout_street_active_type">活动类型</string> |
| 71 | <string name="open_gps_tip">您尚未开启GPS,为确保定位准确性,请您打开后使用!</string> | 71 | <string name="open_gps_tip">您尚未开启GPS,为确保定位准确性,请您打开后使用!</string> |
| 72 | <!----> | 72 | <!----> |
| 73 | + <!--网络请求--> | ||
| 74 | + <string name="retry">重试</string> | ||
| 75 | + | ||
| 76 | + | ||
| 73 | </resources> | 77 | </resources> |