Browse Source

modift like

1145873331@qq.com 6 years ago
parent
commit
c0604e5315

+ 32 - 4
app/src/main/java/com/electric/chargingpile/fragment/SvVideoShowView.java

14
import android.widget.TextView;
14
import android.widget.TextView;
15
import android.widget.Toast;
15
import android.widget.Toast;
16
16
17
import com.blankj.utilcode.util.ToastUtils;
17
import com.bumptech.glide.Glide;
18
import com.bumptech.glide.Glide;
18
import com.bumptech.glide.request.RequestOptions;
19
import com.bumptech.glide.request.RequestOptions;
19
import com.electric.chargingpile.R;
20
import com.electric.chargingpile.R;
167
168
168
    }
169
    }
169
170
170
    private void likeRequest(int targetType, int targetId, final int likeFlag, int authorId) {
171
    private void likeRequest(final int likeFlag) {
171
        String url = MainApplication.urlNew + "/article/like";
172
        String url = MainApplication.urlNew + "/article/like";
172
        Map<String, String> map = new HashMap<>();
173
        Map<String, String> map = new HashMap<>();
173
        map.put("targetType", targetType + "");
174
        map.put("targetId", targetId + "");
174
        map.put("targetType", talkRecommendBean.targetType + "");
175
        map.put("targetId", talkRecommendBean.targetId + "");
175
        map.put("flag", likeFlag + "");
176
        map.put("flag", likeFlag + "");
176
        map.put("authorId", authorId + "");
177
        map.put("authorId", talkRecommendBean.addUserId + "");
177
        map.put("totalLikeCnt", "1");
178
        map.put("totalLikeCnt", "1");
178
        if (MainApplication.isLogin()) {
179
        if (MainApplication.isLogin()) {
179
            map.put("user_id", MainApplication.userId);
180
            map.put("user_id", MainApplication.userId);
195
                    @Override
196
                    @Override
196
                    public void onResponse(String response) {
197
                    public void onResponse(String response) {
197
                        String rtnCode = JsonUtils.getKeyResult(response, "code");
198
                        String rtnCode = JsonUtils.getKeyResult(response, "code");
199
200
201
202
//                        sv_show_like_ll =view.findViewById(R.id.sv_show_like_ll);
203
                        sv_show_like_img =view.findViewById(R.id.sv_show_like_img);
204
                        ToastUtils.showLong("like没有提供图片");
205
//                        sv_show_like_tv =view.findViewById(R.id.sv_show_like_tv);
198
                        if ("1000".equals(rtnCode)) {
206
                        if ("1000".equals(rtnCode)) {
199
                            if (likeFlag == 1) {
207
                            if (likeFlag == 1) {
208
                                talkRecommendBean.likeNums+=1;
209
                                sv_show_like_tv.setText(""+talkRecommendBean.likeNums);
200
                                //点赞
210
                                //点赞
201
                            } else {
211
                            } else {
212
                                talkRecommendBean.likeNums-=1;
213
                                sv_show_like_tv.setText(""+talkRecommendBean.likeNums);
202
                                //取消赞
214
                                //取消赞
203
                            }
215
                            }
204
                        }
216
                        }
225
        sv_show_tvcon_more.setOnClickListener(this);
237
        sv_show_tvcon_more.setOnClickListener(this);
226
        sv_show_comment_count_ll.setOnClickListener(this);
238
        sv_show_comment_count_ll.setOnClickListener(this);
227
        sv_show_comment_ll.setOnClickListener(this);
239
        sv_show_comment_ll.setOnClickListener(this);
240
        sv_show_forward.setOnClickListener(this);
241
        sv_show_like_ll.setOnClickListener(this);
228
    }
242
    }
229
243
230
    private void initPlayer(View view) {
244
    private void initPlayer(View view) {
325
                videoCommentDialog.getData();
339
                videoCommentDialog.getData();
326
                videoCommentDialog.show();
340
                videoCommentDialog.show();
327
                break;
341
                break;
342
            case R.id.sv_show_forward:
343
                ToastUtils.showLong("我是转发!");
344
                break;
345
            case R.id.sv_show_like_ll:
346
                int likeFlg = talkRecommendBean.likeFlg;
347
                int newLike = 0;
348
                if (likeFlg == 0) {
349
                    newLike = 1;
350
                } else {
351
                    newLike = 0;
352
                }
353
                likeRequest(newLike);
354
                break;
328
            default:
355
            default:
329
                break;
356
                break;
330
        }
357
        }
331
    }
358
    }
332
359
360
333
    public void onDestroy() {
361
    public void onDestroy() {
334
        if (upVideoView2 != null) {
362
        if (upVideoView2 != null) {
335
            upVideoView2.stopPlayback();
363
            upVideoView2.stopPlayback();