Fixes missing content in notifications

This commit is contained in:
stom79 2017-12-03 15:10:11 +01:00
parent 625c1ade6f
commit 343b3d76ac
1 changed files with 6 additions and 23 deletions

View File

@ -245,34 +245,13 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
Typeface tf = Typeface.createFromAsset(context.getAssets(), "fonts/DroidSans-Regular.ttf");
holder.notification_status_content.setTypeface(tf);
String content;
if( !status.isClickable())
status.makeClickable(context);
if( !status.isEmojiFound())
status.makeEmojis(context, NotificationsListAdapter.this);
holder.notification_status_content.setText(status.getContentSpan(), TextView.BufferType.SPANNABLE);
/*if( status.getContents() != null){
holder.notification_status_content.setText(status.getContents(), TextView.BufferType.SPANNABLE);
}else {
content = status.getContent();
if (content != null) {
content = content.replaceAll("</p>", "<br/><br/>");
content = content.replaceAll("<p>", "");
if (content.endsWith("<br/><br/>"))
content = content.substring(0, content.length() - 10);
}
SpannableString spannableString = Helper.clickableElements(context, content,
status, true, NotificationsListAdapter.this);
/*SpannableString spannableString = Helper.clickableElements(context, content,
status.getReblog() != null ? status.getReblog().getMentions() : status.getMentions(),
status.getReblog() != null ? status.getReblog().getEmojis() : status.getEmojis(),
position,
true, NotificationsListAdapter.this);*/
// holder.notification_status_content.setText(spannableString, TextView.BufferType.SPANNABLE);
//}
holder.notification_status_content.setMovementMethod(null);
holder.notification_status_content.setMovementMethod(LinkMovementMethod.getInstance());
@ -335,7 +314,9 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
imgReblog = ContextCompat.getDrawable(context, R.drawable.ic_repeat);
}
assert imgFav != null;
imgFav.setBounds(0,0,(int) (20 * iconSizePercent/100 * scale + 0.5f),(int) (20 * iconSizePercent/100 * scale + 0.5f));
assert imgReblog != null;
imgReblog.setBounds(0,0,(int) (20 * iconSizePercent/100 * scale + 0.5f),(int) (20 * iconSizePercent/100 * scale + 0.5f));
holder.status_favorite_count.setCompoundDrawables(imgFav, null, null, null);
holder.status_reblog_count.setCompoundDrawables(imgReblog, null, null, null);
@ -911,7 +892,9 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
if (notificationsListAdapter.getItemAt(i) != null && notificationsListAdapter.getItemAt(i).getStatus() != null && notificationsListAdapter.getItemAt(i).getStatus().getId().equals(status.getId())) {
if( notificationsListAdapter.getItemAt(i).getStatus() != null) {
notificationsListAdapter.getItemAt(i).getStatus().setEmojiFound(true);
notificationsListAdapter.notifyItemChanged(i);
try {
notificationsListAdapter.notifyItemChanged(i);
}catch (Exception ignored){}
}
}
}