|
@@ -179,7 +179,7 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
|
|
|
public void setHeadViewHolder(BaseHeadViewHolder holder) {
|
|
|
mHolder = holder;
|
|
|
rv.setLayoutManager(new LinearLayoutManager(getContext()));
|
|
|
- adapter = new CommentAdapter(this,null, getParentActivity(), mHolder);
|
|
|
+ adapter = new CommentAdapter(this, null, getParentActivity(), mHolder);
|
|
|
if (newsBean != null) {
|
|
|
adapter.setNewsBean(newsBean);
|
|
|
}
|
|
@@ -327,12 +327,14 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
|
|
|
BackupImageView backupImageView = new BackupImageView(getContext());
|
|
|
backupImageView.setForUserOrChat(UserConfig.getInstance(currentAccount).getCurrentUser(), new AvatarDrawable(UserConfig.getInstance(currentAccount).getCurrentUser()));
|
|
|
Bitmap bitmap = backupImageView.getImageReceiver().getBitmap();
|
|
|
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
|
|
+ if (bitmap != null) {
|
|
|
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
|
|
//该方法用来压缩图片,第一个参数为图片格式,第二个参数为截取图片的保留率,如当前为90,则保留之前图片90%的区域
|
|
|
- bitmap.compress(Bitmap.CompressFormat.JPEG, 90, outputStream);
|
|
|
- byte[] imagebyte = outputStream.toByteArray();
|
|
|
- String toBase64 = Base64Utils.toBase64(imagebyte);
|
|
|
- faceURL = toBase64;
|
|
|
+ bitmap.compress(Bitmap.CompressFormat.JPEG, 90, outputStream);
|
|
|
+ byte[] imagebyte = outputStream.toByteArray();
|
|
|
+ String toBase64 = Base64Utils.toBase64(imagebyte);
|
|
|
+ faceURL = toBase64;
|
|
|
+ }
|
|
|
}
|
|
|
if (multiItem == null) {
|
|
|
MainCommendBean addMainCommendBean = new MainCommendBean(content);
|
|
@@ -793,20 +795,22 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
|
|
|
|
|
|
@Override
|
|
|
public void onDeleteComment(MultiItemEntity o) {
|
|
|
- if (o.getUser_id().equals((UserConfig.getInstance(currentAccount).getCurrentUser().id + ""))) {
|
|
|
- // TODO: 2022/9/8 这里给出一个弹窗确定是否删除评论
|
|
|
- AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
|
|
- builder.setMessage(LocaleController.getString(R.string.delete_comment_tip));
|
|
|
- builder.setPositiveButton(LocaleController.getString(R.string.OK), (dialogInterface, i) -> {
|
|
|
- if (!UserConfig.getInstance(currentAccount).isClientActivated()) {
|
|
|
- presentFragment(new LoginActivity());
|
|
|
- } else {
|
|
|
- long clientUserId = UserConfig.getInstance(currentAccount).getClientUserId();
|
|
|
- presenter.recallComment(clientUserId + "", o.getId(), o);
|
|
|
- }
|
|
|
- });
|
|
|
- builder.setNegativeButton(LocaleController.getString(R.string.Cancel), null);
|
|
|
- showDialog(builder.create());
|
|
|
+ if (UserConfig.getInstance(currentAccount).isClientActivated()) {
|
|
|
+ if (o.getUser_id().equals((UserConfig.getInstance(currentAccount).getCurrentUser().id + ""))) {
|
|
|
+ // TODO: 2022/9/8 这里给出一个弹窗确定是否删除评论
|
|
|
+ AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
|
|
+ builder.setMessage(LocaleController.getString(R.string.delete_comment_tip));
|
|
|
+ builder.setPositiveButton(LocaleController.getString(R.string.OK), (dialogInterface, i) -> {
|
|
|
+ if (!UserConfig.getInstance(currentAccount).isClientActivated()) {
|
|
|
+ presentFragment(new LoginActivity());
|
|
|
+ } else {
|
|
|
+ long clientUserId = UserConfig.getInstance(currentAccount).getClientUserId();
|
|
|
+ presenter.recallComment(clientUserId + "", o.getId(), o);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ builder.setNegativeButton(LocaleController.getString(R.string.Cancel), null);
|
|
|
+ showDialog(builder.create());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|