some fixes

This commit is contained in:
Thomas 2022-07-15 17:34:19 +02:00
parent 2db7b4b87c
commit 61ddd2a22d
3 changed files with 7 additions and 7 deletions

View file

@ -364,7 +364,7 @@ public class ProfileActivity extends BaseActivity {
} else { } else {
Spannable textAccount = account.span_display_name != null ? account.span_display_name : new SpannableString(account.display_name); Spannable textAccount = account.span_display_name != null ? account.span_display_name : new SpannableString(account.display_name);
CustomEmoji.displayEmoji(ProfileActivity.this, account.emojis, textAccount, binding.accountDn, null, id -> { CustomEmoji.displayEmoji(ProfileActivity.this, account.emojis, textAccount, binding.accountDn, null, id -> {
binding.accountDn.invalidate(); binding.accountDn.setText(textAccount, TextView.BufferType.SPANNABLE);
}); });
binding.accountDn.setText(textAccount, TextView.BufferType.SPANNABLE); binding.accountDn.setText(textAccount, TextView.BufferType.SPANNABLE);
} }
@ -386,7 +386,7 @@ public class ProfileActivity extends BaseActivity {
textNote = account.span_note != null ? account.span_note : new SpannableString(Html.fromHtml(account.note, Html.FROM_HTML_MODE_COMPACT)); textNote = account.span_note != null ? account.span_note : new SpannableString(Html.fromHtml(account.note, Html.FROM_HTML_MODE_COMPACT));
else else
textNote = account.span_note != null ? account.span_note : new SpannableString(Html.fromHtml(account.note)); textNote = account.span_note != null ? account.span_note : new SpannableString(Html.fromHtml(account.note));
CustomEmoji.displayEmoji(ProfileActivity.this, account.emojis, textNote, binding.accountNote, null, id -> binding.accountNote.invalidate()); CustomEmoji.displayEmoji(ProfileActivity.this, account.emojis, textNote, binding.accountNote, null, id -> binding.accountNote.setText(textNote, TextView.BufferType.SPANNABLE));
binding.accountNote.setText(textNote, TextView.BufferType.SPANNABLE); binding.accountNote.setText(textNote, TextView.BufferType.SPANNABLE);
binding.accountNote.setMovementMethod(LinkMovementMethod.getInstance()); binding.accountNote.setMovementMethod(LinkMovementMethod.getInstance());

View file

@ -51,5 +51,5 @@ public class Announcement {
//Some extra spannable element - They will be filled automatically when fetching the status //Some extra spannable element - They will be filled automatically when fetching the status
public transient Spannable span_content; public transient Spannable span_content;
public boolean emojiFetched = false; public transient boolean emojiFetched = false;
} }

View file

@ -197,13 +197,13 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
holderStatus.bindingNotification.containerTransparent.setAlpha(.3f); holderStatus.bindingNotification.containerTransparent.setAlpha(.3f);
if (getItemViewType(position) == TYPE_MENTION || getItemViewType(position) == TYPE_STATUS) { if (getItemViewType(position) == TYPE_MENTION || getItemViewType(position) == TYPE_STATUS) {
holderStatus.bindingNotification.status.actionButtons.setVisibility(View.VISIBLE); holderStatus.bindingNotification.status.actionButtons.setVisibility(View.VISIBLE);
String title = ""; Spannable title = new SpannableString("");
if (getItemViewType(position) == TYPE_MENTION) { if (getItemViewType(position) == TYPE_MENTION) {
title = String.format(Locale.getDefault(), "%s %s", notification.account.display_name, context.getString(R.string.notif_mention)); title = new SpannableString(String.format(Locale.getDefault(), "%s %s", notification.account.display_name, context.getString(R.string.notif_mention)));
} else if (getItemViewType(position) == TYPE_STATUS) { } else if (getItemViewType(position) == TYPE_STATUS) {
title = String.format(Locale.getDefault(), "%s %s", notification.account.display_name, context.getString(R.string.notif_status)); title = new SpannableString(String.format(Locale.getDefault(), "%s %s", notification.account.display_name, context.getString(R.string.notif_status)));
} }
CustomEmoji.displayEmoji(context, notification.account.emojis, notification.account.span_display_name, holderStatus.binding.displayName, notification.id, id -> { CustomEmoji.displayEmoji(context, notification.account.emojis, title, holderStatus.binding.displayName, notification.id, id -> {
if (!notification.account.emojiFetched) { if (!notification.account.emojiFetched) {
notification.account.emojiFetched = true; notification.account.emojiFetched = true;
holderStatus.binding.displayName.post(() -> notifyItemChanged(position)); holderStatus.binding.displayName.post(() -> notifyItemChanged(position));