Commit e0c94e11 authored by Thomas's avatar Thomas
Browse files

Fix some bad behaviors with span

parent 5cac9809
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -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);
    }


+1 −1
Original line number Diff line number Diff line
@@ -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;
        }
    }
+5 −6
Original line number Diff line number Diff line
@@ -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));