Fix some bad behaviors with span

This commit is contained in:
Thomas 2022-07-20 09:33:34 +02:00
parent 5cac98090f
commit e0c94e114c
3 changed files with 11 additions and 8 deletions

View file

@ -83,7 +83,11 @@ public class Account implements Serializable {
if (display_name == null || display_name.isEmpty()) {
display_name = username;
}
return SpannableHelper.convert(context, display_name, null, this, null, true, viewWeakReference);
return SpannableHelper.convert(context, display_name, null, this, null, false, viewWeakReference);
}
public synchronized Spannable getSpanDisplayNameTitle(Context context, WeakReference<View> viewWeakReference, String title) {
return SpannableHelper.convert(context, title, null, this, null, false, viewWeakReference);
}

View file

@ -61,7 +61,7 @@ public class Poll implements Serializable {
public transient Spannable span_title;
public Spannable getSpanTitle(Context context, Status status, WeakReference<View> viewWeakReference) {
span_title = SpannableHelper.convert(context, title, status, null, null, true, viewWeakReference);
span_title = SpannableHelper.convert(context, title, status, null, null, false, viewWeakReference);
return span_title;
}
}

View file

@ -224,10 +224,9 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
title = String.format(Locale.getDefault(), "%s reacted with %s", notification.account.username, notification.emoji);
MastodonHelper.loadPPMastodon(holderStatus.bindingNotification.status.avatar, notification.account);
}
notification.account.display_name = title;
holderStatus.bindingNotification.status.displayName.setText(
notification.account.getSpanDisplayName(context,
new WeakReference<>(holderStatus.bindingNotification.status.displayName)),
notification.account.getSpanDisplayNameTitle(context,
new WeakReference<>(holderStatus.bindingNotification.status.displayName), title),
TextView.BufferType.SPANNABLE);
holderStatus.bindingNotification.status.username.setText(String.format("@%s", notification.account.acct));
holderStatus.bindingNotification.containerTransparent.setAlpha(.1f);
@ -295,10 +294,10 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
// start the new activity
context.startActivity(intent, options.toBundle());
});
notification.account.display_name = title;
holderStatus.bindingNotification.status.displayName.setText(
notification.account.getSpanDisplayName(context,
new WeakReference<>(holderStatus.bindingNotification.status.displayName)),
notification.account.getSpanDisplayNameTitle(context,
new WeakReference<>(holderStatus.bindingNotification.status.displayName), title),
TextView.BufferType.SPANNABLE);
holderStatus.bindingNotification.status.displayName.setText(title, TextView.BufferType.SPANNABLE);
holderStatus.bindingNotification.status.username.setText(String.format("@%s", notification.account.acct));