Commit 1fdb33d4777ff5c1f8abba5250f3f34a932e0a15
1 parent
2d5de40a
1 赛事详情页新增路线地图点击事件
Showing
9 changed files
with
83 additions
and
29 deletions
config.gradle
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/presenter/CollRunRaceDetailFragmentPresenter.java
| ... | ... | @@ -2,6 +2,7 @@ package com.cnlive.moudle.collectionTrace.frame.presenter; |
| 2 | 2 | |
| 3 | 3 | import android.content.Context; |
| 4 | 4 | import android.view.View; |
| 5 | +import android.view.ViewGroup; | |
| 5 | 6 | |
| 6 | 7 | import com.cnlive.libs.base.logic.Logic; |
| 7 | 8 | import com.cnlive.libs.base.logic.callback.DataCallback; |
| ... | ... | @@ -26,6 +27,18 @@ import static com.cnlive.libs.base.logic.Config.STATE_LOAD; |
| 26 | 27 | public class CollRunRaceDetailFragmentPresenter extends MvpBasePresenter<CollRunRaceDetailFragmentView> { |
| 27 | 28 | |
| 28 | 29 | public void getRunRaceDetailInfo(Context context, String id, String userId, String state) { |
| 30 | + if (null != getView()) { | |
| 31 | + try { | |
| 32 | + if (null != getView().webView) { | |
| 33 | + if (getView().webView.getParent() != null) { | |
| 34 | + ((ViewGroup) getView().webView.getParent()).removeView(getView().webView); | |
| 35 | + } | |
| 36 | + getView().webView.destroy(); | |
| 37 | + getView().webView = null; | |
| 38 | + } | |
| 39 | + } catch (Exception e) { | |
| 40 | + } | |
| 41 | + } | |
| 29 | 42 | //设置请求参数 |
| 30 | 43 | Map<String, String> paramsMap = new HashMap<>(); |
| 31 | 44 | //赛事id | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollRunRaceDetailFragmentView.java
| ... | ... | @@ -146,11 +146,12 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen |
| 146 | 146 | if (null == mClient) { |
| 147 | 147 | mClient = new LBSTraceClient(getContext()); |
| 148 | 148 | } |
| 149 | + | |
| 149 | 150 | if (null != runRaceDetailInfo) { |
| 150 | 151 | if (null != runRaceDetailInfo.getNewDescription() && !TextUtils.isEmpty(runRaceDetailInfo.getNewDescription())) { |
| 151 | 152 | initWebView(runRaceDetailInfo.getNewDescription()); |
| 152 | 153 | } else if (null != runRaceDetailInfo.getDescription() && !TextUtils.isEmpty(runRaceDetailInfo.getDescription())) { |
| 153 | - initWebView(runRaceDetailInfo.getDescription()); | |
| 154 | + initWebView(runRaceDetailInfo.getDescription().replaceAll("\n","<br>")); | |
| 154 | 155 | } |
| 155 | 156 | } |
| 156 | 157 | CollCommonInfo.setUserId(getContext(), uid); |
| ... | ... | @@ -343,7 +344,19 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen |
| 343 | 344 | if (!TextUtils.isEmpty(runRaceDetailInfo.getRoadmap())) { |
| 344 | 345 | //设置路线图 |
| 345 | 346 | GlideApp.with(getContext()).load(runRaceDetailInfo.getRoadmap()).into(fragment.binding.includeStreetIntroduce.ivRoadMao); |
| 347 | + //路线图片设置点击事件 | |
| 348 | + fragment.binding.includeStreetIntroduce.ivRoadMao.setOnClickListener(new View.OnClickListener() { | |
| 349 | + @Override | |
| 350 | + public void onClick(View view) { | |
| 351 | + ArrayList<String> imgs = new ArrayList<>(); | |
| 352 | + imgs.add(runRaceDetailInfo.getRoadmap()); | |
| 353 | + if (null != imgs && imgs.size() > 0) { | |
| 354 | + WebViewUtil.previewImg(fragment.getActivity(), runRaceDetailInfo.getRoadmap(), imgs); | |
| 355 | + | |
| 356 | + } | |
| 346 | 357 | |
| 358 | + } | |
| 359 | + }); | |
| 347 | 360 | } |
| 348 | 361 | //设置路线介绍 |
| 349 | 362 | // if (!TextUtils.isEmpty(runRaceDetailInfo.getDescription())) { | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/fragment/CollRunRaceDetailFragment.java
| ... | ... | @@ -198,18 +198,6 @@ public class CollRunRaceDetailFragment extends QMUIFragment<CollRunRaceDetailFra |
| 198 | 198 | if (messageEvent.getMessageType() == Constant.UPDATA_COLL_BIND_TRACE_LIST) { |
| 199 | 199 | if (getMvpView() != null) { |
| 200 | 200 | getMvpView().resetMap(); |
| 201 | - if (null != getMvpView()) { | |
| 202 | - try { | |
| 203 | - if (null != getMvpView().webView) { | |
| 204 | - if (getMvpView().webView.getParent() != null) { | |
| 205 | - ((ViewGroup) getMvpView().webView.getParent()).removeView(getMvpView().webView); | |
| 206 | - } | |
| 207 | - getMvpView().webView.destroy(); | |
| 208 | - getMvpView().webView = null; | |
| 209 | - } | |
| 210 | - } catch (Exception e) { | |
| 211 | - } | |
| 212 | - } | |
| 213 | 201 | getPresenter().getRunRaceDetailInfo(getActivity(), CollCommonInfo.getStreetId(getActivity()), CommonInfo.getUserId(getActivity()), "1"); |
| 214 | 202 | } |
| 215 | 203 | } | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/OnGoingFragmentPresenter.java
| ... | ... | @@ -2,6 +2,7 @@ package com.cnlive.moudle.pedometer.frame.presenter; |
| 2 | 2 | |
| 3 | 3 | import android.content.Context; |
| 4 | 4 | import android.view.View; |
| 5 | +import android.view.ViewGroup; | |
| 5 | 6 | |
| 6 | 7 | import com.cnlive.libs.base.logic.Logic; |
| 7 | 8 | import com.cnlive.libs.base.logic.callback.DataCallback; |
| ... | ... | @@ -25,6 +26,18 @@ import static com.cnlive.libs.base.logic.Config.STATE_LOAD; |
| 25 | 26 | |
| 26 | 27 | public class OnGoingFragmentPresenter extends MvpBasePresenter<OnGoingFragmentView> { |
| 27 | 28 | public void getRunRaceDetailInfo(Context context, String id, String userId, String state) { |
| 29 | + if (null != getView()) { | |
| 30 | + try { | |
| 31 | + if (null != getView().webView) { | |
| 32 | + if (getView().webView.getParent() != null) { | |
| 33 | + ((ViewGroup) getView().webView.getParent()).removeView(getView().webView); | |
| 34 | + } | |
| 35 | + getView().webView.destroy(); | |
| 36 | + getView().webView = null; | |
| 37 | + } | |
| 38 | + } catch (Exception e) { | |
| 39 | + } | |
| 40 | + } | |
| 28 | 41 | //设置请求参数 |
| 29 | 42 | Map<String, String> paramsMap = new HashMap<>(); |
| 30 | 43 | //赛事id | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/RunRaceDetailFragmentPresenter.java
| ... | ... | @@ -2,6 +2,7 @@ package com.cnlive.moudle.pedometer.frame.presenter; |
| 2 | 2 | |
| 3 | 3 | import android.content.Context; |
| 4 | 4 | import android.view.View; |
| 5 | +import android.view.ViewGroup; | |
| 5 | 6 | |
| 6 | 7 | import com.cnlive.libs.base.logic.Logic; |
| 7 | 8 | import com.cnlive.libs.base.logic.callback.DataCallback; |
| ... | ... | @@ -26,6 +27,18 @@ import static com.cnlive.libs.base.logic.Config.STATE_LOAD; |
| 26 | 27 | public class RunRaceDetailFragmentPresenter extends MvpBasePresenter<RunRaceDetailFragmentView> { |
| 27 | 28 | |
| 28 | 29 | public void getRunRaceDetailInfo(Context context, String id, String userId, String state) { |
| 30 | + if (null != getView()) { | |
| 31 | + try { | |
| 32 | + if (null != getView().webView) { | |
| 33 | + if (getView().webView.getParent() != null) { | |
| 34 | + ((ViewGroup) getView().webView.getParent()).removeView(getView().webView); | |
| 35 | + } | |
| 36 | + getView().webView.destroy(); | |
| 37 | + getView().webView = null; | |
| 38 | + } | |
| 39 | + } catch (Exception e) { | |
| 40 | + } | |
| 41 | + } | |
| 29 | 42 | //设置请求参数 |
| 30 | 43 | Map<String, String> paramsMap = new HashMap<>(); |
| 31 | 44 | //赛事id | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/OnGoingFragmentView.java
| ... | ... | @@ -52,6 +52,7 @@ import com.hannesdorfmann.mosby3.mvp.MvpView; |
| 52 | 52 | import com.qmuiteam.qmui.util.QMUIStatusBarHelper; |
| 53 | 53 | import com.sothree.slidinguppanel.SlidingUpPanelLayout; |
| 54 | 54 | |
| 55 | +import java.util.ArrayList; | |
| 55 | 56 | import java.util.List; |
| 56 | 57 | |
| 57 | 58 | public class OnGoingFragmentView implements MvpView { |
| ... | ... | @@ -61,7 +62,7 @@ public class OnGoingFragmentView implements MvpView { |
| 61 | 62 | private UiSettings mUiSettings; |
| 62 | 63 | public RunRaceDetailInfo runRaceDetailInfo; |
| 63 | 64 | private LBSTraceClient mClient = null; |
| 64 | - private WebView webView; | |
| 65 | + public WebView webView; | |
| 65 | 66 | |
| 66 | 67 | public OnGoingFragmentView(OnGoingFragment fragment) { |
| 67 | 68 | this.fragment = fragment; |
| ... | ... | @@ -101,12 +102,13 @@ public class OnGoingFragmentView implements MvpView { |
| 101 | 102 | if (fragment.getActivity() == null) { |
| 102 | 103 | return; |
| 103 | 104 | } |
| 105 | + fragment.binding.flTop.setVisibility(View.VISIBLE); | |
| 104 | 106 | this.runRaceDetailInfo = runRaceDetailInfo; |
| 105 | 107 | if (null != runRaceDetailInfo) { |
| 106 | 108 | if (null != runRaceDetailInfo.getNewDescription() && !TextUtils.isEmpty(runRaceDetailInfo.getNewDescription())) { |
| 107 | 109 | initWebView(runRaceDetailInfo.getNewDescription()); |
| 108 | 110 | } else if (null != runRaceDetailInfo.getDescription() && !TextUtils.isEmpty(runRaceDetailInfo.getDescription())) { |
| 109 | - initWebView(runRaceDetailInfo.getDescription()); | |
| 111 | + initWebView(runRaceDetailInfo.getDescription().replaceAll("\n", "<br>")); | |
| 110 | 112 | } |
| 111 | 113 | } |
| 112 | 114 | //轨迹开始时间 |
| ... | ... | @@ -387,7 +389,18 @@ public class OnGoingFragmentView implements MvpView { |
| 387 | 389 | if (!TextUtils.isEmpty(runRaceDetailInfo.getRoadmap())) { |
| 388 | 390 | //设置路线图 |
| 389 | 391 | GlideApp.with(getContext()).load(runRaceDetailInfo.getRoadmap()).into(fragment.binding.includeStreetIntroduce.ivRoadMao); |
| 392 | + //路线图片设置点击事件 | |
| 393 | + fragment.binding.includeStreetIntroduce.ivRoadMao.setOnClickListener(new View.OnClickListener() { | |
| 394 | + @Override | |
| 395 | + public void onClick(View view) { | |
| 396 | + ArrayList<String> imgs = new ArrayList<>(); | |
| 397 | + imgs.add(runRaceDetailInfo.getRoadmap()); | |
| 398 | + if (null != imgs && imgs.size() > 0) { | |
| 399 | + WebViewUtil.previewImg(fragment.getActivity(), runRaceDetailInfo.getRoadmap(), imgs); | |
| 400 | + } | |
| 390 | 401 | |
| 402 | + } | |
| 403 | + }); | |
| 391 | 404 | } |
| 392 | 405 | |
| 393 | 406 | //开始按钮点击事件(用户进行滑动滑动) | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunRaceDetailFragmentView.java
| ... | ... | @@ -168,11 +168,12 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 168 | 168 | if (fragment.getActivity() == null) { |
| 169 | 169 | return; |
| 170 | 170 | } |
| 171 | + fragment.binding.flTop.setVisibility(View.VISIBLE); | |
| 171 | 172 | if (null != runRaceDetailInfo) { |
| 172 | 173 | if (null != runRaceDetailInfo.getNewDescription() && !TextUtils.isEmpty(runRaceDetailInfo.getNewDescription())) { |
| 173 | 174 | initWebView(runRaceDetailInfo.getNewDescription()); |
| 174 | 175 | } else if (null != runRaceDetailInfo.getDescription() && !TextUtils.isEmpty(runRaceDetailInfo.getDescription())) { |
| 175 | - initWebView(runRaceDetailInfo.getDescription()); | |
| 176 | + initWebView(runRaceDetailInfo.getDescription().replaceAll("\n", "<br>")); | |
| 176 | 177 | } |
| 177 | 178 | } |
| 178 | 179 | queryResultPoints = new ArrayList<>(); |
| ... | ... | @@ -518,8 +519,20 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 518 | 519 | if (!TextUtils.isEmpty(runRaceDetailInfo.getRoadmap())) { |
| 519 | 520 | //设置路线图 |
| 520 | 521 | GlideApp.with(getContext()).load(runRaceDetailInfo.getRoadmap()).into(fragment.binding.includeStreetIntroduce.ivRoadMao); |
| 522 | + //路线图片设置点击事件 | |
| 523 | + fragment.binding.includeStreetIntroduce.ivRoadMao.setOnClickListener(new View.OnClickListener() { | |
| 524 | + @Override | |
| 525 | + public void onClick(View view) { | |
| 526 | + ArrayList<String> imgs = new ArrayList<>(); | |
| 527 | + imgs.add(runRaceDetailInfo.getRoadmap()); | |
| 528 | + if (null != imgs && imgs.size() > 0) { | |
| 529 | + WebViewUtil.previewImg(fragment.getActivity(), runRaceDetailInfo.getRoadmap(), imgs); | |
| 530 | + } | |
| 521 | 531 | |
| 532 | + } | |
| 533 | + }); | |
| 522 | 534 | } |
| 535 | + | |
| 523 | 536 | //判断按钮状态 |
| 524 | 537 | initStartBtnState(runRaceDetailInfo); |
| 525 | 538 | checkStartBtnState(); | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RunRaceDetailFragment.java
| ... | ... | @@ -210,18 +210,6 @@ public class RunRaceDetailFragment extends QMUIFragment<RunRaceDetailFragmentVie |
| 210 | 210 | } |
| 211 | 211 | if (getMvpView() != null && null != getPresenter()) { |
| 212 | 212 | if (!TextUtils.isEmpty(CommonInfo.getStreetId(getActivity()))) { |
| 213 | - if (null != getMvpView()) { | |
| 214 | - try { | |
| 215 | - if (null != getMvpView().webView) { | |
| 216 | - if (getMvpView().webView.getParent() != null) { | |
| 217 | - ((ViewGroup) getMvpView().webView.getParent()).removeView(getMvpView().webView); | |
| 218 | - } | |
| 219 | - getMvpView().webView.destroy(); | |
| 220 | - getMvpView().webView = null; | |
| 221 | - } | |
| 222 | - } catch (Exception e) { | |
| 223 | - } | |
| 224 | - } | |
| 225 | 213 | getPresenter().getRunRaceDetailInfo(getActivity(), CommonInfo.getStreetId(getActivity()), CommonInfo.getUserId(getActivity()), "0"); |
| 226 | 214 | } |
| 227 | 215 | } | ... | ... |