dxh 5 years ago
parent
commit
e5cb4bede4

+ 38 - 25
app/src/main/java/com/electric/chargingpile/fragment/SvVideoShowView.java

5
import android.support.v4.view.PagerAdapter;
5
import android.support.v4.view.PagerAdapter;
6
import android.support.v4.view.ViewPager;
6
import android.support.v4.view.ViewPager;
7
import android.text.TextUtils;
7
import android.text.TextUtils;
8
import android.util.Log;
9
import android.view.LayoutInflater;
8
import android.view.LayoutInflater;
10
import android.view.MotionEvent;
9
import android.view.MotionEvent;
11
import android.view.View;
10
import android.view.View;
86
    }
85
    }
87
86
88
    public void setInfo(TalkRecommendBean talkRecommendBean) {
87
    public void setInfo(TalkRecommendBean talkRecommendBean) {
89
        this.talkRecommendBean = talkRecommendBean;
90
        int targetType = talkRecommendBean.targetType;
91
        if (view == null) {
92
            if (targetType == 23) {
93
                view = LayoutInflater.from(activity).inflate(R.layout.view_show_view, null);
94
                initPlayer(view);
95
96
            } else if (targetType == 24) {
97
                view = LayoutInflater.from(activity).inflate(R.layout.view_show_zoom, null);
98
                initZoomPhoto(view);
99
            }
100
            initBottom(view);
101
            viewGroup.addView(view);
88
        if (viewGroup != null) {
89
            this.talkRecommendBean = talkRecommendBean;
90
            int targetType = talkRecommendBean.targetType;
91
            if (view == null) {
92
                if (targetType == 23) {
93
                    view = LayoutInflater.from(activity).inflate(R.layout.view_show_view, null);
94
                    initPlayer(view);
95
96
                } else if (targetType == 24) {
97
                    view = LayoutInflater.from(activity).inflate(R.layout.view_show_zoom, null);
98
                    initZoomPhoto(view);
99
                }
100
                initBottom(view);
101
                viewGroup.addView(view);
102
102
103
            setData();
103
                setData();
104
            }
104
        }
105
        }
105
    }
106
    }
106
107
163
    private void setData() {
164
    private void setData() {
164
        sv_show_comment_count_tv.setText(num4(talkRecommendBean.commentNums));
165
        sv_show_comment_count_tv.setText(num4(talkRecommendBean.commentNums));
165
        sv_show_like_tv.setText(num4(talkRecommendBean.likeNums));
166
        sv_show_like_tv.setText(num4(talkRecommendBean.likeNums));
166
        sv_show_tvcon.setText(talkRecommendBean.content);
167
        sv_show_tvcon.setText(talkRecommendBean.title);
168
        sv_show_user_name.setText(talkRecommendBean.nickName);
167
        sv_show_user_name.setText(talkRecommendBean.nickName);
169
        String time = "" + talkRecommendBean.addTime;
168
        String time = "" + talkRecommendBean.addTime;
170
        sv_show_user_time.setText(time);
169
        sv_show_user_time.setText(time);
198
        } else {
197
        } else {
199
            // sv_show_like_img  not like
198
            // sv_show_like_img  not like
200
        }
199
        }
201
        int length = sv_show_tvcon.length();
202
        Log.e("length", "setData: length: " + length);
203
        if (sv_show_tvcon.getLineCount() >= 3 && sv_show_tvcon.getText().length() > 100) {
204
            sv_show_tvcon_more.setVisibility(View.VISIBLE);
205
        } else {
206
            sv_show_tvcon_more.setVisibility(View.GONE);
207
        }
208
    }
200
    }
209
201
210
202
391
    }
383
    }
392
384
393
    public void updateView() {
385
    public void updateView() {
394
//        ToastUtil.showToast(activity, "updateView", Toast.LENGTH_LONG);
386
        String title = talkRecommendBean.title;
387
        if (TextUtils.isEmpty(title)) {
388
            sv_show_tvcon_more.setVisibility(View.GONE);
389
        } else {
390
            int length = title.length();
391
            if (length > 100) {
392
                sv_show_tvcon.setMaxLines(3);
393
                sv_show_tvcon.setEllipsize(TextUtils.TruncateAt.END);
394
                sv_show_tvcon_more.setVisibility(View.VISIBLE);
395
                sv_show_tvcon.setText(talkRecommendBean.title);
396
397
            } else {
398
                sv_show_tvcon_more.setVisibility(View.GONE);
399
400
                sv_show_tvcon.setMaxLines(100);
401
            }
402
403
        }
404
395
    }
405
    }
396
406
397
    public void initAndPlay() {
407
    public void initAndPlay() {
512
                                chargingShareBean.setIcon(talkRecommendBean.coverImgUrl);
522
                                chargingShareBean.setIcon(talkRecommendBean.coverImgUrl);
513
                                chargingShareBean.setTitle(talkRecommendBean.title);
523
                                chargingShareBean.setTitle(talkRecommendBean.title);
514
                                chargingShareBean.setUrl(shareUrl);
524
                                chargingShareBean.setUrl(shareUrl);
525
                                showSimpleBottomSheetGrid(chargingShareBean);
515
                            }
526
                            }
527
                        } else {
528
                            ToastUtil.showToast(activity, "获取分享信息失败,请重试", Toast.LENGTH_SHORT);
516
                        }
529
                        }
517
                    }
530
                    }
518
                });
531
                });

+ 0 - 2
app/src/main/res/layout/view_show_bottom.xml

123
        android:layout_marginRight="39dp"
123
        android:layout_marginRight="39dp"
124
        android:layout_marginBottom="23dp"
124
        android:layout_marginBottom="23dp"
125
        android:textColor="#E2E2E2"
125
        android:textColor="#E2E2E2"
126
        android:ellipsize="end"
127
        android:maxLines="3"
128
        android:textSize="14sp" />
126
        android:textSize="14sp" />
129
127
130
    <ImageView
128
    <ImageView