Commit c813a1ed5ebfddee98cbc58d7240c2d52d3cfc64

Authored by YangShuai
1 parent 302f48b0

1 赛事详情页增加分享逻辑

2 修复赛事结束按钮可点击的问题
app/src/main/java/com/example/modulepedometer/MyApp.java
@@ -13,9 +13,16 @@ public class MyApp extends Application { @@ -13,9 +13,16 @@ public class MyApp extends Application {
13 public void onCreate() { 13 public void onCreate() {
14 super.onCreate(); 14 super.onCreate();
15 String userId = "358916"; 15 String userId = "358916";
16 - AppConfig.init(getApplicationContext(), BuildConfig.APP_ID, BuildConfig.APP_KEY, BuildConfig.APP_SCERET,  
17 - 0, BuildConfig.DEBUG, "", "",  
18 - userId, "", "", "", "", "", "", "", BuildConfig.BAIDU_MAP_APP_KEY); 16 +// AppConfig.init(getApplicationContext(), BuildConfig.APP_ID, BuildConfig.APP_KEY, BuildConfig.APP_SCERET,
  17 +// 0, BuildConfig.DEBUG, BuildConfig.BAIDU_MAP_APP_KEY, "",
  18 +// userId, "", "", "", "", "", "", "", BuildConfig.BAIDU_MAP_APP_KEY, "");
  19 + AppConfig.init(this, BuildConfig.APP_ID, BuildConfig.APP_KEY,
  20 + BuildConfig.APP_SCERET,0,
  21 + BuildConfig.DEBUG, BuildConfig.BAIDU_MAP_APP_KEY, "",
  22 + userId, "",
  23 + "","", "",
  24 + "", "", "",
  25 + BuildConfig.BAIDU_MAP_APP_KEY, "");
19 if (AppConfig.isDebug()) { 26 if (AppConfig.isDebug()) {
20 Constant.SERVICE_ID = 213511; 27 Constant.SERVICE_ID = 213511;
21 } else { 28 } else {
build.gradle
@@ -68,7 +68,7 @@ ext { @@ -68,7 +68,7 @@ ext {
68 //qmui 68 //qmui
69 qmui = '1.1.5' 69 qmui = '1.1.5'
70 70
71 - libBase = '1.3.6' 71 + libBase = '1.9.1.4'
72 libNetwork = '1.1.0' 72 libNetwork = '1.1.0'
73 libLargeImage = '1.0.1' 73 libLargeImage = '1.0.1'
74 libEmoj = '1.9.8' 74 libEmoj = '1.9.8'
config.gradle
@@ -21,7 +21,7 @@ ext { @@ -21,7 +21,7 @@ ext {
21 //编译方式 21 //编译方式
22 debug : false, 22 debug : false,
23 //版本号 23 //版本号
24 - version: "1.0.18", 24 + version: "1.0.19",
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/pedometer/frame/view/RunRaceDetailFragmentView.java
@@ -4,6 +4,7 @@ import android.content.Context; @@ -4,6 +4,7 @@ import android.content.Context;
4 import android.content.Intent; 4 import android.content.Intent;
5 import android.graphics.Bitmap; 5 import android.graphics.Bitmap;
6 import android.graphics.BitmapFactory; 6 import android.graphics.BitmapFactory;
  7 +import android.graphics.Point;
7 import android.hardware.Sensor; 8 import android.hardware.Sensor;
8 import android.hardware.SensorEvent; 9 import android.hardware.SensorEvent;
9 import android.hardware.SensorEventListener; 10 import android.hardware.SensorEventListener;
@@ -42,6 +43,8 @@ import com.baidu.mapapi.utils.DistanceUtil; @@ -42,6 +43,8 @@ import com.baidu.mapapi.utils.DistanceUtil;
42 import com.baidu.trace.LBSTraceClient; 43 import com.baidu.trace.LBSTraceClient;
43 import com.baidu.trace.model.SortType; 44 import com.baidu.trace.model.SortType;
44 import com.cnlive.libs.base.application.AppConfig; 45 import com.cnlive.libs.base.application.AppConfig;
  46 +import com.cnlive.libs.base.arouter.share.CNLiveShareService;
  47 +import com.cnlive.libs.base.util.OpenServiceHelpUtil;
45 import com.cnlive.libs.base.util.StatusBarUtil2; 48 import com.cnlive.libs.base.util.StatusBarUtil2;
46 import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; 49 import com.cnlive.moudle.pedometer.commonInfo.CommonInfo;
47 import com.cnlive.moudle.pedometer.model.Constant; 50 import com.cnlive.moudle.pedometer.model.Constant;
@@ -125,6 +128,8 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { @@ -125,6 +128,8 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
125 private final String BTN_CONTINUE_RACE = "7";//继续运动 128 private final String BTN_CONTINUE_RACE = "7";//继续运动
126 public WebView webView; 129 public WebView webView;
127 private boolean isLoadWeb = false; 130 private boolean isLoadWeb = false;
  131 + private final String SHARE_DEBUG_URL = "http://wjjh5test.cnlive.com/cnSportsDetail.html";
  132 + private final String SHARE_REL_URL = "http://wjjh5.cnlive.com/cnSportsDetail.html";
128 133
129 public RunRaceDetailFragmentView(RunRaceDetailFragment fragment) { 134 public RunRaceDetailFragmentView(RunRaceDetailFragment fragment) {
130 this.fragment = fragment; 135 this.fragment = fragment;
@@ -134,6 +139,22 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { @@ -134,6 +139,22 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
134 return fragment == null ? null : fragment.getActivity(); 139 return fragment == null ? null : fragment.getActivity();
135 } 140 }
136 141
  142 + /**
  143 + * 分享赛事
  144 + */
  145 + public void shareCurrentRace() {
  146 + CNLiveShareService shareService = OpenServiceHelpUtil.getShareService(getContext());
  147 + if (null != shareService && null != runRaceDetailInfo) {
  148 + String subTitle = "我在网家家上报名了线上赛事 快来和我一起动起来";
  149 + String shareUrl = AppConfig.isDebug() ? SHARE_DEBUG_URL : SHARE_REL_URL;
  150 + String shareImgUrl = "http://wjj.ys1.cnliveimg.com/download/app_icon/share/strike_logo_mass_sports.png";
  151 + boolean isShowWjjLife = true;
  152 + boolean isShowWjjFriend = true;
  153 + boolean isShowOther = true;
  154 + shareService.shareLink(getContext(), runRaceDetailInfo.getTitle(), subTitle, shareUrl, shareImgUrl, isShowWjjLife, isShowOther, true);
  155 + }
  156 + }
  157 +
137 public void initWebView(String html) { 158 public void initWebView(String html) {
138 if (null == webView) { 159 if (null == webView) {
139 webView = new WebView(getContext()); 160 webView = new WebView(getContext());
@@ -740,6 +761,20 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { @@ -740,6 +761,20 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
740 .navigation(fragment.getActivity()); 761 .navigation(fragment.getActivity());
741 } 762 }
742 }); 763 });
  764 + //地图模式黑色分享按钮
  765 + fragment.binding.ivBlackShare.setOnClickListener(new View.OnClickListener() {
  766 + @Override
  767 + public void onClick(View v) {
  768 + shareCurrentRace();
  769 + }
  770 + });
  771 + //非地图模式
  772 + fragment.binding.llTopShare.setOnClickListener(new View.OnClickListener() {
  773 + @Override
  774 + public void onClick(View v) {
  775 + shareCurrentRace();
  776 + }
  777 + });
743 } 778 }
744 779
745 /** 780 /**
@@ -785,10 +820,10 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { @@ -785,10 +820,10 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
785 } 820 }
786 //报名结束 821 //报名结束
787 else if (BTN_END_RACE.equals(runRaceDetailInfo.getEventState())) { 822 else if (BTN_END_RACE.equals(runRaceDetailInfo.getEventState())) {
788 - fragment.binding.rlScrollViewStartBtn.setTag(BTN_START_RACE);  
789 - fragment.binding.tvRunNow.setText("赛事已结束"); 823 + fragment.binding.rlScrollViewStartBtn.setTag(BTN_END_RACE);
  824 + fragment.binding.tvRunNow.setText("赛事结束");
790 fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.gray_round)); 825 fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.gray_round));
791 - fragment.binding.tvGoTip.setVisibility(View.VISIBLE); 826 + fragment.binding.tvGoTip.setVisibility(View.GONE);
792 } 827 }
793 } 828 }
794 829
@@ -832,7 +867,10 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { @@ -832,7 +867,10 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
832 baiduMap = mMapView.getMap(); 867 baiduMap = mMapView.getMap();
833 } 868 }
834 //设置指南针位置 869 //设置指南针位置
835 - android.graphics.Point point = new android.graphics.Point(ScreenUtil.getScreenWidth(getContext()) - 80, 80); 870 +// android.graphics.Point point = new android.graphics.Point(ScreenUtil.getScreenWidth(getContext()) - 80, 80);
  871 + int[] location = new int[2];
  872 + fragment.binding.ivBack.getLocationOnScreen(location);
  873 + android.graphics.Point point = new android.graphics.Point(location[0] + ScreenUtil.dip2px(getContext(), 27), location[1] + ScreenUtil.dip2px(getContext(), 80));
836 baiduMap.setCompassPosition(point); 874 baiduMap.setCompassPosition(point);
837 // if (routePlanSearch == null) { 875 // if (routePlanSearch == null) {
838 // routePlanSearch = RoutePlanSearch.newInstance(); 876 // routePlanSearch = RoutePlanSearch.newInstance();
moudle_pedometer/src/main/res/drawable-hdpi/icon_pedometer_black_share.png 0 → 100644

1.93 KB

moudle_pedometer/src/main/res/drawable-hdpi/icon_pedometer_compass.webp 0 → 100644
No preview for this file type
moudle_pedometer/src/main/res/drawable-hdpi/icon_pedometer_white_share.png 0 → 100644

872 Bytes

moudle_pedometer/src/main/res/drawable-xhdpi/icon_pedometer_black_share.png 0 → 100644

2.5 KB

moudle_pedometer/src/main/res/drawable-xhdpi/icon_pedometer_white_share.png 0 → 100644

971 Bytes

moudle_pedometer/src/main/res/drawable-xxhdpi/icon_pedometer_black_share.png 0 → 100644

4.84 KB

moudle_pedometer/src/main/res/drawable-xxhdpi/icon_pedometer_white_share.png 0 → 100644

2.32 KB

moudle_pedometer/src/main/res/layout/fragment_run_race_detail.xml
@@ -45,6 +45,14 @@ @@ -45,6 +45,14 @@
45 android:layout_margin="10dp" 45 android:layout_margin="10dp"
46 android:background="@drawable/pedometer_xqy_return" /> 46 android:background="@drawable/pedometer_xqy_return" />
47 47
  48 + <ImageView
  49 + android:id="@+id/iv_black_share"
  50 + android:layout_width="35dp"
  51 + android:layout_height="35dp"
  52 + android:layout_gravity="right"
  53 + android:layout_margin="10dp"
  54 + android:background="@drawable/icon_pedometer_black_share" />
  55 +
48 56
49 <ImageView 57 <ImageView
50 android:id="@+id/iv_share" 58 android:id="@+id/iv_share"
@@ -144,13 +152,13 @@ @@ -144,13 +152,13 @@
144 152
145 </RelativeLayout> 153 </RelativeLayout>
146 154
147 - <FrameLayout 155 + <LinearLayout
148 android:id="@+id/fl_top" 156 android:id="@+id/fl_top"
149 android:layout_width="match_parent" 157 android:layout_width="match_parent"
150 android:layout_height="40dp" 158 android:layout_height="40dp"
151 android:layout_gravity="top" 159 android:layout_gravity="top"
152 android:background="@color/run_main_bg" 160 android:background="@color/run_main_bg"
153 - android:gravity="center" 161 + android:gravity="center_vertical"
154 android:visibility="invisible"> 162 android:visibility="invisible">
155 163
156 <LinearLayout 164 <LinearLayout
@@ -159,22 +167,38 @@ @@ -159,22 +167,38 @@
159 android:layout_height="match_parent" 167 android:layout_height="match_parent"
160 android:layout_gravity="center_vertical" 168 android:layout_gravity="center_vertical"
161 android:gravity="center" 169 android:gravity="center"
162 - android:padding="10dp"> 170 + android:padding="8dp">
163 171
164 <ImageView 172 <ImageView
165 - android:layout_width="9dp"  
166 - android:layout_height="14dp" 173 + android:layout_width="11dp"
  174 + android:layout_height="20dp"
167 android:background="@drawable/pedometer_icon_run_white_back" /> 175 android:background="@drawable/pedometer_icon_run_white_back" />
168 </LinearLayout> 176 </LinearLayout>
169 177
170 <TextView 178 <TextView
171 - android:layout_width="wrap_content" 179 + android:layout_width="0dp"
172 android:layout_height="wrap_content" 180 android:layout_height="wrap_content"
173 android:layout_gravity="center" 181 android:layout_gravity="center"
174 android:text="路线详情" 182 android:text="路线详情"
  183 + android:gravity="center"
  184 + android:layout_weight="1"
175 android:textColor="@color/white" 185 android:textColor="@color/white"
176 android:textSize="18sp" /> 186 android:textSize="18sp" />
177 - </FrameLayout> 187 +
  188 + <LinearLayout
  189 + android:id="@+id/ll_top_share"
  190 + android:layout_width="wrap_content"
  191 + android:layout_height="match_parent"
  192 + android:layout_gravity="center_vertical"
  193 + android:gravity="center"
  194 + android:paddingRight="10dp"
  195 + >
  196 + <ImageView
  197 + android:layout_width="20dp"
  198 + android:layout_height="19dp"
  199 + android:background="@drawable/icon_pedometer_white_share" />
  200 + </LinearLayout>
  201 + </LinearLayout>
178 202
179 <com.cnlive.strike.ui.widget.UIEmptyView 203 <com.cnlive.strike.ui.widget.UIEmptyView
180 android:id="@+id/empty_layout" 204 android:id="@+id/empty_layout"