dxh 5 years ago
parent
commit
ecf7857ad8

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

36
import com.electric.chargingpile.view.VideoPubilshDialog;
36
import com.electric.chargingpile.view.VideoPubilshDialog;
37
import com.electric.chargingpile.widge.photoview.PhotoView;
37
import com.electric.chargingpile.widge.photoview.PhotoView;
38
import com.electric.chargingpile.widge.photoview.ZoomingViewpager;
38
import com.electric.chargingpile.widge.photoview.ZoomingViewpager;
39
import com.mabeijianxi.smallvideorecord2.Log;
40
import com.qmuiteam.qmui.widget.dialog.QMUIBottomSheet;
39
import com.qmuiteam.qmui.widget.dialog.QMUIBottomSheet;
41
import com.squareup.picasso.Picasso;
40
import com.squareup.picasso.Picasso;
42
import com.zhy.http.okhttp.OkHttpUtils;
41
import com.zhy.http.okhttp.OkHttpUtils;
44
43
45
import java.math.RoundingMode;
44
import java.math.RoundingMode;
46
import java.text.NumberFormat;
45
import java.text.NumberFormat;
46
import java.util.ArrayList;
47
import java.util.HashMap;
47
import java.util.HashMap;
48
import java.util.List;
48
import java.util.List;
49
import java.util.Map;
49
import java.util.Map;
349
    }
349
    }
350
350
351
    class ImageAdapter extends PagerAdapter {
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
        @Override
367
        @Override
354
        public int getCount() {
368
        public int getCount() {
355
            return talkRecommendBean.imgUrls != null ? talkRecommendBean.imgUrls.size() : 0;
369
            return imageList.size();
356
        }
370
        }
357
371
358
        @Override
372
        @Override
365
            PhotoView photoView = new PhotoView(container.getContext());
379
            PhotoView photoView = new PhotoView(container.getContext());
366
            Glide
380
            Glide
367
                    .with(activity)
381
                    .with(activity)
368
                    .load(talkRecommendBean.imgUrls.get(position))
382
                    .load(imageList.get(position))
369
                    .apply(new RequestOptions().fitCenter())
383
                    .apply(new RequestOptions().fitCenter())
370
                    .into(photoView);            // Now just add PhotoView to ViewPager and return it
384
                    .into(photoView);            // Now just add PhotoView to ViewPager and return it
371
            container.addView(photoView, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
385
            container.addView(photoView, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
401
        }
415
        }
402
416
403
        sv_show_tvcon.setText(talkRecommendBean.title);
417
        sv_show_tvcon.setText(talkRecommendBean.title);
418
404
    }
419
    }
405
420
406
421
407
    public void initAndPlay() {
422
    public void initAndPlay() {
408
        if (talkRecommendBean.targetType == 24) {
423
        if (talkRecommendBean.targetType == 24) {
409
            String s = talkRecommendBean.imgUrls.toString();
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
        } else {
427
        } else {
413
            if (upVideoView2 != null && !TextUtils.isEmpty(talkRecommendBean.videoUrl)) {
428
            if (upVideoView2 != null && !TextUtils.isEmpty(talkRecommendBean.videoUrl)) {
414
                String videoUrl = talkRecommendBean.videoUrl;
429
                String videoUrl = talkRecommendBean.videoUrl;