浏览代码

motify comment style

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

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

39
39
40
40
41
    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,
42
            sv_show_comment_ll, sv_show_topic;
42
            sv_show_comment_ll;
43
    private TextView sv_show_comment_count_tv, sv_show_like_tv, sv_show_tvcon,
43
    private TextView sv_show_comment_count_tv, sv_show_like_tv, sv_show_tvcon,
44
            sv_show_user_name, sv_show_user_time, sv_show_topic_con;
44
            sv_show_user_name, sv_show_user_time, sv_show_topic_con;
45
    private ImageView sv_show_like_img, sv_show_user_avatar;
45
    private ImageView sv_show_like_img, sv_show_user_avatar;
62
        if (targetType == 23) {
62
        if (targetType == 23) {
63
            view = LayoutInflater.from(activity).inflate(R.layout.view_show_view, null);
63
            view = LayoutInflater.from(activity).inflate(R.layout.view_show_view, null);
64
            initPlayer(view);
64
            initPlayer(view);
65
        } else if(targetType==24) {
65
        } else if (targetType == 24) {
66
            view = LayoutInflater.from(activity).inflate(R.layout.view_show_zoom, null);
66
            view = LayoutInflater.from(activity).inflate(R.layout.view_show_zoom, null);
67
            initZoomPhoto(view);
67
            initZoomPhoto(view);
68
        }
68
        }
103
103
104
                        Log.e("SvVideoShowView", talkRecommendBean.toString());
104
                        Log.e("SvVideoShowView", talkRecommendBean.toString());
105
105
106
                        Log.e("SvVideoShowView",response);
107
                        Log.e("SvVideoShowView","-----------------------------");
106
                        Log.e("SvVideoShowView", response);
107
                        Log.e("SvVideoShowView", "-----------------------------");
108
                        String rtnCode = JsonUtils.getKeyResult(response, "code");
108
                        String rtnCode = JsonUtils.getKeyResult(response, "code");
109
                        if ("1000".equals(rtnCode)) {
109
                        if ("1000".equals(rtnCode)) {
110
                            String rtnMsg = JsonUtils.getKeyResult(response, "data");
110
                            String rtnMsg = JsonUtils.getKeyResult(response, "data");
113
                            if (qadata != null && qadata.size() > 0) {
113
                            if (qadata != null && qadata.size() > 0) {
114
                                talkRecommendBean = qadata.get(0);
114
                                talkRecommendBean = qadata.get(0);
115
                            }
115
                            }
116
                            talkRecommendBean.isLoaded=true;
116
                            talkRecommendBean.isLoaded = true;
117
                            setData();
117
                            setData();
118
                        }
118
                        }
119
                    }
119
                    }
202
202
203
203
204
    private void initBottom(View view) {
204
    private void initBottom(View view) {
205
        sv_show_topic = view.findViewById(R.id.sv_show_topic);
206
        sv_show_forward = view.findViewById(R.id.sv_show_forward);
205
        sv_show_forward = view.findViewById(R.id.sv_show_forward);
207
        sv_show_comment_count_ll = view.findViewById(R.id.sv_show_comment_count_ll);
206
        sv_show_comment_count_ll = view.findViewById(R.id.sv_show_comment_count_ll);
208
        sv_show_like_ll = view.findViewById(R.id.sv_show_like_ll);
207
        sv_show_like_ll = view.findViewById(R.id.sv_show_like_ll);

+ 30 - 12
app/src/main/java/com/electric/chargingpile/view/VideoCommentDialog.java

45
    private View showCommentClose;
45
    private View showCommentClose;
46
    private RecyclerView showCommentLv;
46
    private RecyclerView showCommentLv;
47
    private EditText showCommentEd;
47
    private EditText showCommentEd;
48
    private TextView showCommentPublish;
48
    private TextView showCommentPublish, show_comment_no;
49
    private TalkRecommendBean talkRecommendBean;
49
    private TalkRecommendBean talkRecommendBean;
50
    private LinearLayout show_comment_progress_ll, show_comment_network_ll;
50
51
51
    private VideoCommentAdapter videoCommentAdapter;
52
    private VideoCommentAdapter videoCommentAdapter;
52
53
101
                .execute(new StringCallback() {
102
                .execute(new StringCallback() {
102
                    @Override
103
                    @Override
103
                    public void onError(Call call, Exception e) {
104
                    public void onError(Call call, Exception e) {
104
                        if (commentId == 0) {
105
106
                        } else {
107
                            ToastUtil.showToast(context, "请求失败,请重试", Toast.LENGTH_SHORT);
108
                        }
105
                        show_comment_progress_ll.setVisibility(View.GONE);
106
                        show_comment_network_ll.setVisibility(View.VISIBLE);
109
                    }
107
                    }
110
108
111
                    @Override
109
                    @Override
112
                    public void onResponse(String response) {
110
                    public void onResponse(String response) {
111
113
                        String rtnCode = JsonUtils.getKeyResult(response, "code");
112
                        String rtnCode = JsonUtils.getKeyResult(response, "code");
114
                        if ("1000".equals(rtnCode)) {
113
                        if ("1000".equals(rtnCode)) {
115
                            String rtnMsg = JsonUtils.getKeyResult(response, "data");
114
                            String rtnMsg = JsonUtils.getKeyResult(response, "data");
118
                                if (commentId == 0) {
117
                                if (commentId == 0) {
119
                                    videoCommentAdapter.cleanData();
118
                                    videoCommentAdapter.cleanData();
120
                                }
119
                                }
121
                                videoCommentAdapter.addData(qadata);
120
                                if (qadata.size() == 0) {
121
                                    show_comment_no.setVisibility(View.VISIBLE);
122
                                } else {
123
                                    videoCommentAdapter.addData(qadata);
124
                                }
122
                            }
125
                            }
123
                        }
126
                        }
127
                        show_comment_progress_ll.setVisibility(View.GONE);
124
                    }
128
                    }
125
                });
129
                });
126
    }
130
    }
128
132
129
    private void initView(View convertView) {
133
    private void initView(View convertView) {
130
134
131
        showCommentTitle = (TextView) convertView.findViewById(R.id.show_comment_title);
132
        showCommentClose = (View) convertView.findViewById(R.id.show_comment_close);
133
        showCommentLv = (RecyclerView) convertView.findViewById(R.id.show_comment_etwork_llv);
134
        showCommentEd = (EditText) convertView.findViewById(R.id.show_comment_ed);
135
        showCommentPublish = (TextView) convertView.findViewById(R.id.show_comment_publish);
135
        show_comment_no = convertView.findViewById(R.id.show_comment_no);
136
        show_comment_progress_ll = convertView.findViewById(R.id.show_comment_progress_ll);
137
        show_comment_network_ll = convertView.findViewById(R.id.show_comment_network_letwork_ll);
138
139
        showCommentTitle = convertView.findViewById(R.id.show_comment_title);
140
        showCommentClose = convertView.findViewById(R.id.show_comment_close);
141
        showCommentLv = convertView.findViewById(R.id.show_comment_lv);
142
        showCommentEd = convertView.findViewById(R.id.show_comment_ed);
143
        showCommentPublish = convertView.findViewById(R.id.show_comment_publish);
144
        convertView.findViewById(R.id.show_comment_network_retry).setOnClickListener(this);
145
        show_comment_progress_ll.setVisibility(View.VISIBLE);
136
        showCommentPublish.addTextChangedListener(new TextWatcher() {
146
        showCommentPublish.addTextChangedListener(new TextWatcher() {
137
            @Override
147
            @Override
138
            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
148
            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
175
                publishComment(commentCon, talkRecommendBean.targetId, talkRecommendBean.targetType,
185
                publishComment(commentCon, talkRecommendBean.targetId, talkRecommendBean.targetType,
176
                        "0", "0", 1, "0");
186
                        "0", "0", 1, "0");
177
                break;
187
                break;
188
            case R.id.show_comment_network_retry:
189
                show_comment_progress_ll.setVisibility(View.VISIBLE);
190
                show_comment_network_ll.setVisibility(View.GONE);
191
                setComment(talkRecommendBean.targetType, talkRecommendBean.targetId, 0);
192
                break;
178
            default:
193
            default:
179
                break;
194
                break;
180
        }
195
        }
207
                    @Override
222
                    @Override
208
                    public void onError(Call call, Exception e) {
223
                    public void onError(Call call, Exception e) {
209
                        ToastUtil.showToast(context, "请求失败,请重试", Toast.LENGTH_SHORT);
224
                        ToastUtil.showToast(context, "请求失败,请重试", Toast.LENGTH_SHORT);
225
210
                    }
226
                    }
211
227
212
                    @Override
228
                    @Override
219
                            if (videoCommentAdapter != null) {
235
                            if (videoCommentAdapter != null) {
220
                                if (qadata.size() > 0) {
236
                                if (qadata.size() > 0) {
221
                                    showCommentTitle.setText("全部评论 " + qadata.size());
237
                                    showCommentTitle.setText("全部评论 " + qadata.size());
238
                                } else {
239
                                    show_comment_no.setVisibility(View.VISIBLE);
222
                                }
240
                                }
223
241
224
                                videoCommentAdapter.addData(qadata);
242
                                videoCommentAdapter.addData(qadata);

+ 7 - 0
app/src/main/res/drawable/bg_write_stroke.xml

1
<?xml version="1.0" encoding="utf-8"?>
2
<shape xmlns:android="http://schemas.android.com/apk/res/android">
3
    <corners android:radius="100dp" />
4
    <stroke
5
        android:width="1dp"
6
        android:color="#979797" />
7
</shape>

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

5
        android:id="@+id/sv_show_bottom"
5
        android:id="@+id/sv_show_bottom"
6
        android:layout_width="match_parent"
6
        android:layout_width="match_parent"
7
        android:layout_height="50dp"
7
        android:layout_height="50dp"
8
        android:layout_alignParentBottom="true"
9
        android:background="#000">
8
        android:layout_alignParentBottom="true">
10
9
11
        <LinearLayout
10
        <LinearLayout
12
            android:id="@+id/sv_show_forward"
11
            android:id="@+id/sv_show_forward"
126
        android:layout_height="30dp"
125
        android:layout_height="30dp"
127
        android:layout_above="@+id/sv_show_bottom"
126
        android:layout_above="@+id/sv_show_bottom"
128
        android:layout_alignParentEnd="true"
127
        android:layout_alignParentEnd="true"
129
        android:padding="8dp"
130
        android:layout_marginBottom="28dp"
128
        android:layout_marginBottom="28dp"
129
        android:padding="8dp"
131
        android:src="@drawable/icon_expend" />
130
        android:src="@drawable/icon_expend" />
132
131
133
    <RelativeLayout
132
    <RelativeLayout

+ 76 - 6
app/src/main/res/layout/view_show_comment.xml

21
        android:layout_height="40dp"
21
        android:layout_height="40dp"
22
        android:layout_alignParentEnd="true"
22
        android:layout_alignParentEnd="true"
23
        android:padding="6dp"
23
        android:padding="6dp"
24
        android:src="@drawable/icon_close"  />
24
        android:src="@drawable/icon_close" />
25
25
26
    <View
26
    <View
27
        android:layout_width="match_parent"
27
        android:layout_width="match_parent"
32
    <android.support.v7.widget.RecyclerView
32
    <android.support.v7.widget.RecyclerView
33
        android:id="@+id/show_comment_lv"
33
        android:id="@+id/show_comment_lv"
34
        android:layout_width="wrap_content"
34
        android:layout_width="wrap_content"
35
        android:layout_height="320dp"
36
        android:layout_marginBottom="54dp"
37
        android:layout_marginTop="40dp" />
35
        android:layout_height="300dp"
36
        android:layout_marginTop="40dp"
37
        android:layout_marginBottom="54dp" />
38
39
    <TextView
40
        android:id="@+id/show_comment_no"
41
        android:layout_width="wrap_content"
42
        android:layout_height="wrap_content"
43
        android:layout_centerHorizontal="true"
44
        android:layout_marginTop="160dp"
45
        android:text="还没有评论哦,快去抢沙发"
46
        android:textColor="#fff"
47
        android:textSize="14sp"
48
        android:visibility="gone" />
49
50
    <LinearLayout
51
        android:id="@+id/show_comment_network_ll"
52
        android:layout_width="wrap_content"
53
        android:layout_height="wrap_content"
54
        android:layout_centerHorizontal="true"
55
        android:layout_marginTop="150dp"
56
        android:gravity="center_horizontal"
57
        android:orientation="vertical"
58
        android:visibility="gone">
59
60
        <TextView
61
            android:layout_width="wrap_content"
62
            android:layout_height="wrap_content"
63
            android:text="网络跑调了,请检查网络~"
64
            android:textColor="#fff"
65
            android:textSize="14sp" />
66
67
        <TextView
68
            android:id="@+id/show_comment_network_retry"
69
            android:layout_width="123dp"
70
            android:layout_height="40dp"
71
            android:layout_marginTop="14dp"
72
            android:background="@drawable/bg_write_stroke"
73
            android:gravity="center"
74
            android:text="点击重试"
75
            android:textColor="#fff"
76
            android:textSize="14sp" />
77
    </LinearLayout>
78
79
80
    <LinearLayout
81
        android:id="@+id/show_comment_progress_ll"
82
        android:layout_width="wrap_content"
83
        android:layout_height="wrap_content"
84
        android:layout_centerHorizontal="true"
85
        android:layout_marginTop="150dp"
86
        android:gravity="center_horizontal"
87
        android:orientation="vertical"
88
        android:visibility="gone">
89
90
        <TextView
91
            android:layout_width="123dp"
92
            android:layout_height="40dp"
93
            android:background="@drawable/bg_write_stroke"
94
            android:gravity="center"
95
            android:textColor="#fff"
96
            android:textSize="14sp" />
97
98
        <TextView
99
            android:layout_width="wrap_content"
100
            android:layout_height="wrap_content"
101
            android:layout_marginTop="14dp"
102
            android:text="加载中,请稍后..."
103
            android:textColor="#fff"
104
            android:textSize="14sp" />
105
106
    </LinearLayout>
107
38
108
39
    <LinearLayout
109
    <LinearLayout
40
        android:layout_width="match_parent"
110
        android:layout_width="match_parent"
41
        android:layout_height="wrap_content"
111
        android:layout_height="wrap_content"
42
        android:layout_below="@+id/show_comment_lv"
112
        android:layout_below="@+id/show_comment_lv"
43
        android:background="#535353"
44
        android:layout_marginTop="-54dp"
113
        android:layout_marginTop="-54dp"
114
        android:background="#535353"
45
        android:gravity="center_vertical"
115
        android:gravity="center_vertical"
46
        android:minHeight="54dp">
116
        android:minHeight="54dp">
47
117
53
            android:layout_weight="1"
123
            android:layout_weight="1"
54
            android:background="@drawable/bg_comment_report"
124
            android:background="@drawable/bg_comment_report"
55
            android:hint="写评论"
125
            android:hint="写评论"
56
            android:minHeight="30dp"
57
            android:maxLength="200"
126
            android:maxLength="200"
127
            android:minHeight="30dp"
58
            android:paddingStart="14dp"
128
            android:paddingStart="14dp"
59
            android:paddingEnd="14dp"
129
            android:paddingEnd="14dp"
60
            android:textColor="#fff"
130
            android:textColor="#fff"