dxh 5 years ago
parent
commit
ecf7857ad8

+ 20 - 5
app/src/main/java/com/electric/chargingpile/fragment/SvVideoShowView.java

@ -36,7 +36,6 @@ import com.electric.chargingpile.view.VideoCommentDialog;
36 36
import com.electric.chargingpile.view.VideoPubilshDialog;
37 37
import com.electric.chargingpile.widge.photoview.PhotoView;
38 38
import com.electric.chargingpile.widge.photoview.ZoomingViewpager;
39
import com.mabeijianxi.smallvideorecord2.Log;
40 39
import com.qmuiteam.qmui.widget.dialog.QMUIBottomSheet;
41 40
import com.squareup.picasso.Picasso;
42 41
import com.zhy.http.okhttp.OkHttpUtils;
@ -44,6 +43,7 @@ import com.zhy.http.okhttp.callback.StringCallback;
44 43
45 44
import java.math.RoundingMode;
46 45
import java.text.NumberFormat;
46
import java.util.ArrayList;
47 47
import java.util.HashMap;
48 48
import java.util.List;
49 49
import java.util.Map;
@ -349,10 +349,24 @@ public class SvVideoShowView implements View.OnClickListener {
349 349
    }
350 350
351 351
    class ImageAdapter extends PagerAdapter {
352
        List<String> imageList = new ArrayList<>();
353
354
        public void addData(List<String> imageUrl) {
355
            imageList.clear();
356
            if (imageUrl != null) {
357
                imageList.addAll(imageUrl);
358
            }
359
            notifyDataSetChanged();
360
        }
361
362
        @Override
363
        public int getItemPosition(Object object) {
364
            return POSITION_NONE;
365
        }
352 366
353 367
        @Override
354 368
        public int getCount() {
355
            return talkRecommendBean.imgUrls != null ? talkRecommendBean.imgUrls.size() : 0;
369
            return imageList.size();
356 370
        }
357 371
358 372
        @Override
@ -365,7 +379,7 @@ public class SvVideoShowView implements View.OnClickListener {
365 379
            PhotoView photoView = new PhotoView(container.getContext());
366 380
            Glide
367 381
                    .with(activity)
368
                    .load(talkRecommendBean.imgUrls.get(position))
382
                    .load(imageList.get(position))
369 383
                    .apply(new RequestOptions().fitCenter())
370 384
                    .into(photoView);            // Now just add PhotoView to ViewPager and return it
371 385
            container.addView(photoView, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
@ -401,14 +415,15 @@ public class SvVideoShowView implements View.OnClickListener {
401 415
        }
402 416
403 417
        sv_show_tvcon.setText(talkRecommendBean.title);
418
404 419
    }
405 420
406 421
407 422
    public void initAndPlay() {
408 423
        if (talkRecommendBean.targetType == 24) {
409 424
            String s = talkRecommendBean.imgUrls.toString();
410
            LogUtils.d("demo 11",s);
411
            imageAdapter.notifyDataSetChanged();
425
            LogUtils.d("demo 11", s);
426
            imageAdapter.addData(talkRecommendBean.imgUrls);
412 427
        } else {
413 428
            if (upVideoView2 != null && !TextUtils.isEmpty(talkRecommendBean.videoUrl)) {
414 429
                String videoUrl = talkRecommendBean.videoUrl;