Commit 5146a702f0431f388a160d2552c433a72ab06a9f
1 parent
670d7c94
1 大众体育已结束的赛事详情页增加分享逻辑
2 修复首次进入已结束的活动详情页小概率显示异常问题
Showing
4 changed files
with
71 additions
and
92 deletions
config.gradle
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/OnGoingFragmentView.java
| @@ -17,6 +17,8 @@ import com.baidu.mapapi.model.LatLng; | @@ -17,6 +17,8 @@ import com.baidu.mapapi.model.LatLng; | ||
| 17 | import com.baidu.trace.LBSTraceClient; | 17 | import com.baidu.trace.LBSTraceClient; |
| 18 | import com.baidu.trace.model.SortType; | 18 | import com.baidu.trace.model.SortType; |
| 19 | import com.cnlive.libs.base.application.AppConfig; | 19 | import com.cnlive.libs.base.application.AppConfig; |
| 20 | +import com.cnlive.libs.base.arouter.share.CNLiveShareService; | ||
| 21 | +import com.cnlive.libs.base.util.OpenServiceHelpUtil; | ||
| 20 | import com.cnlive.libs.base.util.StatusBarUtil2; | 22 | import com.cnlive.libs.base.util.StatusBarUtil2; |
| 21 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | 23 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 22 | import com.cnlive.moudle.pedometer.model.Constant; | 24 | import com.cnlive.moudle.pedometer.model.Constant; |
| @@ -45,6 +47,8 @@ public class OnGoingFragmentView implements MvpView { | @@ -45,6 +47,8 @@ public class OnGoingFragmentView implements MvpView { | ||
| 45 | public RunRaceDetailInfo runRaceDetailInfo; | 47 | public RunRaceDetailInfo runRaceDetailInfo; |
| 46 | private LBSTraceClient mClient = null; | 48 | private LBSTraceClient mClient = null; |
| 47 | public WebView webView; | 49 | public WebView webView; |
| 50 | + private final String SHARE_DEBUG_URL = "http://wjjh5test.cnlive.com/cnSportsDetail.html"; | ||
| 51 | + private final String SHARE_REL_URL = "http://wjjh5.cnlive.com/cnSportsDetail.html"; | ||
| 48 | 52 | ||
| 49 | public OnGoingFragmentView(OnGoingFragment fragment) { | 53 | public OnGoingFragmentView(OnGoingFragment fragment) { |
| 50 | this.fragment = fragment; | 54 | this.fragment = fragment; |
| @@ -77,10 +81,36 @@ public class OnGoingFragmentView implements MvpView { | @@ -77,10 +81,36 @@ public class OnGoingFragmentView implements MvpView { | ||
| 77 | } | 81 | } |
| 78 | WebViewUtil.setPtoHtmlData(fragment.getActivity(), html, webView, Constant.WEBVIEW_FONT_SIZE); | 82 | WebViewUtil.setPtoHtmlData(fragment.getActivity(), html, webView, Constant.WEBVIEW_FONT_SIZE); |
| 79 | fragment.binding.includeStreetIntroduce.llWebview.addView(webView); | 83 | fragment.binding.includeStreetIntroduce.llWebview.addView(webView); |
| 84 | + //view加载完成时回调 | ||
| 85 | + fragment.binding.includeStreetIntroduce.llWebview.post(new Runnable() { | ||
| 86 | + @Override | ||
| 87 | + public void run() { | ||
| 88 | + fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED); | ||
| 89 | + fragment.binding.scrollView.scrollTo(0, 0); | ||
| 90 | + } | ||
| 91 | + }); | ||
| 80 | } | 92 | } |
| 81 | 93 | ||
| 82 | - public void initView(RunRaceDetailInfo runRaceDetailInfo) { | 94 | + /** |
| 95 | + * 分享赛事 | ||
| 96 | + */ | ||
| 97 | + public void shareCurrentRace() { | ||
| 98 | + CNLiveShareService shareService = OpenServiceHelpUtil.getShareService(getContext()); | ||
| 99 | + if (null != shareService && null != runRaceDetailInfo) { | ||
| 100 | + String subTitle = "我在网家家上报名了线上赛事 快来和我一起动起来"; | ||
| 101 | + String shareUrl = AppConfig.isDebug() ? SHARE_DEBUG_URL : SHARE_REL_URL; | ||
| 102 | +// String shareImgUrl = "http://wjj.ys1.cnliveimg.com/download/app_icon/share/strike_logo_mass_sports.png"; | ||
| 103 | + String shareImgUrl = "http://wjj.ys1.cnliveimg.com/download/app_icon/share/strike_logo_mass_sports_rec.png"; | ||
| 104 | + boolean isShowWjjLife = true; | ||
| 105 | + boolean isShowWjjFriend = true; | ||
| 106 | + boolean isShowOther = true; | ||
| 107 | + shareUrl += "?eventId=" + fragment.eventId + "&channelName=" + runRaceDetailInfo.getChannelName(); | ||
| 108 | + shareService.shareLink(getContext(), runRaceDetailInfo.getTitle(), subTitle, shareUrl, shareImgUrl, isShowWjjLife, isShowWjjFriend, false); | ||
| 109 | + } | ||
| 110 | + } | ||
| 83 | 111 | ||
| 112 | + | ||
| 113 | + public void initView(RunRaceDetailInfo runRaceDetailInfo) { | ||
| 84 | if (fragment.getActivity() == null) { | 114 | if (fragment.getActivity() == null) { |
| 85 | return; | 115 | return; |
| 86 | } | 116 | } |
| @@ -236,11 +266,11 @@ public class OnGoingFragmentView implements MvpView { | @@ -236,11 +266,11 @@ public class OnGoingFragmentView implements MvpView { | ||
| 236 | } | 266 | } |
| 237 | //显示底部滑动卡片 | 267 | //显示底部滑动卡片 |
| 238 | fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED); | 268 | fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED); |
| 239 | - if (!TextUtils.isEmpty(runRaceDetailInfo.getE_subtitle())) { | ||
| 240 | - fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 169)); | ||
| 241 | - } else { | ||
| 242 | - fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 140)); | ||
| 243 | - } | 269 | +// if (!TextUtils.isEmpty(runRaceDetailInfo.getE_subtitle())) { |
| 270 | +// fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 169)); | ||
| 271 | +// } else { | ||
| 272 | +// fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 140)); | ||
| 273 | +// } | ||
| 244 | //设置标题 | 274 | //设置标题 |
| 245 | if (!TextUtils.isEmpty(runRaceDetailInfo.getTitle())) { | 275 | if (!TextUtils.isEmpty(runRaceDetailInfo.getTitle())) { |
| 246 | fragment.binding.includeStreet.tvRaceTitle.setText(runRaceDetailInfo.getTitle()); | 276 | fragment.binding.includeStreet.tvRaceTitle.setText(runRaceDetailInfo.getTitle()); |
| @@ -417,6 +447,21 @@ public class OnGoingFragmentView implements MvpView { | @@ -417,6 +447,21 @@ public class OnGoingFragmentView implements MvpView { | ||
| 417 | } | 447 | } |
| 418 | }); | 448 | }); |
| 419 | } | 449 | } |
| 450 | + | ||
| 451 | + //地图模式黑色分享按钮 | ||
| 452 | + fragment.binding.ivBlackShare.setOnClickListener(new View.OnClickListener() { | ||
| 453 | + @Override | ||
| 454 | + public void onClick(View v) { | ||
| 455 | + shareCurrentRace(); | ||
| 456 | + } | ||
| 457 | + }); | ||
| 458 | + //非地图模式 | ||
| 459 | + fragment.binding.llTopShare.setOnClickListener(new View.OnClickListener() { | ||
| 460 | + @Override | ||
| 461 | + public void onClick(View v) { | ||
| 462 | + shareCurrentRace(); | ||
| 463 | + } | ||
| 464 | + }); | ||
| 420 | } | 465 | } |
| 421 | 466 | ||
| 422 | public void initMap() { | 467 | public void initMap() { |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunRaceDetailFragmentView.java
| @@ -180,8 +180,14 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -180,8 +180,14 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 180 | } | 180 | } |
| 181 | WebViewUtil.setPtoHtmlData(fragment.getActivity(), html, webView, Constant.WEBVIEW_FONT_SIZE); | 181 | WebViewUtil.setPtoHtmlData(fragment.getActivity(), html, webView, Constant.WEBVIEW_FONT_SIZE); |
| 182 | fragment.binding.includeStreetIntroduce.llWebview.addView(webView); | 182 | fragment.binding.includeStreetIntroduce.llWebview.addView(webView); |
| 183 | - fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED); | ||
| 184 | - | 183 | + //view加载完成时回调 |
| 184 | + fragment.binding.includeStreetIntroduce.llWebview.post(new Runnable() { | ||
| 185 | + @Override | ||
| 186 | + public void run() { | ||
| 187 | + fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED); | ||
| 188 | + fragment.binding.scrollView.scrollTo(0, 0); | ||
| 189 | + } | ||
| 190 | + }); | ||
| 185 | } | 191 | } |
| 186 | 192 | ||
| 187 | public void initView(RunRaceDetailInfo runRaceDetailInfo) { | 193 | public void initView(RunRaceDetailInfo runRaceDetailInfo) { |
| @@ -235,9 +241,6 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -235,9 +241,6 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 235 | fragment.binding.mapView.setVisibility(View.VISIBLE); | 241 | fragment.binding.mapView.setVisibility(View.VISIBLE); |
| 236 | //隐藏空视图 | 242 | //隐藏空视图 |
| 237 | fragment.binding.emptyLayout.setVisibility(View.GONE); | 243 | fragment.binding.emptyLayout.setVisibility(View.GONE); |
| 238 | - //显示立即报名按钮 | ||
| 239 | -// fragment.binding.includeStreet.rlStartBtn.setVisibility(View.VISIBLE); | ||
| 240 | - | ||
| 241 | //设置底部卡片第一次可滑动的位置 | 244 | //设置底部卡片第一次可滑动的位置 |
| 242 | fragment.binding.slidingLayout.setAnchorPoint(0.5f); | 245 | fragment.binding.slidingLayout.setAnchorPoint(0.5f); |
| 243 | LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); | 246 | LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); |
| @@ -385,22 +388,14 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -385,22 +388,14 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 385 | //设置标题 | 388 | //设置标题 |
| 386 | if (!TextUtils.isEmpty(runRaceDetailInfo.getTitle())) { | 389 | if (!TextUtils.isEmpty(runRaceDetailInfo.getTitle())) { |
| 387 | fragment.binding.includeStreet.tvRaceTitle.setText(runRaceDetailInfo.getTitle()); | 390 | fragment.binding.includeStreet.tvRaceTitle.setText(runRaceDetailInfo.getTitle()); |
| 388 | -// fragment.binding.includeStreet.tvRaceTitle.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { | ||
| 389 | -// @Override | ||
| 390 | -// public boolean onPreDraw() { | ||
| 391 | -// Log.e(TAG, "initView: " + fragment.binding.includeStreet.tvRaceTitle.getLineCount()); | ||
| 392 | -// fragment.binding.includeStreet.tvRaceTitle.getViewTreeObserver().removeOnPreDrawListener(this); | ||
| 393 | -// return false; | ||
| 394 | -// } | ||
| 395 | -// }); | 391 | +// if (!TextUtils.isEmpty(runRaceDetailInfo.getE_subtitle())) { |
| 392 | +// fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 210)); | ||
| 393 | +// } else { | ||
| 394 | +// fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 181)); | ||
| 395 | +// } | ||
| 396 | + fragment.binding.flTop.setVisibility(View.INVISIBLE); | ||
| 396 | //显示底部滑动卡片 | 397 | //显示底部滑动卡片 |
| 397 | fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED); | 398 | fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED); |
| 398 | - if (!TextUtils.isEmpty(runRaceDetailInfo.getE_subtitle())) { | ||
| 399 | - fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 210)); | ||
| 400 | - } else { | ||
| 401 | - fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 181)); | ||
| 402 | - } | ||
| 403 | - fragment.binding.flTop.setVisibility(View.GONE); | ||
| 404 | // //根据标题行数,自动调整卡片大小 | 399 | // //根据标题行数,自动调整卡片大小 |
| 405 | // fragment.binding.includeStreet.tvRaceTitle.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { | 400 | // fragment.binding.includeStreet.tvRaceTitle.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { |
| 406 | // @Override | 401 | // @Override |
| @@ -480,10 +475,6 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -480,10 +475,6 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 480 | if (runRaceDetailInfo.isIndividualAchievement()) { | 475 | if (runRaceDetailInfo.isIndividualAchievement()) { |
| 481 | //显示 | 476 | //显示 |
| 482 | fragment.binding.includePersonScore.llPersonScoreRoot.setVisibility(View.VISIBLE); | 477 | fragment.binding.includePersonScore.llPersonScoreRoot.setVisibility(View.VISIBLE); |
| 483 | -// //设置完成人数 | ||
| 484 | -// if (!TextUtils.isEmpty(runRaceDetailInfo.getFinishNum())) { | ||
| 485 | -// fragment.binding.includeRank.tvFinishPerson.setText(runRaceDetailInfo.getFinishNum()); | ||
| 486 | -// } | ||
| 487 | //设置个人行走距离 | 478 | //设置个人行走距离 |
| 488 | if (!TextUtils.isEmpty(runRaceDetailInfo.getUserMileage())) { | 479 | if (!TextUtils.isEmpty(runRaceDetailInfo.getUserMileage())) { |
| 489 | fragment.binding.includePersonScore.tvUserDistance.setText(runRaceDetailInfo.getUserMileage()); | 480 | fragment.binding.includePersonScore.tvUserDistance.setText(runRaceDetailInfo.getUserMileage()); |
| @@ -555,65 +546,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -555,65 +546,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 555 | //判断按钮状态 | 546 | //判断按钮状态 |
| 556 | initStartBtnState(runRaceDetailInfo); | 547 | initStartBtnState(runRaceDetailInfo); |
| 557 | checkStartBtnState(); | 548 | checkStartBtnState(); |
| 558 | -// //判断用户是否报名 | ||
| 559 | -// if (runRaceDetailInfo.isSignResult()) { | ||
| 560 | -// fragment.binding.rlScrollViewStartBtn.setTag(BTN_START_RACE); | ||
| 561 | -// fragment.binding.tvRunNow.setText("现在开始"); | ||
| 562 | -// fragment.binding.tvGoTip.setVisibility(View.VISIBLE); | ||
| 563 | -// checkStartBtnState(); | ||
| 564 | -// } else { | ||
| 565 | -// fragment.binding.rlScrollViewStartBtn.setTag(BTN_REGIST_RACE); | ||
| 566 | -// fragment.binding.tvRunNow.setText("立即报名"); | ||
| 567 | -// fragment.binding.tvGoTip.setVisibility(View.GONE); | ||
| 568 | -// } | ||
| 569 | 549 | ||
| 570 | -// //开始按钮点击事件(未滑动) | ||
| 571 | -// fragment.binding.includeStreet.rlStartBtn.setOnClickListener(new View.OnClickListener() { | ||
| 572 | -// @Override | ||
| 573 | -// public void onClick(View view) { | ||
| 574 | -// if (fragment.getActivity() == null) { | ||
| 575 | -// return; | ||
| 576 | -// } | ||
| 577 | -// //立即报名 | ||
| 578 | -// if ("0".equals(fragment.binding.includeStreet.rlStartBtn.getTag())) { | ||
| 579 | -// fragment.binding.includeStreet.rlStartBtn.setTag("1"); | ||
| 580 | -// fragment.binding.includeStreet.tvRunNow.setText(getContext().getResources().getString(R.string.run_race_btn_start_now)); | ||
| 581 | -// fragment.binding.includeStreet.tvGoTip.setVisibility(View.VISIBLE); | ||
| 582 | -// | ||
| 583 | -// //设置滑动 | ||
| 584 | -// fragment.binding.rlScrollViewStartBtn.setTag("1"); | ||
| 585 | -// fragment.binding.tvRunNow.setText(getContext().getResources().getString(R.string.run_race_btn_start_now)); | ||
| 586 | -// fragment.binding.tvGoTip.setVisibility(View.VISIBLE); | ||
| 587 | -// RegistrationInfoActivity.newInstance(fragment.getActivity(), 1001); | ||
| 588 | -// } else { | ||
| 589 | -// //计算当前位置与起点坐标距离 | ||
| 590 | -// if (userCurrentLatLng != null && trackPoints != null && trackPoints.size() > 0) { | ||
| 591 | -// double distance = DistanceUtil.getDistance(userCurrentLatLng, trackPoints.get(0)); | ||
| 592 | -// if (distance < 20) { | ||
| 593 | -// //开始运动 | ||
| 594 | -// fragment.binding.includeStreet.rlStartBtn.setTag("0"); | ||
| 595 | -// fragment.binding.includeStreet.tvRunNow.setText(getContext().getResources().getString(R.string.run_race_btn_sign_up)); | ||
| 596 | -// fragment.binding.includeStreet.tvGoTip.setVisibility(View.GONE); | ||
| 597 | -// fragment.getActivity().startActivity(new Intent(getContext(), PedometerMainActivity.class)); | ||
| 598 | -// //设置滑动 | ||
| 599 | -// fragment.binding.rlScrollViewStartBtn.setTag("0"); | ||
| 600 | -// fragment.binding.tvRunNow.setText(getContext().getResources().getString(R.string.run_race_btn_sign_up)); | ||
| 601 | -// fragment.binding.tvGoTip.setVisibility(View.GONE); | ||
| 602 | -// } else { | ||
| 603 | -// TipDialog tipDialog = new TipDialog(getContext(), getContext().getResources().getString(R.string.run_race_far_tip), "我知道了", R.color.green_round, new TipDialog.DialogInterface() { | ||
| 604 | -// @Override | ||
| 605 | -// public void onClick(TipDialog dialog) { | ||
| 606 | -// dialog.dismiss(); | ||
| 607 | -// } | ||
| 608 | -// }); | ||
| 609 | -// tipDialog.show(); | ||
| 610 | -// tipDialog.setCancelable(false); | ||
| 611 | -// tipDialog.setCanceledOnTouchOutside(false); | ||
| 612 | -// } | ||
| 613 | -// } | ||
| 614 | -// } | ||
| 615 | -// } | ||
| 616 | -// }); | ||
| 617 | //开始按钮点击事件(用户进行滑动滑动) | 550 | //开始按钮点击事件(用户进行滑动滑动) |
| 618 | fragment.binding.rlScrollViewStartBtn.setOnClickListener(new View.OnClickListener() { | 551 | fragment.binding.rlScrollViewStartBtn.setOnClickListener(new View.OnClickListener() { |
| 619 | @Override | 552 | @Override |
moudle_pedometer/src/main/res/layout/fragment_run_race_detail.xml
| @@ -14,6 +14,7 @@ | @@ -14,6 +14,7 @@ | ||
| 14 | sothree:umanoDragView="@+id/scrollView" | 14 | sothree:umanoDragView="@+id/scrollView" |
| 15 | sothree:umanoFadeColor="@color/black_20" | 15 | sothree:umanoFadeColor="@color/black_20" |
| 16 | sothree:umanoOverlay="true" | 16 | sothree:umanoOverlay="true" |
| 17 | + sothree:umanoPanelHeight="181dp" | ||
| 17 | sothree:umanoParallaxOffset="400dp" | 18 | sothree:umanoParallaxOffset="400dp" |
| 18 | sothree:umanoScrollableView="@+id/scrollView" | 19 | sothree:umanoScrollableView="@+id/scrollView" |
| 19 | sothree:umanoShadowHeight="0dp"> | 20 | sothree:umanoShadowHeight="0dp"> |
| @@ -179,9 +180,9 @@ | @@ -179,9 +180,9 @@ | ||
| 179 | android:layout_width="0dp" | 180 | android:layout_width="0dp" |
| 180 | android:layout_height="wrap_content" | 181 | android:layout_height="wrap_content" |
| 181 | android:layout_gravity="center" | 182 | android:layout_gravity="center" |
| 182 | - android:text="路线详情" | ||
| 183 | - android:gravity="center" | ||
| 184 | android:layout_weight="1" | 183 | android:layout_weight="1" |
| 184 | + android:gravity="center" | ||
| 185 | + android:text="路线详情" | ||
| 185 | android:textColor="@color/white" | 186 | android:textColor="@color/white" |
| 186 | android:textSize="18sp" /> | 187 | android:textSize="18sp" /> |
| 187 | 188 | ||
| @@ -191,8 +192,8 @@ | @@ -191,8 +192,8 @@ | ||
| 191 | android:layout_height="match_parent" | 192 | android:layout_height="match_parent" |
| 192 | android:layout_gravity="center_vertical" | 193 | android:layout_gravity="center_vertical" |
| 193 | android:gravity="center" | 194 | android:gravity="center" |
| 194 | - android:paddingRight="10dp" | ||
| 195 | - > | 195 | + android:paddingRight="10dp"> |
| 196 | + | ||
| 196 | <ImageView | 197 | <ImageView |
| 197 | android:layout_width="20dp" | 198 | android:layout_width="20dp" |
| 198 | android:layout_height="19dp" | 199 | android:layout_height="19dp" |