|
@ -31,7 +31,6 @@ import com.squareup.picasso.Picasso;
|
31
|
31
|
import com.zhy.http.okhttp.OkHttpUtils;
|
32
|
32
|
import com.zhy.http.okhttp.callback.StringCallback;
|
33
|
33
|
|
34
|
|
import java.util.ArrayList;
|
35
|
34
|
import java.util.HashMap;
|
36
|
35
|
import java.util.List;
|
37
|
36
|
import java.util.Map;
|
|
@ -69,16 +68,18 @@ public class SvVideoShowView implements View.OnClickListener {
|
69
|
68
|
public void setInfo(TalkRecommendBean talkRecommendBean) {
|
70
|
69
|
this.talkRecommendBean = talkRecommendBean;
|
71
|
70
|
int targetType = talkRecommendBean.targetType;
|
72
|
|
if (targetType == 23) {
|
73
|
|
view = LayoutInflater.from(activity).inflate(R.layout.view_show_view, null);
|
74
|
|
initPlayer(view);
|
75
|
|
} else if (targetType == 24) {
|
76
|
|
view = LayoutInflater.from(activity).inflate(R.layout.view_show_zoom, null);
|
77
|
|
initZoomPhoto(view);
|
|
71
|
if (view == null) {
|
|
72
|
if (targetType == 23) {
|
|
73
|
view = LayoutInflater.from(activity).inflate(R.layout.view_show_view, null);
|
|
74
|
initPlayer(view);
|
|
75
|
} else if (targetType == 24) {
|
|
76
|
view = LayoutInflater.from(activity).inflate(R.layout.view_show_zoom, null);
|
|
77
|
initZoomPhoto(view);
|
|
78
|
}
|
|
79
|
initBottom(view);
|
|
80
|
viewGroup.addView(view);
|
78
|
81
|
}
|
79
|
|
initBottom(view);
|
80
|
82
|
getDate();
|
81
|
|
viewGroup.addView(view);
|
82
|
83
|
}
|
83
|
84
|
|
84
|
85
|
public void getDate() {
|
|
@ -151,11 +152,6 @@ public class SvVideoShowView implements View.OnClickListener {
|
151
|
152
|
.into(sv_show_user_avatar);
|
152
|
153
|
}
|
153
|
154
|
|
154
|
|
// if (talkRecommendBean.targetType == 23) {
|
155
|
|
// initAndPlay();
|
156
|
|
// } else if (talkRecommendBean.targetType == 24) {
|
157
|
|
//
|
158
|
|
// }
|
159
|
155
|
|
160
|
156
|
if (talkRecommendBean.likeFlg == 1) {
|
161
|
157
|
// sv_show_like_img like
|
|
@ -168,9 +164,6 @@ public class SvVideoShowView implements View.OnClickListener {
|
168
|
164
|
} else {
|
169
|
165
|
sv_show_tvcon_more.setVisibility(View.GONE);
|
170
|
166
|
}
|
171
|
|
// private ImageView , ;
|
172
|
|
|
173
|
|
// private View ;
|
174
|
167
|
|
175
|
168
|
}
|
176
|
169
|
|
|
@ -239,16 +232,10 @@ public class SvVideoShowView implements View.OnClickListener {
|
239
|
232
|
|
240
|
233
|
ZoomingViewpager zoomingViewpager;
|
241
|
234
|
ImageAdapter imageAdapter = new ImageAdapter();
|
242
|
|
List<String> picList = new ArrayList<>();
|
243
|
235
|
|
244
|
236
|
private void initZoomPhoto(View view) {
|
245
|
|
if (picList.size() == 0) {
|
246
|
|
picList.add("https://r1.ykimg.com/050E0000534CA44167379F055B0BB00E");
|
247
|
|
picList.add("https://r1.ykimg.com/050E00005C877F89ADA7B2E385018E98");
|
248
|
|
picList.add("https://r1.ykimg.com/050E00005C9200D5859B5D5E9C0A6520");
|
249
|
|
}
|
250
|
237
|
vd_title_tv = view.findViewById(R.id.vd_title_tv);
|
251
|
|
vd_title_tv.setText("0/" + picList.size());
|
|
238
|
vd_title_tv.setText("1/" + talkRecommendBean.imgUrls.size());
|
252
|
239
|
|
253
|
240
|
zoomingViewpager = view.findViewById(R.id.view_show_zoomingphoto);
|
254
|
241
|
zoomingViewpager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
|
@ -259,7 +246,8 @@ public class SvVideoShowView implements View.OnClickListener {
|
259
|
246
|
|
260
|
247
|
@Override
|
261
|
248
|
public void onPageSelected(int position) {
|
262
|
|
vd_title_tv.setText(position + "/" + picList.size());
|
|
249
|
String indexTxt = (position + 1) + "/" + talkRecommendBean.imgUrls.size();
|
|
250
|
vd_title_tv.setText(indexTxt);
|
263
|
251
|
}
|
264
|
252
|
|
265
|
253
|
@Override
|
|
@ -275,7 +263,7 @@ public class SvVideoShowView implements View.OnClickListener {
|
275
|
263
|
|
276
|
264
|
@Override
|
277
|
265
|
public int getCount() {
|
278
|
|
return picList != null ? picList.size() : 0;
|
|
266
|
return talkRecommendBean.imgUrls != null ? talkRecommendBean.imgUrls.size() : 0;
|
279
|
267
|
}
|
280
|
268
|
|
281
|
269
|
@Override
|
|
@ -288,7 +276,7 @@ public class SvVideoShowView implements View.OnClickListener {
|
288
|
276
|
PhotoView photoView = new PhotoView(container.getContext());
|
289
|
277
|
Glide
|
290
|
278
|
.with(activity)
|
291
|
|
.load(picList.get(position))
|
|
279
|
.load(talkRecommendBean.imgUrls.get(position))
|
292
|
280
|
.apply(new RequestOptions().fitCenter())
|
293
|
281
|
.into(photoView); // Now just add PhotoView to ViewPager and return it
|
294
|
282
|
container.addView(photoView, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
|
|
@ -312,11 +300,15 @@ public class SvVideoShowView implements View.OnClickListener {
|
312
|
300
|
}
|
313
|
301
|
|
314
|
302
|
public void initAndPlay() {
|
315
|
|
if (upVideoView2 != null && !TextUtils.isEmpty(talkRecommendBean.videoUrl)) {
|
316
|
|
String videoUrl = talkRecommendBean.videoUrl;
|
317
|
|
Log.d("SvVideoShowView", "play");
|
318
|
|
upVideoView2.setVideoPath(videoUrl);
|
319
|
|
upVideoView2.start();
|
|
303
|
if (talkRecommendBean.targetType == 24) {
|
|
304
|
imageAdapter.notifyDataSetChanged();
|
|
305
|
} else {
|
|
306
|
if (upVideoView2 != null && !TextUtils.isEmpty(talkRecommendBean.videoUrl)) {
|
|
307
|
String videoUrl = talkRecommendBean.videoUrl;
|
|
308
|
Log.d("SvVideoShowView", "play");
|
|
309
|
upVideoView2.setVideoPath(videoUrl);
|
|
310
|
upVideoView2.start();
|
|
311
|
}
|
320
|
312
|
}
|
321
|
313
|
}
|
322
|
314
|
|