Commit 1fdb33d4777ff5c1f8abba5250f3f34a932e0a15

Authored by 杨帅
1 parent 2d5de40a

1 赛事详情页新增路线地图点击事件

config.gradle
@@ -21,7 +21,7 @@ ext { @@ -21,7 +21,7 @@ ext {
21 //编译方式 21 //编译方式
22 debug : false, 22 debug : false,
23 //版本号 23 //版本号
24 - version: "0.8.2", 24 + version: "0.8.3",
25 //Lib库前缀 25 //Lib库前缀
26 packeg : "com.cnlive.module", 26 packeg : "com.cnlive.module",
27 //Lib库名称 27 //Lib库名称
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,6 +2,7 @@ package com.cnlive.moudle.collectionTrace.frame.presenter;
2 2
3 import android.content.Context; 3 import android.content.Context;
4 import android.view.View; 4 import android.view.View;
  5 +import android.view.ViewGroup;
5 6
6 import com.cnlive.libs.base.logic.Logic; 7 import com.cnlive.libs.base.logic.Logic;
7 import com.cnlive.libs.base.logic.callback.DataCallback; 8 import com.cnlive.libs.base.logic.callback.DataCallback;
@@ -26,6 +27,18 @@ import static com.cnlive.libs.base.logic.Config.STATE_LOAD; @@ -26,6 +27,18 @@ import static com.cnlive.libs.base.logic.Config.STATE_LOAD;
26 public class CollRunRaceDetailFragmentPresenter extends MvpBasePresenter<CollRunRaceDetailFragmentView> { 27 public class CollRunRaceDetailFragmentPresenter extends MvpBasePresenter<CollRunRaceDetailFragmentView> {
27 28
28 public void getRunRaceDetailInfo(Context context, String id, String userId, String state) { 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 Map<String, String> paramsMap = new HashMap<>(); 43 Map<String, String> paramsMap = new HashMap<>();
31 //赛事id 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,11 +146,12 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen
146 if (null == mClient) { 146 if (null == mClient) {
147 mClient = new LBSTraceClient(getContext()); 147 mClient = new LBSTraceClient(getContext());
148 } 148 }
  149 +
149 if (null != runRaceDetailInfo) { 150 if (null != runRaceDetailInfo) {
150 if (null != runRaceDetailInfo.getNewDescription() && !TextUtils.isEmpty(runRaceDetailInfo.getNewDescription())) { 151 if (null != runRaceDetailInfo.getNewDescription() && !TextUtils.isEmpty(runRaceDetailInfo.getNewDescription())) {
151 initWebView(runRaceDetailInfo.getNewDescription()); 152 initWebView(runRaceDetailInfo.getNewDescription());
152 } else if (null != runRaceDetailInfo.getDescription() && !TextUtils.isEmpty(runRaceDetailInfo.getDescription())) { 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 CollCommonInfo.setUserId(getContext(), uid); 157 CollCommonInfo.setUserId(getContext(), uid);
@@ -343,7 +344,19 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen @@ -343,7 +344,19 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen
343 if (!TextUtils.isEmpty(runRaceDetailInfo.getRoadmap())) { 344 if (!TextUtils.isEmpty(runRaceDetailInfo.getRoadmap())) {
344 //设置路线图 345 //设置路线图
345 GlideApp.with(getContext()).load(runRaceDetailInfo.getRoadmap()).into(fragment.binding.includeStreetIntroduce.ivRoadMao); 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 // if (!TextUtils.isEmpty(runRaceDetailInfo.getDescription())) { 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&lt;CollRunRaceDetailFra @@ -198,18 +198,6 @@ public class CollRunRaceDetailFragment extends QMUIFragment&lt;CollRunRaceDetailFra
198 if (messageEvent.getMessageType() == Constant.UPDATA_COLL_BIND_TRACE_LIST) { 198 if (messageEvent.getMessageType() == Constant.UPDATA_COLL_BIND_TRACE_LIST) {
199 if (getMvpView() != null) { 199 if (getMvpView() != null) {
200 getMvpView().resetMap(); 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 getPresenter().getRunRaceDetailInfo(getActivity(), CollCommonInfo.getStreetId(getActivity()), CommonInfo.getUserId(getActivity()), "1"); 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,6 +2,7 @@ package com.cnlive.moudle.pedometer.frame.presenter;
2 2
3 import android.content.Context; 3 import android.content.Context;
4 import android.view.View; 4 import android.view.View;
  5 +import android.view.ViewGroup;
5 6
6 import com.cnlive.libs.base.logic.Logic; 7 import com.cnlive.libs.base.logic.Logic;
7 import com.cnlive.libs.base.logic.callback.DataCallback; 8 import com.cnlive.libs.base.logic.callback.DataCallback;
@@ -25,6 +26,18 @@ import static com.cnlive.libs.base.logic.Config.STATE_LOAD; @@ -25,6 +26,18 @@ import static com.cnlive.libs.base.logic.Config.STATE_LOAD;
25 26
26 public class OnGoingFragmentPresenter extends MvpBasePresenter<OnGoingFragmentView> { 27 public class OnGoingFragmentPresenter extends MvpBasePresenter<OnGoingFragmentView> {
27 public void getRunRaceDetailInfo(Context context, String id, String userId, String state) { 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 Map<String, String> paramsMap = new HashMap<>(); 42 Map<String, String> paramsMap = new HashMap<>();
30 //赛事id 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,6 +2,7 @@ package com.cnlive.moudle.pedometer.frame.presenter;
2 2
3 import android.content.Context; 3 import android.content.Context;
4 import android.view.View; 4 import android.view.View;
  5 +import android.view.ViewGroup;
5 6
6 import com.cnlive.libs.base.logic.Logic; 7 import com.cnlive.libs.base.logic.Logic;
7 import com.cnlive.libs.base.logic.callback.DataCallback; 8 import com.cnlive.libs.base.logic.callback.DataCallback;
@@ -26,6 +27,18 @@ import static com.cnlive.libs.base.logic.Config.STATE_LOAD; @@ -26,6 +27,18 @@ import static com.cnlive.libs.base.logic.Config.STATE_LOAD;
26 public class RunRaceDetailFragmentPresenter extends MvpBasePresenter<RunRaceDetailFragmentView> { 27 public class RunRaceDetailFragmentPresenter extends MvpBasePresenter<RunRaceDetailFragmentView> {
27 28
28 public void getRunRaceDetailInfo(Context context, String id, String userId, String state) { 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 Map<String, String> paramsMap = new HashMap<>(); 43 Map<String, String> paramsMap = new HashMap<>();
31 //赛事id 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,6 +52,7 @@ import com.hannesdorfmann.mosby3.mvp.MvpView;
52 import com.qmuiteam.qmui.util.QMUIStatusBarHelper; 52 import com.qmuiteam.qmui.util.QMUIStatusBarHelper;
53 import com.sothree.slidinguppanel.SlidingUpPanelLayout; 53 import com.sothree.slidinguppanel.SlidingUpPanelLayout;
54 54
  55 +import java.util.ArrayList;
55 import java.util.List; 56 import java.util.List;
56 57
57 public class OnGoingFragmentView implements MvpView { 58 public class OnGoingFragmentView implements MvpView {
@@ -61,7 +62,7 @@ public class OnGoingFragmentView implements MvpView { @@ -61,7 +62,7 @@ public class OnGoingFragmentView implements MvpView {
61 private UiSettings mUiSettings; 62 private UiSettings mUiSettings;
62 public RunRaceDetailInfo runRaceDetailInfo; 63 public RunRaceDetailInfo runRaceDetailInfo;
63 private LBSTraceClient mClient = null; 64 private LBSTraceClient mClient = null;
64 - private WebView webView; 65 + public WebView webView;
65 66
66 public OnGoingFragmentView(OnGoingFragment fragment) { 67 public OnGoingFragmentView(OnGoingFragment fragment) {
67 this.fragment = fragment; 68 this.fragment = fragment;
@@ -101,12 +102,13 @@ public class OnGoingFragmentView implements MvpView { @@ -101,12 +102,13 @@ public class OnGoingFragmentView implements MvpView {
101 if (fragment.getActivity() == null) { 102 if (fragment.getActivity() == null) {
102 return; 103 return;
103 } 104 }
  105 + fragment.binding.flTop.setVisibility(View.VISIBLE);
104 this.runRaceDetailInfo = runRaceDetailInfo; 106 this.runRaceDetailInfo = runRaceDetailInfo;
105 if (null != runRaceDetailInfo) { 107 if (null != runRaceDetailInfo) {
106 if (null != runRaceDetailInfo.getNewDescription() && !TextUtils.isEmpty(runRaceDetailInfo.getNewDescription())) { 108 if (null != runRaceDetailInfo.getNewDescription() && !TextUtils.isEmpty(runRaceDetailInfo.getNewDescription())) {
107 initWebView(runRaceDetailInfo.getNewDescription()); 109 initWebView(runRaceDetailInfo.getNewDescription());
108 } else if (null != runRaceDetailInfo.getDescription() && !TextUtils.isEmpty(runRaceDetailInfo.getDescription())) { 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,7 +389,18 @@ public class OnGoingFragmentView implements MvpView {
387 if (!TextUtils.isEmpty(runRaceDetailInfo.getRoadmap())) { 389 if (!TextUtils.isEmpty(runRaceDetailInfo.getRoadmap())) {
388 //设置路线图 390 //设置路线图
389 GlideApp.with(getContext()).load(runRaceDetailInfo.getRoadmap()).into(fragment.binding.includeStreetIntroduce.ivRoadMao); 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,11 +168,12 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
168 if (fragment.getActivity() == null) { 168 if (fragment.getActivity() == null) {
169 return; 169 return;
170 } 170 }
  171 + fragment.binding.flTop.setVisibility(View.VISIBLE);
171 if (null != runRaceDetailInfo) { 172 if (null != runRaceDetailInfo) {
172 if (null != runRaceDetailInfo.getNewDescription() && !TextUtils.isEmpty(runRaceDetailInfo.getNewDescription())) { 173 if (null != runRaceDetailInfo.getNewDescription() && !TextUtils.isEmpty(runRaceDetailInfo.getNewDescription())) {
173 initWebView(runRaceDetailInfo.getNewDescription()); 174 initWebView(runRaceDetailInfo.getNewDescription());
174 } else if (null != runRaceDetailInfo.getDescription() && !TextUtils.isEmpty(runRaceDetailInfo.getDescription())) { 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 queryResultPoints = new ArrayList<>(); 179 queryResultPoints = new ArrayList<>();
@@ -518,8 +519,20 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { @@ -518,8 +519,20 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
518 if (!TextUtils.isEmpty(runRaceDetailInfo.getRoadmap())) { 519 if (!TextUtils.isEmpty(runRaceDetailInfo.getRoadmap())) {
519 //设置路线图 520 //设置路线图
520 GlideApp.with(getContext()).load(runRaceDetailInfo.getRoadmap()).into(fragment.binding.includeStreetIntroduce.ivRoadMao); 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 initStartBtnState(runRaceDetailInfo); 537 initStartBtnState(runRaceDetailInfo);
525 checkStartBtnState(); 538 checkStartBtnState();
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RunRaceDetailFragment.java
@@ -210,18 +210,6 @@ public class RunRaceDetailFragment extends QMUIFragment&lt;RunRaceDetailFragmentVie @@ -210,18 +210,6 @@ public class RunRaceDetailFragment extends QMUIFragment&lt;RunRaceDetailFragmentVie
210 } 210 }
211 if (getMvpView() != null && null != getPresenter()) { 211 if (getMvpView() != null && null != getPresenter()) {
212 if (!TextUtils.isEmpty(CommonInfo.getStreetId(getActivity()))) { 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 getPresenter().getRunRaceDetailInfo(getActivity(), CommonInfo.getStreetId(getActivity()), CommonInfo.getUserId(getActivity()), "0"); 213 getPresenter().getRunRaceDetailInfo(getActivity(), CommonInfo.getStreetId(getActivity()), CommonInfo.getUserId(getActivity()), "0");
226 } 214 }
227 } 215 }