|
@ -64,7 +64,6 @@ public class ChatContentCommentListDialogFragment extends DialogFragment impleme
|
64
|
64
|
private ConstraintLayout loadingView;
|
65
|
65
|
private CommentAdapter commentAdapter;
|
66
|
66
|
private ConstraintLayout noDataView;
|
67
|
|
public String type;
|
68
|
67
|
|
69
|
68
|
public static ChatContentCommentListDialogFragment newInstance(ChatRecommendBean bean) {
|
70
|
69
|
Bundle args = new Bundle();
|
|
@ -181,7 +180,11 @@ public class ChatContentCommentListDialogFragment extends DialogFragment impleme
|
181
|
180
|
}
|
182
|
181
|
|
183
|
182
|
@Override
|
184
|
|
public void reply(String content) {
|
|
183
|
public void updateReply(String reply) {
|
|
184
|
}
|
|
185
|
|
|
186
|
@Override
|
|
187
|
public void reply() {
|
185
|
188
|
|
186
|
189
|
}
|
187
|
190
|
});
|
|
@ -234,6 +237,9 @@ public class ChatContentCommentListDialogFragment extends DialogFragment impleme
|
234
|
237
|
if (chatContentCommentListDialogFragmentListener != null) {
|
235
|
238
|
chatContentCommentListDialogFragmentListener.updateCommentNum(chatRecommendBean.commentNums);
|
236
|
239
|
}
|
|
240
|
|
|
241
|
bCommentContent.setText("");
|
|
242
|
bPublish.setTextColor(Color.parseColor("#7e7e7e"));
|
237
|
243
|
} else if ("8010".equals(code)) {
|
238
|
244
|
startActivity(new Intent(getActivity().getApplicationContext(), LoginActivity.class));
|
239
|
245
|
ToastUtil.showToast(getContext(), desc, Toast.LENGTH_SHORT);
|
|
@ -320,6 +326,7 @@ public class ChatContentCommentListDialogFragment extends DialogFragment impleme
|
320
|
326
|
|
321
|
327
|
private class CommentHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
322
|
328
|
private CommentBean bean;
|
|
329
|
private String replyContent = "";
|
323
|
330
|
private int position;
|
324
|
331
|
private TextView content;
|
325
|
332
|
private ImageView headImage;
|
|
@ -370,12 +377,33 @@ public class ChatContentCommentListDialogFragment extends DialogFragment impleme
|
370
|
377
|
doLike();
|
371
|
378
|
break;
|
372
|
379
|
case R.id.replyInfo: // 点击查看回复列表
|
|
380
|
|
373
|
381
|
break;
|
374
|
382
|
case R.id.deleteComment: // 删除评论操作
|
375
|
383
|
deleteComment();
|
376
|
384
|
break;
|
377
|
385
|
case R.id.listItemView: // 回复
|
|
386
|
CommonDialogFragment commonDialogFragment = CommonDialogFragment.newInstance(replyContent, "@" + bean.nickNameFromUser, CommonDialogFragment.DialogTypeReply);
|
|
387
|
commonDialogFragment.show(getChildFragmentManager(), "CommonDialogFragment");
|
|
388
|
commonDialogFragment.setOnCommonDialogFragmentListener(new CommonDialogFragment.OnCommonDialogFragmentListener() {
|
|
389
|
@Override
|
|
390
|
public void updateComment(String comment) {
|
|
391
|
}
|
378
|
392
|
|
|
393
|
@Override
|
|
394
|
public void publish() {
|
|
395
|
}
|
|
396
|
|
|
397
|
@Override
|
|
398
|
public void updateReply(String reply) {
|
|
399
|
replyContent = reply;
|
|
400
|
}
|
|
401
|
|
|
402
|
@Override
|
|
403
|
public void reply() {
|
|
404
|
publishReply();
|
|
405
|
}
|
|
406
|
});
|
379
|
407
|
break;
|
380
|
408
|
}
|
381
|
409
|
}
|
|
@ -399,6 +427,7 @@ public class ChatContentCommentListDialogFragment extends DialogFragment impleme
|
399
|
427
|
|
400
|
428
|
if (bean.replyNums > 0) {
|
401
|
429
|
replyInfo.setVisibility(View.VISIBLE);
|
|
430
|
replyLabel.setText(bean.replyNums + "回复");
|
402
|
431
|
if (MainApplication.userId.equals(bean.userId + "")) {
|
403
|
432
|
replyAndDeleteView.setVisibility(View.VISIBLE);
|
404
|
433
|
} else {
|
|
@ -407,7 +436,7 @@ public class ChatContentCommentListDialogFragment extends DialogFragment impleme
|
407
|
436
|
}
|
408
|
437
|
} else {
|
409
|
438
|
replyInfo.setVisibility(View.GONE);
|
410
|
|
replyLabel.setText(bean.replyNums + "");
|
|
439
|
replyLabel.setText(bean.replyNums + "回复");
|
411
|
440
|
if (MainApplication.userId.equals(bean.userId + "")) {
|
412
|
441
|
replyAndDeleteView.setVisibility(View.VISIBLE);
|
413
|
442
|
deleteComment.setVisibility(View.VISIBLE);
|
|
@ -510,6 +539,50 @@ public class ChatContentCommentListDialogFragment extends DialogFragment impleme
|
510
|
539
|
});
|
511
|
540
|
}
|
512
|
541
|
|
|
542
|
private void publishReply() {
|
|
543
|
if (!MainApplication.isLogin()) {
|
|
544
|
startActivity(new Intent(getActivity().getApplicationContext(), LoginActivity.class));
|
|
545
|
ToastUtil.showToast(getActivity().getApplicationContext(), "请先登录", Toast.LENGTH_SHORT);
|
|
546
|
return;
|
|
547
|
}
|
|
548
|
|
|
549
|
String url = MainApplication.urlNew + "/topic/comments/publish.do";
|
|
550
|
final Map<String, String> map = new HashMap<>();
|
|
551
|
map.put("targetId", chatRecommendBean.targetId + "");
|
|
552
|
map.put("targetType", chatRecommendBean.targetType + "");
|
|
553
|
map.put("userId", MainApplication.userId );
|
|
554
|
map.put("toUserId", chatRecommendBean.addUserId + "");
|
|
555
|
map.put("level", "2");
|
|
556
|
map.put("content", replyContent);
|
|
557
|
map.put("parentId", bean.id + "");
|
|
558
|
|
|
559
|
CommonParams.addCommonParams(map);
|
|
560
|
|
|
561
|
OkHttpUtils.post().params(map).url(url).build().connTimeOut(6000).readTimeOut(6000).execute(new StringCallback() {
|
|
562
|
@Override
|
|
563
|
public void onError(Call call, Exception e) {
|
|
564
|
ToastUtil.showToast(getContext(), e.getMessage(), Toast.LENGTH_SHORT);
|
|
565
|
}
|
|
566
|
|
|
567
|
@Override
|
|
568
|
public void onResponse(String response) {
|
|
569
|
Log.d(TAG, "onResponse: " + response);
|
|
570
|
String code = JsonUtils.getKeyResult(response, "code");
|
|
571
|
String desc = JsonUtils.getKeyResult(response, "desc");
|
|
572
|
if ("1000".equals(code)) {
|
|
573
|
replyContent = "";
|
|
574
|
bean.replyNums++;
|
|
575
|
commentAdapter.notifyItemChanged(position);
|
|
576
|
} else if ("8010".equals(code)) {
|
|
577
|
startActivity(new Intent(getActivity().getApplicationContext(), LoginActivity.class));
|
|
578
|
ToastUtil.showToast(getContext(), desc, Toast.LENGTH_SHORT);
|
|
579
|
} else {
|
|
580
|
ToastUtil.showToast(getContext(), desc, Toast.LENGTH_SHORT);
|
|
581
|
}
|
|
582
|
}
|
|
583
|
});
|
|
584
|
}
|
|
585
|
|
513
|
586
|
}
|
514
|
587
|
|
515
|
588
|
private class CommentAdapter extends RecyclerView.Adapter<CommentHolder> {
|