|
@ -16,6 +16,7 @@ import android.widget.LinearLayout;
|
16
|
16
|
import android.widget.TextView;
|
17
|
17
|
import android.widget.Toast;
|
18
|
18
|
|
|
19
|
import com.blankj.utilcode.util.LogUtils;
|
19
|
20
|
import com.blankj.utilcode.util.NetworkUtils;
|
20
|
21
|
import com.blankj.utilcode.util.ToastUtils;
|
21
|
22
|
import com.bumptech.glide.Glide;
|
|
@ -24,6 +25,7 @@ import com.electric.chargingpile.R;
|
24
|
25
|
import com.electric.chargingpile.activity.PersonalPageActivity;
|
25
|
26
|
import com.electric.chargingpile.activity.TopicDetailsActivity;
|
26
|
27
|
import com.electric.chargingpile.application.MainApplication;
|
|
28
|
import com.electric.chargingpile.data.ChargingShareBean;
|
27
|
29
|
import com.electric.chargingpile.data.TalkRecommendBean;
|
28
|
30
|
import com.electric.chargingpile.util.CircleTransform;
|
29
|
31
|
import com.electric.chargingpile.util.JsonUtils;
|
|
@ -34,6 +36,7 @@ import com.electric.chargingpile.view.VideoCommentDialog;
|
34
|
36
|
import com.electric.chargingpile.view.VideoPubilshDialog;
|
35
|
37
|
import com.electric.chargingpile.widge.photoview.PhotoView;
|
36
|
38
|
import com.electric.chargingpile.widge.photoview.ZoomingViewpager;
|
|
39
|
import com.qmuiteam.qmui.widget.dialog.QMUIBottomSheet;
|
37
|
40
|
import com.squareup.picasso.Picasso;
|
38
|
41
|
import com.zhy.http.okhttp.OkHttpUtils;
|
39
|
42
|
import com.zhy.http.okhttp.callback.StringCallback;
|
|
@ -43,6 +46,12 @@ import java.util.List;
|
43
|
46
|
import java.util.Locale;
|
44
|
47
|
import java.util.Map;
|
45
|
48
|
|
|
49
|
import cn.sharesdk.framework.Platform;
|
|
50
|
import cn.sharesdk.framework.PlatformActionListener;
|
|
51
|
import cn.sharesdk.framework.ShareSDK;
|
|
52
|
import cn.sharesdk.tencent.qq.QQ;
|
|
53
|
import cn.sharesdk.wechat.friends.Wechat;
|
|
54
|
import cn.sharesdk.wechat.moments.WechatMoments;
|
46
|
55
|
import okhttp3.Call;
|
47
|
56
|
import tv.danmaku.ijk.media.player.IMediaPlayer;
|
48
|
57
|
|
|
@ -188,7 +197,7 @@ public class SvVideoShowView implements View.OnClickListener {
|
188
|
197
|
|
189
|
198
|
|
190
|
199
|
if (talkRecommendBean.likeFlg == 1) {
|
191
|
|
// sv_show_like_img like
|
|
200
|
// sv_show_like_img like
|
192
|
201
|
} else {
|
193
|
202
|
// sv_show_like_img not like
|
194
|
203
|
}
|
|
@ -231,10 +240,10 @@ public class SvVideoShowView implements View.OnClickListener {
|
231
|
240
|
public void onResponse(String response) {
|
232
|
241
|
String rtnCode = JsonUtils.getKeyResult(response, "code");
|
233
|
242
|
|
234
|
|
// sv_show_like_ll =view.findViewById(R.id.sv_show_like_ll);
|
|
243
|
// sv_show_like_ll =view.findViewById(R.id.sv_show_like_ll);
|
235
|
244
|
sv_show_like_img = view.findViewById(R.id.sv_show_like_img);
|
236
|
245
|
ToastUtils.showLong("like没有提供图片");
|
237
|
|
// sv_show_like_tv =view.findViewById(R.id.sv_show_like_tv);
|
|
246
|
// sv_show_like_tv =view.findViewById(R.id.sv_show_like_tv);
|
238
|
247
|
if ("1000".equals(rtnCode)) {
|
239
|
248
|
if (likeFlag == 1) {
|
240
|
249
|
talkRecommendBean.likeNums += 1;
|
|
@ -431,7 +440,7 @@ public class SvVideoShowView implements View.OnClickListener {
|
431
|
440
|
videoCommentDialog.show();
|
432
|
441
|
break;
|
433
|
442
|
case R.id.sv_show_forward:
|
434
|
|
ToastUtils.showLong("我是转发!");
|
|
443
|
getShareData();
|
435
|
444
|
break;
|
436
|
445
|
case R.id.sv_show_like_ll:
|
437
|
446
|
int likeFlg = talkRecommendBean.likeFlg;
|
|
@ -462,6 +471,120 @@ public class SvVideoShowView implements View.OnClickListener {
|
462
|
471
|
}
|
463
|
472
|
}
|
464
|
473
|
|
|
474
|
private void getShareData() {
|
|
475
|
String url = MainApplication.urlNew + "/api/0200/topic/share.do";
|
|
476
|
Map<String, String> map = new HashMap<>();
|
|
477
|
map.put("targetId", talkRecommendBean.targetId + "");
|
|
478
|
map.put("targetType", talkRecommendBean.targetType + "");
|
|
479
|
OkHttpUtils
|
|
480
|
.get()
|
|
481
|
.params(map)
|
|
482
|
.url(url)
|
|
483
|
.build()
|
|
484
|
.connTimeOut(6000)
|
|
485
|
.readTimeOut(6000)
|
|
486
|
.execute(new StringCallback() {
|
|
487
|
@Override
|
|
488
|
public void onError(Call call, Exception e) {
|
|
489
|
ToastUtil.showToast(activity, "获取失败,请重试", Toast.LENGTH_SHORT);
|
|
490
|
}
|
|
491
|
|
|
492
|
@Override
|
|
493
|
public void onResponse(String response) {
|
|
494
|
String rtnCode = JsonUtils.getKeyResult(response, "code");
|
|
495
|
if ("1000".equals(rtnCode)) {
|
|
496
|
String rtnMsg = JsonUtils.getKeyResult(response, "data");
|
|
497
|
String shareUrl = JsonUtils.getKeyResult(rtnMsg, "url");
|
|
498
|
|
|
499
|
if (!TextUtils.isEmpty(shareUrl)) {
|
|
500
|
ChargingShareBean chargingShareBean = new ChargingShareBean();
|
|
501
|
chargingShareBean.setIcon(talkRecommendBean.coverImgUrl);
|
|
502
|
chargingShareBean.setTitle(talkRecommendBean.title);
|
|
503
|
chargingShareBean.setUrl(shareUrl);
|
|
504
|
}
|
|
505
|
}
|
|
506
|
}
|
|
507
|
});
|
|
508
|
}
|
|
509
|
|
|
510
|
private void showSimpleBottomSheetGrid(final ChargingShareBean chargingShareBean) {
|
|
511
|
final int TAG_SHARE_WECHAT_FRIEND = 0;
|
|
512
|
final int TAG_SHARE_WECHAT_MOMENT = 1;
|
|
513
|
final int TAG_SHARE_QQ = 2;
|
|
514
|
QMUIBottomSheet.BottomGridSheetBuilder builder = new QMUIBottomSheet.BottomGridSheetBuilder(activity);
|
|
515
|
QMUIBottomSheet build = builder.addItem(R.drawable.icon_share_wechat, "微信", TAG_SHARE_WECHAT_FRIEND, QMUIBottomSheet.BottomGridSheetBuilder.FIRST_LINE)
|
|
516
|
.addItem(R.drawable.icon_share_wechatquan, "朋友圈", TAG_SHARE_WECHAT_MOMENT, QMUIBottomSheet.BottomGridSheetBuilder.FIRST_LINE)
|
|
517
|
.addItem(R.drawable.icon_share_qq, "QQ", TAG_SHARE_QQ, QMUIBottomSheet.BottomGridSheetBuilder.FIRST_LINE)
|
|
518
|
.setOnSheetItemClickListener(new QMUIBottomSheet.BottomGridSheetBuilder.OnSheetItemClickListener() {
|
|
519
|
@Override
|
|
520
|
public void onClick(QMUIBottomSheet dialog, View itemView) {
|
|
521
|
dialog.dismiss();
|
|
522
|
int tag = (int) itemView.getTag();
|
|
523
|
switch (tag) {
|
|
524
|
case TAG_SHARE_WECHAT_FRIEND:
|
|
525
|
share(Wechat.NAME, chargingShareBean);
|
|
526
|
break;
|
|
527
|
case TAG_SHARE_WECHAT_MOMENT:
|
|
528
|
share(WechatMoments.NAME, chargingShareBean);
|
|
529
|
break;
|
|
530
|
case TAG_SHARE_QQ:
|
|
531
|
share(QQ.NAME, chargingShareBean);
|
|
532
|
break;
|
|
533
|
}
|
|
534
|
}
|
|
535
|
}).build();
|
|
536
|
// build.
|
|
537
|
build.show();
|
|
538
|
}
|
|
539
|
|
|
540
|
|
|
541
|
private void share(final String name, ChargingShareBean chargingShareBean) {
|
|
542
|
Platform.ShareParams paramsToShare = new Platform.ShareParams();
|
|
543
|
paramsToShare.setText(chargingShareBean.getText());
|
|
544
|
paramsToShare.setTitle(chargingShareBean.getTitle());
|
|
545
|
paramsToShare.setTitleUrl(chargingShareBean.getUrl());
|
|
546
|
paramsToShare.setUrl(chargingShareBean.getUrl());
|
|
547
|
paramsToShare.setImageUrl(chargingShareBean.getIcon());
|
|
548
|
paramsToShare.setShareType(Platform.SHARE_WEBPAGE);
|
|
549
|
Platform platform = ShareSDK.getPlatform(name);
|
|
550
|
platform.setPlatformActionListener(new PlatformActionListener() {
|
|
551
|
@Override
|
|
552
|
public void onComplete(Platform platform, int i, HashMap<String, Object> hashMap) {
|
|
553
|
if (MainApplication.isLogin()) {
|
|
554
|
getShareIntegral();
|
|
555
|
}
|
|
556
|
}
|
|
557
|
|
|
558
|
@Override
|
|
559
|
public void onError(Platform platform, int i, Throwable throwable) {
|
|
560
|
LogUtils.e(throwable.getMessage());
|
|
561
|
}
|
|
562
|
|
|
563
|
@Override
|
|
564
|
public void onCancel(Platform platform, int i) {
|
|
565
|
}
|
|
566
|
});
|
|
567
|
platform.share(paramsToShare);
|
|
568
|
}
|
|
569
|
|
|
570
|
private void getShareIntegral() {
|
|
571
|
String url = MainApplication.url + "/zhannew/basic/web/index.php/member/insert-task?userid=" + MainApplication.userId;
|
|
572
|
OkHttpUtils.get().url(url).build().execute(new StringCallback() {
|
|
573
|
@Override
|
|
574
|
public void onError(Call call, Exception e) {
|
|
575
|
|
|
576
|
}
|
|
577
|
|
|
578
|
@Override
|
|
579
|
public void onResponse(String response) {
|
|
580
|
String rtnCode = JsonUtils.getKeyResult(response, "rtnCode");
|
|
581
|
if (rtnCode.equals("01")) {
|
|
582
|
}
|
|
583
|
}
|
|
584
|
});
|
|
585
|
}
|
|
586
|
|
|
587
|
|
465
|
588
|
|
466
|
589
|
public void onDestroy() {
|
467
|
590
|
if (upVideoView2 != null) {
|