浏览代码

add topic details http request

1145873331@qq.com 6 年之前
父节点
当前提交
05b76f50ac

+ 0 - 4
app/src/main/java/com/electric/chargingpile/activity/TalkActivity.java

88
        isRefresh = true;
88
        isRefresh = true;
89
        MobclickAgent.onEvent(getApplicationContext(),"0071");
89
        MobclickAgent.onEvent(getApplicationContext(),"0071");
90
        setBackground(0);
90
        setBackground(0);
91
92
93
        VideoCommentDialog videoPubilshDialog = new VideoCommentDialog(this);
94
        videoPubilshDialog.show();
95
    }
91
    }
96
92
97
    private void initViews(){
93
    private void initViews(){

+ 24 - 9
app/src/main/java/com/electric/chargingpile/activity/VideoDetaislActivity.java

24
    private SvVideoPagerAdapter viewPagerAdapter;
24
    private SvVideoPagerAdapter viewPagerAdapter;
25
    private SvVideoShowView videoShowView;
25
    private SvVideoShowView videoShowView;
26
26
27
    private boolean isFirst = true, isChange = false;
28
27
    private MyHandler mHandler = new MyHandler(this);
29
    private MyHandler mHandler = new MyHandler(this);
28
30
29
31
32
33
    int position = 0;
34
    List<TalkRecommendBean> talkRecommendBeans;
35
36
37
30
    static class MyHandler extends Handler {
38
    static class MyHandler extends Handler {
31
        private WeakReference<VideoDetaislActivity> mWeakReference;
39
        private WeakReference<VideoDetaislActivity> mWeakReference;
32
40
58
66
59
            @Override
67
            @Override
60
            public void onPageSelected(int position) {
68
            public void onPageSelected(int position) {
61
69
                if (!isChange) {
70
                    isChange = true;
71
                }
62
            }
72
            }
63
73
64
            @Override
74
            @Override
65
            public void onPageScrollStateChanged(int state) {
75
            public void onPageScrollStateChanged(int state) {
76
                if (state == ViewPager.SCROLL_STATE_IDLE && isChange) {
77
                    isChange = false;
78
                    if (videoShowView != null) {
79
                        videoShowView.onDestroy();
80
                    }
81
                    initPlayByPostion(talkRecommendBeans, pager_video.getCurrentItem(), false);
82
                }
66
83
67
            }
84
            }
68
        });
85
        });
78
            case R.id.vd_title_dot:
95
            case R.id.vd_title_dot:
79
                break;
96
                break;
80
            case R.id.vd_title_back:
97
            case R.id.vd_title_back:
81
                VideoPubilshDialog videoPubilshDialog = new VideoPubilshDialog(this);
82
                videoPubilshDialog.show();
98
                finish();
83
                break;
99
                break;
84
        }
100
        }
85
    }
101
    }
86
102
87
88
    int position = 0;
89
    List<TalkRecommendBean> talkRecommendBeans;
90
91
    private void addIntentInfo() {
103
    private void addIntentInfo() {
92
        position = getIntent().getIntExtra("pos", 0);
104
        position = getIntent().getIntExtra("pos", 0);
93
        talkRecommendBeans = (List<TalkRecommendBean>) getIntent().getSerializableExtra("list");
105
        talkRecommendBeans = (List<TalkRecommendBean>) getIntent().getSerializableExtra("list");
96
        viewPagerAdapter.setInitViewListener(new SvVideoPagerAdapter.InitViewListener() {
108
        viewPagerAdapter.setInitViewListener(new SvVideoPagerAdapter.InitViewListener() {
97
            @Override
109
            @Override
98
            public void initFirstViewAfter() {
110
            public void initFirstViewAfter() {
99
                initPlayByPostion(talkRecommendBeans, position, true);
111
                if (isFirst) {
112
                    isFirst = false;
113
                    initPlayByPostion(talkRecommendBeans, position, true);
114
                }
100
            }
115
            }
101
        });
116
        });
102
    }
117
    }
113
                            videoShowView.setInfo(videoInfos.get(position));
128
                            videoShowView.setInfo(videoInfos.get(position));
114
                        }
129
                        }
115
                    }
130
                    }
116
                    videoShowView.updateView();
131
                    videoShowView.updateView(position, videoInfos.get(position));
117
                    videoShowView.initAndPlay();
132
                    videoShowView.initAndPlay();
118
                }
133
                }
119
            }, 100);
134
            }, 100);

+ 21 - 11
app/src/main/java/com/electric/chargingpile/adapter/VideoCommentAdapter.java

12
import com.bumptech.glide.Glide;
12
import com.bumptech.glide.Glide;
13
import com.bumptech.glide.request.RequestOptions;
13
import com.bumptech.glide.request.RequestOptions;
14
import com.electric.chargingpile.R;
14
import com.electric.chargingpile.R;
15
import com.electric.chargingpile.application.MainApplication;
15
import com.electric.chargingpile.base.RecyclerViewHolder;
16
import com.electric.chargingpile.base.RecyclerViewHolder;
16
import com.electric.chargingpile.data.FindData;
17
import com.electric.chargingpile.data.FindData;
17
import com.electric.chargingpile.data.VideoCommentBean;
18
import com.electric.chargingpile.data.VideoCommentBean;
40
    @Override
41
    @Override
41
    public void onBindViewHolder(@NonNull VideoCommentViewHolder viewHolder, int position) {
42
    public void onBindViewHolder(@NonNull VideoCommentViewHolder viewHolder, int position) {
42
        VideoCommentBean videoCommentBean = dataList.get(position);
43
        VideoCommentBean videoCommentBean = dataList.get(position);
43
        int likeFlg = videoCommentBean.getLikeFlg();
44
        int likeFlg = videoCommentBean.likeFlg;
44
        if (likeFlg == 0) {
45
        if (likeFlg == 0) {
45
            //not zan
46
            //not zan
46
//            viewHolder.mItemUserLikeImg = (ImageView) itemView.findViewById(R.id.item_user_like_img);
47
//            viewHolder.mItemUserLikeImg = (ImageView) itemView.findViewById(R.id.item_user_like_img);
48
            // zan
49
            // zan
49
        }
50
        }
50
51
51
        viewHolder.mItemUserLikeCount.setText(videoCommentBean.getLikeNums() + "");
52
        viewHolder.mItemUserLikeCount.setText(videoCommentBean.likeNums + "");
52
53
53
54
54
        Glide.with(context).load(videoCommentBean.getHeadImgFromUser())
55
        Glide.with(context).load(videoCommentBean.headImgFromUser)
55
                .transition(withCrossFade()).into(viewHolder.mItemUserAvatar);
56
                .transition(withCrossFade()).into(viewHolder.mItemUserAvatar);
56
57
57
        viewHolder.mItemUserName.setText(videoCommentBean.getNickNameFromUser());
58
        viewHolder.mItemUserName.setText(videoCommentBean.nickNameFromUser);
58
59
59
        viewHolder.mItemUserTime.setText(videoCommentBean.getAddDate());
60
        viewHolder.mItemUserCon.setText(videoCommentBean.getContent());
60
        viewHolder.mItemUserTime.setText(videoCommentBean.addDate + "");
61
        viewHolder.mItemUserCon.setText(videoCommentBean.content);
61
62
62
//        viewHolder.mItemUserOperation = (LinearLayout) itemView.findViewById(R.id.item_user_operation);
63
//        viewHolder.mItemUserOperation = (LinearLayout) itemView.findViewById(R.id.item_user_operation);
63
//        viewHolder.mItemUserReportLl = (LinearLayout) itemView.findViewById(R.id.item_user_report_ll);
64
        viewHolder.mItemUserReportCount.setText(videoCommentBean.getReplyNums() + "");
65
//        viewHolder.mItemUserDelete = (TextView) itemView.findViewById(R.id.item_user_delete);
66
64
        if (videoCommentBean.replyNums > 0) {
65
            viewHolder.mItemUserReportLl.setVisibility(View.VISIBLE);
66
            viewHolder.mItemUserReportCount.setText(videoCommentBean.replyNums + "");
67
        } else {
68
            viewHolder.mItemUserReportLl.setVisibility(View.GONE);
69
        }
70
        if (MainApplication.isLogin()) {
71
            if (videoCommentBean.userId.equals(MainApplication.userId)) {
72
                viewHolder.mItemUserDelete.setVisibility(View.VISIBLE);
73
            } else {
74
                viewHolder.mItemUserDelete.setVisibility(View.VISIBLE);
75
            }
76
        }
67
77
68
    }
78
    }
69
79
76
86
77
    }
87
    }
78
88
79
    public void addData(ArrayList<VideoCommentBean> qadata) {
89
    public void addData(List<VideoCommentBean> qadata) {
80
        if (qadata != null) {
90
        if (qadata != null) {
81
            dataList.addAll(qadata);
91
            dataList.addAll(qadata);
82
        }
92
        }

+ 9 - 22
app/src/main/java/com/electric/chargingpile/data/TalkRecommendBean.java

3
import java.io.Serializable;
3
import java.io.Serializable;
4
4
5
public class TalkRecommendBean implements Serializable {
5
public class TalkRecommendBean implements Serializable {
6
//     "targetId": 4,
6
    //     "targetId": 4,
7
//             "targetType": 23,
7
//             "targetType": 23,
8
//             "title": "这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件",
8
//             "title": "这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件",
9
//             "topicId": 1,
9
//             "topicId": 1,
22
    public int targetType;
22
    public int targetType;
23
    public String title;
23
    public String title;
24
    public String name;
24
    public String name;
25
    public long addTime;
25
    public int topicId;
26
    public int topicId;
26
    public int joinNums;
27
    public int joinNums;
27
    public String coverImgUrl;
28
    public String coverImgUrl;
28
    public String headImgUrl;
29
    public String headImgUrl;
29
    public String nickName;
30
    public String nickName;
31
    public String topicName;
32
    public String content;
33
    public String shareUrl;
30
    public int likeNums;
34
    public int likeNums;
35
    public int source;
36
    public String videoUrl;
31
    public int commentNums;
37
    public int commentNums;
32
    public int isTop;
38
    public int isTop;
33
    public int likeFlg;
39
    public int likeFlg;
34
    public int source;
40
    public boolean isLoaded = false;
41
35
42
36
    @Override
37
    public String toString() {
38
        return "TalkRecommendBean{" +
39
                "targetId=" + targetId +
40
                ", addUserId=" + addUserId +
41
                ", targetType=" + targetType +
42
                ", title='" + title + '\'' +
43
                ", name='" + name + '\'' +
44
                ", topicId=" + topicId +
45
                ", joinNums=" + joinNums +
46
                ", coverImgUrl='" + coverImgUrl + '\'' +
47
                ", headImgUrl='" + headImgUrl + '\'' +
48
                ", nickName='" + nickName + '\'' +
49
                ", likeNums=" + likeNums +
50
                ", commentNums=" + commentNums +
51
                ", isTop=" + isTop +
52
                ", likeFlg=" + likeFlg +
53
                ", source=" + source +
54
                '}';
55
    }
56
}
43
}

+ 20 - 171
app/src/main/java/com/electric/chargingpile/data/VideoCommentBean.java

5
 */
5
 */
6
6
7
public class VideoCommentBean {
7
public class VideoCommentBean {
8
    private String targetId = "";
9
    private int targetType;
10
    private int level;
11
    private String userId = "";
12
    private String nickNameFromUser = "";
13
    private String headImgFromUser = "";
14
    private String toUserId = "";
15
    private String nickNameToUser = "";
16
    private String headImgToUser = "";
17
    private String content = "";
18
    private int likeNums;
19
    private int likeFlg;
20
    private String addDate;
21
    private String commentsId;
22
    private String commentsId2;
8
    public long targetId ;
9
    public int targetType;
10
    public int level;
11
    public String userId ;
12
    public String nickNameFromUser ;
13
    public String headImgFromUser ;
14
    public String toUserId ;
15
    public String nickNameToUser ;
16
    public String headImgToUser ;
17
    public String content ;
18
    public int likeNums;
19
    public int likeFlg;
20
    public long addDate;
21
    public String commentsId;
22
    public String commentsId2;
23
24
    public String userId2;
25
    public String nickName2;
26
    public String content2;
27
    public int replyNums;
23
28
24
    private String userId2;
25
    private String nickName2;
26
    private String content2;
27
    private String replyNums;
28
29
    public String getTargetId() {
30
        return targetId;
31
    }
32
33
    public void setTargetId(String targetId) {
34
        this.targetId = targetId;
35
    }
36
37
    public int getTargetType() {
38
        return targetType;
39
    }
40
41
    public void setTargetType(int targetType) {
42
        this.targetType = targetType;
43
    }
44
45
    public int getLevel() {
46
        return level;
47
    }
48
49
    public void setLevel(int level) {
50
        this.level = level;
51
    }
52
53
    public String getUserId() {
54
        return userId;
55
    }
56
57
    public void setUserId(String userId) {
58
        this.userId = userId;
59
    }
60
61
    public String getNickNameFromUser() {
62
        return nickNameFromUser;
63
    }
64
65
    public void setNickNameFromUser(String nickNameFromUser) {
66
        this.nickNameFromUser = nickNameFromUser;
67
    }
68
69
    public String getHeadImgFromUser() {
70
        return headImgFromUser;
71
    }
72
73
    public void setHeadImgFromUser(String headImgFromUser) {
74
        this.headImgFromUser = headImgFromUser;
75
    }
76
77
    public String getToUserId() {
78
        return toUserId;
79
    }
80
81
    public void setToUserId(String toUserId) {
82
        this.toUserId = toUserId;
83
    }
84
85
    public String getNickNameToUser() {
86
        return nickNameToUser;
87
    }
88
89
    public void setNickNameToUser(String nickNameToUser) {
90
        this.nickNameToUser = nickNameToUser;
91
    }
92
93
    public String getHeadImgToUser() {
94
        return headImgToUser;
95
    }
96
97
    public void setHeadImgToUser(String headImgToUser) {
98
        this.headImgToUser = headImgToUser;
99
    }
100
101
    public String getContent() {
102
        return content;
103
    }
104
105
    public void setContent(String content) {
106
        this.content = content;
107
    }
108
109
    public int getLikeNums() {
110
        return likeNums;
111
    }
112
113
    public void setLikeNums(int likeNums) {
114
        this.likeNums = likeNums;
115
    }
116
117
    public int getLikeFlg() {
118
        return likeFlg;
119
    }
120
121
    public void setLikeFlg(int likeFlg) {
122
        this.likeFlg = likeFlg;
123
    }
124
125
    public String getAddDate() {
126
        return addDate;
127
    }
128
129
    public void setAddDate(String addDate) {
130
        this.addDate = addDate;
131
    }
132
133
    public String getCommentsId() {
134
        return commentsId;
135
    }
136
137
    public void setCommentsId(String commentsId) {
138
        this.commentsId = commentsId;
139
    }
140
141
    public String getCommentsId2() {
142
        return commentsId2;
143
    }
144
145
    public void setCommentsId2(String commentsId2) {
146
        this.commentsId2 = commentsId2;
147
    }
148
149
    public String getUserId2() {
150
        return userId2;
151
    }
152
153
    public void setUserId2(String userId2) {
154
        this.userId2 = userId2;
155
    }
156
157
    public String getNickName2() {
158
        return nickName2;
159
    }
160
161
    public void setNickName2(String nickName2) {
162
        this.nickName2 = nickName2;
163
    }
164
165
    public String getContent2() {
166
        return content2;
167
    }
168
169
    public void setContent2(String content2) {
170
        this.content2 = content2;
171
    }
172
173
    public String getReplyNums() {
174
        return replyNums;
175
    }
176
177
    public void setReplyNums(String replyNums) {
178
        this.replyNums = replyNums;
179
    }
180
}
29
}

+ 0 - 37
app/src/main/java/com/electric/chargingpile/data/VideoDetailsBean.java

1
package com.electric.chargingpile.data;
2
3
/**
4
 * Created by Demon on 16/11/22.
5
 */
6
7
public class VideoDetailsBean {
8
    private String targetId ="";
9
    private int targetType;
10
    private String videoUrl ="";
11
    private String coverImgUrl ="";
12
    private String authorName ="";
13
    private String authorHeadImg ="";
14
    private String authorId ="";
15
    private String title ="";
16
    private String publishDate_s ="";
17
    private String h5Url ="";
18
    private int likeNums;
19
20
    private int likeFlg;
21
    private int feedFlg;
22
    private int commentsNums;
23
    private int visitTimes;
24
25
    private int picsVos;
26
27
28
29
30
    public class Video{
31
32
    }
33
34
    public class Pic{
35
36
    }
37
}

+ 96 - 11
app/src/main/java/com/electric/chargingpile/fragment/SvVideoShowView.java

1
package com.electric.chargingpile.fragment;
1
package com.electric.chargingpile.fragment;
2
2
3
import android.app.Activity;
3
import android.app.Activity;
4
import android.text.TextUtils;
5
import android.util.Log;
4
import android.view.LayoutInflater;
6
import android.view.LayoutInflater;
5
import android.view.View;
7
import android.view.View;
6
import android.view.ViewGroup;
8
import android.view.ViewGroup;
12
import com.electric.chargingpile.R;
14
import com.electric.chargingpile.R;
13
import com.electric.chargingpile.application.MainApplication;
15
import com.electric.chargingpile.application.MainApplication;
14
import com.electric.chargingpile.data.TalkRecommendBean;
16
import com.electric.chargingpile.data.TalkRecommendBean;
15
import com.electric.chargingpile.data.VideoDetailsBean;
17
import com.electric.chargingpile.util.CircleTransform;
16
import com.electric.chargingpile.util.JsonUtils;
18
import com.electric.chargingpile.util.JsonUtils;
17
import com.electric.chargingpile.util.ToastUtil;
19
import com.electric.chargingpile.util.ToastUtil;
20
import com.electric.chargingpile.view.VideoCommentDialog;
21
import com.electric.chargingpile.view.VideoPubilshDialog;
22
import com.squareup.picasso.Picasso;
18
import com.zhy.http.okhttp.OkHttpUtils;
23
import com.zhy.http.okhttp.OkHttpUtils;
19
import com.zhy.http.okhttp.callback.StringCallback;
24
import com.zhy.http.okhttp.callback.StringCallback;
20
25
21
import java.util.HashMap;
26
import java.util.HashMap;
27
import java.util.List;
22
import java.util.Map;
28
import java.util.Map;
23
29
24
import okhttp3.Call;
30
import okhttp3.Call;
25
31
26
public class SvVideoShowView {
32
public class SvVideoShowView implements View.OnClickListener {
27
33
28
    private Activity activity;
34
    private Activity activity;
29
    private OnDeleteVideoListener listener;
35
    private OnDeleteVideoListener listener;
30
    private View view;
36
    private View view;
31
    private ViewGroup viewGroup;
37
    private ViewGroup viewGroup;
38
    private TalkRecommendBean talkRecommendBean;
32
39
33
40
34
    private LinearLayout sv_show_forward, sv_show_comment_count_ll, sv_show_like_ll,
41
    private LinearLayout sv_show_forward, sv_show_comment_count_ll, sv_show_like_ll,
50
    }
57
    }
51
58
52
    public void setInfo(TalkRecommendBean talkRecommendBean) {
59
    public void setInfo(TalkRecommendBean talkRecommendBean) {
60
        this.talkRecommendBean = talkRecommendBean;
53
        int targetType = talkRecommendBean.targetType;
61
        int targetType = talkRecommendBean.targetType;
54
        if (targetType == 1) {
62
        if (targetType == 23) {
55
            view = LayoutInflater.from(activity).inflate(R.layout.view_show_view, null);
63
            view = LayoutInflater.from(activity).inflate(R.layout.view_show_view, null);
56
            initPlayer(view);
64
            initPlayer(view);
57
        } else {
65
        } else if(targetType==24) {
58
            view = LayoutInflater.from(activity).inflate(R.layout.view_show_zoom, null);
66
            view = LayoutInflater.from(activity).inflate(R.layout.view_show_zoom, null);
59
            initZoomPhoto(view);
67
            initZoomPhoto(view);
60
        }
68
        }
61
        initBottom(view);
69
        initBottom(view);
62
        viewGroup.addView(view);
70
        viewGroup.addView(view);
63
        requestHeaderData(targetType, talkRecommendBean.targetId);
71
        if (talkRecommendBean.isLoaded) {
72
            setData();
73
        } else {
74
            requestHeaderData(targetType, talkRecommendBean.targetId);
75
        }
64
    }
76
    }
65
77
66
    private void requestHeaderData(int targetType, long targetId) {
78
    private void requestHeaderData(int targetType, long targetId) {
67
        String url = MainApplication.urlNew + "/article/detail";
79
        String url = MainApplication.urlNew + "/topic/detail.do";
68
        Map<String, String> map = new HashMap<>();
80
        Map<String, String> map = new HashMap<>();
69
        map.put("targetType", targetType + "");
81
        map.put("targetType", targetType + "");
70
        map.put("targetId", targetId + "");
82
        map.put("targetId", targetId + "");
83
        map.put("limit", "1");
71
        if (MainApplication.isLogin()) {
84
        if (MainApplication.isLogin()) {
72
            map.put("user_id", MainApplication.userId);
85
            map.put("user_id", MainApplication.userId);
73
        }
86
        }
87
100
88
                    @Override
101
                    @Override
89
                    public void onResponse(String response) {
102
                    public void onResponse(String response) {
103
104
                        Log.e("SvVideoShowView", talkRecommendBean.toString());
105
106
                        Log.e("SvVideoShowView",response);
107
                        Log.e("SvVideoShowView","-----------------------------");
90
                        String rtnCode = JsonUtils.getKeyResult(response, "code");
108
                        String rtnCode = JsonUtils.getKeyResult(response, "code");
91
                        if ("1000".equals(rtnCode)) {
109
                        if ("1000".equals(rtnCode)) {
92
                            String rtnMsg = JsonUtils.getKeyResult(response, "data");
110
                            String rtnMsg = JsonUtils.getKeyResult(response, "data");
93
                            VideoDetailsBean qadata = (VideoDetailsBean) JsonUtils
94
                                    .parseToObjectList(rtnMsg, VideoDetailsBean.class);
95
                            setData(qadata);
111
                            List<TalkRecommendBean> qadata = JsonUtils
112
                                    .parseToObjectList(rtnMsg, TalkRecommendBean.class);
113
                            if (qadata != null && qadata.size() > 0) {
114
                                talkRecommendBean = qadata.get(0);
115
                            }
116
                            talkRecommendBean.isLoaded=true;
117
                            setData();
96
                        }
118
                        }
97
                    }
119
                    }
98
                });
120
                });
99
    }
121
    }
100
122
101
    private void setData(VideoDetailsBean qadata) {
123
    private void setData() {
124
        sv_show_comment_count_tv.setText(talkRecommendBean.commentNums + "");
125
        sv_show_like_tv.setText(talkRecommendBean.likeNums + "");
126
        sv_show_tvcon.setText(talkRecommendBean.content);
127
        sv_show_user_name.setText(talkRecommendBean.nickName);
128
        sv_show_user_time.setText("" + talkRecommendBean.addTime);
129
        sv_show_topic_con.setText(talkRecommendBean.topicName);
130
131
        if (TextUtils.isEmpty(talkRecommendBean.headImgUrl)) {
132
            Picasso.with(activity)
133
                    .load(R.drawable.icon_face2_0)
134
                    .placeholder(R.drawable.icon_face2_0)
135
                    .error(R.drawable.icon_face2_0)
136
                    .transform(new CircleTransform())
137
                    .into(sv_show_user_avatar);
138
        } else {
139
            Picasso.with(activity)
140
                    .load(talkRecommendBean.headImgUrl)
141
                    .placeholder(R.drawable.icon_face2_0)
142
                    .error(R.drawable.icon_face2_0)
143
                    .transform(new CircleTransform())
144
                    .into(sv_show_user_avatar);
145
        }
146
147
        if (talkRecommendBean.likeFlg == 1) {
148
//            sv_show_like_img  like
149
        } else {
150
            // sv_show_like_img  not like
151
        }
152
153
        if (sv_show_tvcon.getLineCount() >= 3) {
154
            sv_show_tvcon_more.setVisibility(View.VISIBLE);
155
        } else {
156
            sv_show_tvcon_more.setVisibility(View.GONE);
157
        }
158
//        private ImageView , ;
159
160
//        private View ;
102
161
103
    }
162
    }
104
163
158
        sv_show_user_name = view.findViewById(R.id.sv_show_user_name);
217
        sv_show_user_name = view.findViewById(R.id.sv_show_user_name);
159
        sv_show_user_time = view.findViewById(R.id.sv_show_user_time);
218
        sv_show_user_time = view.findViewById(R.id.sv_show_user_time);
160
        sv_show_topic_con = view.findViewById(R.id.sv_show_topic_con);
219
        sv_show_topic_con = view.findViewById(R.id.sv_show_topic_con);
220
        sv_show_tvcon_more.setOnClickListener(this);
221
        sv_show_comment_count_ll.setOnClickListener(this);
161
    }
222
    }
162
223
163
    private void initPlayer(View view) {
224
    private void initPlayer(View view) {
173
        return view;
234
        return view;
174
    }
235
    }
175
236
176
    public void updateView() {
237
    public void updateView(int position, TalkRecommendBean talkRecommendBean) {
238
        int targetType = talkRecommendBean.targetType;
239
        long targetId = talkRecommendBean.targetId;
240
177
    }
241
    }
178
242
179
    public void initAndPlay() {
243
    public void initAndPlay() {
180
    }
244
    }
181
245
246
    @Override
247
    public void onClick(View view) {
248
        switch (view.getId()) {
249
            case R.id.sv_show_tvcon_more:
250
                new VideoPubilshDialog(activity, talkRecommendBean).show();
251
                break;
252
            case R.id.sv_show_comment_count_ll:
253
                VideoCommentDialog videoCommentDialog = new VideoCommentDialog(activity, talkRecommendBean);
254
                videoCommentDialog.getData();
255
                videoCommentDialog.show();
256
                break;
257
            default:
258
                break;
259
        }
260
    }
261
262
    public void onDestroy() {
263
264
//释放播放资源
265
    }
266
182
267
183
    public interface OnDeleteVideoListener {
268
    public interface OnDeleteVideoListener {
184
        void onDelete();
269
        void onDelete();

+ 2 - 1
app/src/main/java/com/electric/chargingpile/fragment/TalkRecommendFragment.java

237
                String rtnCode = JsonUtils.getKeyResult(response, "code");
237
                String rtnCode = JsonUtils.getKeyResult(response, "code");
238
                if ("1000".equals(rtnCode)) {
238
                if ("1000".equals(rtnCode)) {
239
                    String rtnMsg = JsonUtils.getKeyResult(response, "data");
239
                    String rtnMsg = JsonUtils.getKeyResult(response, "data");
240
                    ArrayList<TalkRecommendBean> qadata = (ArrayList<TalkRecommendBean>) JsonUtils.parseToObjectList(rtnMsg, TalkRecommendBean.class);
240
                    ArrayList<TalkRecommendBean> qadata = (ArrayList<TalkRecommendBean>)
241
                            JsonUtils.parseToObjectList(rtnMsg, TalkRecommendBean.class);
241
                    layoutAdapter.setHeaderData(qadata);
242
                    layoutAdapter.setHeaderData(qadata);
242
                    requestData();
243
                    requestData();
243
                }
244
                }

+ 43 - 7
app/src/main/java/com/electric/chargingpile/view/VideoCommentDialog.java

2
2
3
import android.app.Dialog;
3
import android.app.Dialog;
4
import android.content.Context;
4
import android.content.Context;
5
import android.graphics.Color;
5
import android.os.Bundle;
6
import android.os.Bundle;
6
import android.support.v7.widget.RecyclerView;
7
import android.support.v7.widget.RecyclerView;
8
import android.text.Editable;
7
import android.text.TextUtils;
9
import android.text.TextUtils;
10
import android.text.TextWatcher;
8
import android.view.Gravity;
11
import android.view.Gravity;
12
import android.view.KeyEvent;
9
import android.view.LayoutInflater;
13
import android.view.LayoutInflater;
10
import android.view.View;
14
import android.view.View;
11
import android.view.Window;
15
import android.view.Window;
29
33
30
import java.util.ArrayList;
34
import java.util.ArrayList;
31
import java.util.HashMap;
35
import java.util.HashMap;
36
import java.util.List;
32
import java.util.Map;
37
import java.util.Map;
33
38
34
import okhttp3.Call;
39
import okhttp3.Call;
41
    private RecyclerView showCommentLv;
46
    private RecyclerView showCommentLv;
42
    private EditText showCommentEd;
47
    private EditText showCommentEd;
43
    private TextView showCommentPublish;
48
    private TextView showCommentPublish;
49
    private TalkRecommendBean talkRecommendBean;
44
50
45
    private VideoCommentAdapter videoCommentAdapter;
51
    private VideoCommentAdapter videoCommentAdapter;
46
52
47
53
48
    public VideoCommentDialog(Context context) {
54
    public VideoCommentDialog(Context context, TalkRecommendBean talkRecommendBean) {
49
        super(context, R.style.bottomDialogStyle);
55
        super(context, R.style.bottomDialogStyle);
50
        this.context = context;
56
        this.context = context;
57
        this.talkRecommendBean = talkRecommendBean;
51
    }
58
    }
52
59
53
60
68
75
69
    }
76
    }
70
77
71
    public void setComment(int targetType, int targetId, final int commentId) {
78
    public void getData() {
79
        setComment(talkRecommendBean.targetType, talkRecommendBean.targetId, 0);
80
    }
81
82
    public void setComment(int targetType, long targetId, final int commentId) {
72
83
73
        String url = MainApplication.urlNew + "/article/like";
84
        String url = MainApplication.urlNew + "/topic/comments/list.do";
74
        Map<String, String> map = new HashMap<>();
85
        Map<String, String> map = new HashMap<>();
75
        map.put("targetType", targetType + "");
86
        map.put("targetType", targetType + "");
76
        map.put("targetId", targetId + "");
87
        map.put("targetId", targetId + "");
122
        showCommentLv = (RecyclerView) convertView.findViewById(R.id.show_comment_lv);
133
        showCommentLv = (RecyclerView) convertView.findViewById(R.id.show_comment_lv);
123
        showCommentEd = (EditText) convertView.findViewById(R.id.show_comment_ed);
134
        showCommentEd = (EditText) convertView.findViewById(R.id.show_comment_ed);
124
        showCommentPublish = (TextView) convertView.findViewById(R.id.show_comment_publish);
135
        showCommentPublish = (TextView) convertView.findViewById(R.id.show_comment_publish);
136
        showCommentPublish.addTextChangedListener(new TextWatcher() {
137
            @Override
138
            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
139
140
            }
141
142
            @Override
143
            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
144
                if (i2 > 0) {
145
                    showCommentPublish.setTextColor(Color.parseColor("#00edb2"));
146
                } else {
147
                    showCommentPublish.setTextColor(Color.parseColor("#7E7E7E"));
148
                }
149
            }
150
151
            @Override
152
            public void afterTextChanged(Editable editable) {
125
153
154
            }
155
        });
126
        videoCommentAdapter = new VideoCommentAdapter(context);
156
        videoCommentAdapter = new VideoCommentAdapter(context);
127
        showCommentLv.setAdapter(videoCommentAdapter);
157
        showCommentLv.setAdapter(videoCommentAdapter);
128
158
142
                    Toast.makeText(context, "请输入评论内容!", Toast.LENGTH_SHORT).show();
172
                    Toast.makeText(context, "请输入评论内容!", Toast.LENGTH_SHORT).show();
143
                    return;
173
                    return;
144
                }
174
                }
145
//                publishComment(commentCon);
175
                publishComment(commentCon, talkRecommendBean.targetId, talkRecommendBean.targetType,
176
                        "0", "0", 1, "0");
146
                break;
177
                break;
147
            default:
178
            default:
148
                break;
179
                break;
149
        }
180
        }
150
    }
181
    }
151
182
152
    private void publishComment(String commentCon, int targetId, int targetType, String toUserId,
183
    private void publishComment(String commentCon, long targetId, int targetType, String toUserId,
153
                                String parentId, int level, String toCommentIds) {
184
                                String parentId, int level, String toCommentIds) {
154
        String url = MainApplication.urlNew + "/comments/publish";
185
        String url = MainApplication.urlNew + "/topic/comments/publish.do";
155
        Map<String, String> map = new HashMap<>();
186
        Map<String, String> map = new HashMap<>();
156
        map.put("targetType", targetType + "");
187
        map.put("targetType", targetType + "");
157
        map.put("targetId", targetId + "");
188
        map.put("targetId", targetId + "");
183
                        String rtnCode = JsonUtils.getKeyResult(response, "code");
214
                        String rtnCode = JsonUtils.getKeyResult(response, "code");
184
                        if ("1000".equals(rtnCode)) {
215
                        if ("1000".equals(rtnCode)) {
185
                            String rtnMsg = JsonUtils.getKeyResult(response, "data");
216
                            String rtnMsg = JsonUtils.getKeyResult(response, "data");
186
                            ArrayList<VideoCommentBean> qadata = (ArrayList<VideoCommentBean>) JsonUtils.parseToObjectList(rtnMsg, VideoCommentBean.class);
217
                            List<VideoCommentBean> qadata = JsonUtils.parseToObjectList(rtnMsg, VideoCommentBean.class);
218
187
                            if (videoCommentAdapter != null) {
219
                            if (videoCommentAdapter != null) {
220
                                if (qadata.size() > 0) {
221
                                    showCommentTitle.setText("全部评论 " + qadata.size());
222
                                }
223
188
                                videoCommentAdapter.addData(qadata);
224
                                videoCommentAdapter.addData(qadata);
189
                            }
225
                            }
190
                        }
226
                        }

+ 41 - 2
app/src/main/java/com/electric/chargingpile/view/VideoPubilshDialog.java

3
import android.app.Dialog;
3
import android.app.Dialog;
4
import android.content.Context;
4
import android.content.Context;
5
import android.os.Bundle;
5
import android.os.Bundle;
6
import android.text.TextUtils;
6
import android.view.Gravity;
7
import android.view.Gravity;
7
import android.view.LayoutInflater;
8
import android.view.LayoutInflater;
8
import android.view.View;
9
import android.view.View;
13
import android.widget.TextView;
14
import android.widget.TextView;
14
15
15
import com.electric.chargingpile.R;
16
import com.electric.chargingpile.R;
17
import com.electric.chargingpile.data.TalkRecommendBean;
18
import com.electric.chargingpile.util.CircleTransform;
19
import com.squareup.picasso.Picasso;
16
20
17
public class VideoPubilshDialog extends Dialog implements View.OnClickListener {
21
public class VideoPubilshDialog extends Dialog implements View.OnClickListener {
18
    private Context context;
22
    private Context context;
23
    private TalkRecommendBean talkRecommendBean;
19
24
20
    public VideoPubilshDialog(Context context) {
25
    public VideoPubilshDialog(Context context, TalkRecommendBean talkRecommendBean) {
21
        super(context, R.style.bottomDialogStyle);
26
        super(context, R.style.bottomDialogStyle);
27
        this.talkRecommendBean = talkRecommendBean;
22
        this.context = context;
28
        this.context = context;
23
    }
29
    }
24
30
27
    private TextView videoPublishTopicCon;
33
    private TextView videoPublishTopicCon;
28
    private LinearLayout videoPublishUserLl;
34
    private LinearLayout videoPublishUserLl;
29
    private ImageView videoPublishUserAvatar;
35
    private ImageView videoPublishUserAvatar;
30
    private TextView videoPublishUserName;
36
    private TextView videoPublishUserName,videoPublishCon;
31
37
32
    @Override
38
    @Override
33
    protected void onCreate(Bundle savedInstanceState) {
39
    protected void onCreate(Bundle savedInstanceState) {
37
        videoPublishClose = inflate.findViewById(R.id.video_publish_close);
43
        videoPublishClose = inflate.findViewById(R.id.video_publish_close);
38
        videoPublishTopic = inflate.findViewById(R.id.video_publish_topic);
44
        videoPublishTopic = inflate.findViewById(R.id.video_publish_topic);
39
        videoPublishTopicCon = inflate.findViewById(R.id.video_publish_topic_con);
45
        videoPublishTopicCon = inflate.findViewById(R.id.video_publish_topic_con);
46
        videoPublishCon = inflate.findViewById(R.id.video_publish_con);
40
        videoPublishUserLl = inflate.findViewById(R.id.video_publish_user_ll);
47
        videoPublishUserLl = inflate.findViewById(R.id.video_publish_user_ll);
41
        videoPublishUserAvatar = inflate.findViewById(R.id.video_publish_user_avatar);
48
        videoPublishUserAvatar = inflate.findViewById(R.id.video_publish_user_avatar);
42
        videoPublishUserName = inflate.findViewById(R.id.video_publish_user_name);
49
        videoPublishUserName = inflate.findViewById(R.id.video_publish_user_name);
43
50
44
        videoPublishClose.setOnClickListener(this);
51
        videoPublishClose.setOnClickListener(this);
45
52
53
54
        videoPublishTopicCon.setText(talkRecommendBean.title);
55
        videoPublishCon.setText(talkRecommendBean.title);
56
57
        if (TextUtils.isEmpty(talkRecommendBean.headImgUrl)) {
58
            Picasso.with(context)
59
                    .load(R.drawable.icon_face2_0)
60
                    .placeholder(R.drawable.icon_face2_0)
61
                    .error(R.drawable.icon_face2_0)
62
                    .transform(new CircleTransform())
63
                    .into(videoPublishUserAvatar);
64
        } else {
65
            Picasso.with(context)
66
                    .load(talkRecommendBean.headImgUrl)
67
                    .placeholder(R.drawable.icon_face2_0)
68
                    .error(R.drawable.icon_face2_0)
69
                    .transform(new CircleTransform())
70
                    .into(videoPublishUserAvatar);
71
        }
72
73
        videoPublishUserName.setText(talkRecommendBean.nickName);
74
//        sv_show_user_time.setText("" + talkRecommendBean.addTime);
75
76
46
        setContentView(inflate);
77
        setContentView(inflate);
47
78
48
79
63
                break;
94
                break;
64
        }
95
        }
65
    }
96
    }
97
98
    @Override
99
    public void show() {
100
        if(talkRecommendBean==null){
101
            return;
102
        }
103
        super.show();
104
    }
66
}
105
}

+ 1 - 1
app/src/main/res/layout/activity_videodetails.xml

2
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:layout_width="match_parent"
3
    android:layout_width="match_parent"
4
    android:layout_height="match_parent"
4
    android:layout_height="match_parent"
5
    android:background="#424242">
5
    android:background="#9FF33C">
6
6
7
7
8
    <com.electric.chargingpile.view.sview.VerticalViewPager
8
    <com.electric.chargingpile.view.sview.VerticalViewPager

+ 3 - 3
app/src/main/res/layout/sv_video_publish_info.xml

12
        android:layout_alignParentEnd="true"
12
        android:layout_alignParentEnd="true"
13
        android:layout_marginTop="14dp"
13
        android:layout_marginTop="14dp"
14
        android:layout_marginEnd="14dp"
14
        android:layout_marginEnd="14dp"
15
        android:background="#fff" />
15
        android:background="@drawable/icon_dialog_close" />
16
16
17
17
18
    <LinearLayout
18
    <LinearLayout
56
        <ImageView
56
        <ImageView
57
            android:id="@+id/video_publish_user_avatar"
57
            android:id="@+id/video_publish_user_avatar"
58
            android:layout_width="20dp"
58
            android:layout_width="20dp"
59
            android:layout_height="20dp"
60
            android:background="#3df" />
59
            android:layout_height="20dp"  />
61
60
62
        <TextView
61
        <TextView
63
            android:id="@+id/video_publish_user_name"
62
            android:id="@+id/video_publish_user_name"
70
    </LinearLayout>
69
    </LinearLayout>
71
70
72
    <TextView
71
    <TextView
72
        android:id="@+id/video_publish_con"
73
        android:layout_width="match_parent"
73
        android:layout_width="match_parent"
74
        android:layout_height="wrap_content"
74
        android:layout_height="wrap_content"
75
        android:layout_below="@+id/video_publish_user_ll"
75
        android:layout_below="@+id/video_publish_user_ll"

+ 6 - 12
app/src/main/res/layout/view_show_bottom.xml

49
                android:id="@+id/sv_show_comment_count_tv"
49
                android:id="@+id/sv_show_comment_count_tv"
50
                android:layout_width="wrap_content"
50
                android:layout_width="wrap_content"
51
                android:layout_height="wrap_content"
51
                android:layout_height="wrap_content"
52
                android:text="1230w"
53
                android:textSize="12sp" />
52
                android:textSize="12sp" />
54
53
55
        </LinearLayout>
54
        </LinearLayout>
74
                android:id="@+id/sv_show_like_tv"
73
                android:id="@+id/sv_show_like_tv"
75
                android:layout_width="wrap_content"
74
                android:layout_width="wrap_content"
76
                android:layout_height="wrap_content"
75
                android:layout_height="wrap_content"
77
                android:text="12我30w"
78
                android:textSize="12sp" />
76
                android:textSize="12sp" />
79
77
80
        </LinearLayout>
78
        </LinearLayout>
121
        android:layout_marginBottom="23dp"
119
        android:layout_marginBottom="23dp"
122
        android:ellipsize="end"
120
        android:ellipsize="end"
123
        android:maxLines="3"
121
        android:maxLines="3"
124
        android:text="3-超出三行的,点击文字,上滑弹窗,显示出所有文字内容,根据内容自适应高度,最高为一半屏幕高度,字数超高,以滚动条滑动显示。3-超出三行的,点击文字,上滑弹窗,显示出所有文字内容,根据内容自适应高度,最高为一半屏幕高度,字数超高,以滚动条滑动显示。"
125
        android:textSize="14sp" />
122
         android:textSize="14sp" />
126
123
127
    <View
124
    <View
128
        android:id="@+id/sv_show_tvcon_more"
125
        android:id="@+id/sv_show_tvcon_more"
131
        android:layout_above="@+id/sv_show_bottom"
128
        android:layout_above="@+id/sv_show_bottom"
132
        android:layout_alignParentEnd="true"
129
        android:layout_alignParentEnd="true"
133
        android:layout_marginBottom="28dp"
130
        android:layout_marginBottom="28dp"
134
        android:background="@color/__picker_black_40" />
131
        android:rotation="90"
132
        android:background="@drawable/ssdk_country_back_arrow" />
135
133
136
    <RelativeLayout
134
    <RelativeLayout
137
        android:id="@+id/sv_show_user_info"
135
        android:id="@+id/sv_show_user_info"
139
        android:layout_height="34dp"
137
        android:layout_height="34dp"
140
        android:layout_above="@+id/sv_show_tvcon"
138
        android:layout_above="@+id/sv_show_tvcon"
141
        android:layout_marginLeft="15dp"
139
        android:layout_marginLeft="15dp"
142
        android:layout_marginBottom="5dp"
143
        android:background="#2ff">
140
        android:layout_marginBottom="5dp">
144
141
145
        <ImageView
142
        <ImageView
146
            android:id="@+id/sv_show_user_avatar"
143
            android:id="@+id/sv_show_user_avatar"
147
            android:layout_width="20dp"
144
            android:layout_width="20dp"
148
            android:layout_height="20dp"
145
            android:layout_height="20dp"
149
            android:layout_centerVertical="true"
150
            android:background="#fff" />
146
            android:layout_centerVertical="true" />
151
147
152
        <TextView
148
        <TextView
153
            android:id="@+id/sv_show_user_name"
149
            android:id="@+id/sv_show_user_name"
170
            android:textSize="12sp" />
166
            android:textSize="12sp" />
171
    </RelativeLayout>
167
    </RelativeLayout>
172
168
173
174
    <LinearLayout
169
    <LinearLayout
175
        android:id="@+id/sv_show_topic"
170
        android:id="@+id/sv_show_topic"
176
        android:layout_width="wrap_content"
171
        android:layout_width="wrap_content"
196
            android:layout_marginRight="12dp"
191
            android:layout_marginRight="12dp"
197
            android:ellipsize="end"
192
            android:ellipsize="end"
198
            android:maxLines="1"
193
            android:maxLines="1"
199
            android:text="显示出所有文字内容显示出所有文字内容显示出所有文字内容显示出所有文字内容显示出所有文字内容显示出所有文字内容显示出所有文字内容"
200
            android:textColor="#fff"
194
             android:textColor="#fff"
201
            android:textSize="11sp" />
195
            android:textSize="11sp" />
202
    </LinearLayout>
196
    </LinearLayout>
203
197

+ 4 - 2
app/src/main/res/layout/view_show_comment.xml

10
        android:layout_height="wrap_content"
10
        android:layout_height="wrap_content"
11
        android:layout_centerHorizontal="true"
11
        android:layout_centerHorizontal="true"
12
        android:layout_marginTop="10dp"
12
        android:layout_marginTop="10dp"
13
        android:text="12sp12sp12sp"
13
        android:text="全部评论"
14
        android:textColor="#c2c2c2"
14
        android:textColor="#c2c2c2"
15
        android:textSize="14sp" />
15
        android:textSize="14sp" />
16
16
22
        android:layout_alignParentEnd="true"
22
        android:layout_alignParentEnd="true"
23
        android:layout_marginTop="9dp"
23
        android:layout_marginTop="9dp"
24
        android:layout_marginEnd="14dp"
24
        android:layout_marginEnd="14dp"
25
        android:background="#fff" />
25
        android:background="@drawable/icon_dialog_close"  />
26
26
27
    <View
27
    <View
28
        android:layout_width="match_parent"
28
        android:layout_width="match_parent"
55
            android:background="@drawable/bg_comment_report"
55
            android:background="@drawable/bg_comment_report"
56
            android:hint="写评论"
56
            android:hint="写评论"
57
            android:minHeight="30dp"
57
            android:minHeight="30dp"
58
            android:maxLength="200"
58
            android:paddingStart="14dp"
59
            android:paddingStart="14dp"
59
            android:paddingEnd="14dp"
60
            android:paddingEnd="14dp"
61
            android:textColor="#fff"
60
            android:textColorHint="#7e7e7e" />
62
            android:textColorHint="#7e7e7e" />
61
63
62
        <TextView
64
        <TextView