some changes

This commit is contained in:
Thomas 2022-07-18 14:13:12 +02:00
parent dd924cba20
commit 8e0808dcda
13 changed files with 41 additions and 145 deletions

View File

@ -308,8 +308,7 @@ public class AdminAccountActivity extends BaseActivity {
binding.accountDn.setText( binding.accountDn.setText(
account.getSpanDisplayName(AdminAccountActivity.this, account.getSpanDisplayName(AdminAccountActivity.this,
new WeakReference<>(binding.accountDn), new WeakReference<>(binding.accountDn)),
id -> binding.accountDn.invalidate()),
TextView.BufferType.SPANNABLE); TextView.BufferType.SPANNABLE);
binding.accountUn.setText(String.format("@%s", account.acct)); binding.accountUn.setText(String.format("@%s", account.acct));
binding.accountUn.setOnLongClickListener(v -> { binding.accountUn.setOnLongClickListener(v -> {

View File

@ -325,8 +325,7 @@ public class AdminReportActivity extends BaseActivity {
binding.accountDn.setText( binding.accountDn.setText(
account.getSpanDisplayName(AdminReportActivity.this, account.getSpanDisplayName(AdminReportActivity.this,
new WeakReference<>(binding.accountDn), new WeakReference<>(binding.accountDn)),
id -> binding.accountDn.invalidate()),
TextView.BufferType.SPANNABLE); TextView.BufferType.SPANNABLE);
binding.accountUn.setText(String.format("@%s", account.acct)); binding.accountUn.setText(String.format("@%s", account.acct));
binding.accountUn.setOnLongClickListener(v -> { binding.accountUn.setOnLongClickListener(v -> {

View File

@ -350,8 +350,7 @@ public class ProfileActivity extends BaseActivity {
binding.accountDn.setText( binding.accountDn.setText(
account.getSpanDisplayName(ProfileActivity.this, account.getSpanDisplayName(ProfileActivity.this,
new WeakReference<>(binding.accountDn), new WeakReference<>(binding.accountDn)),
id -> binding.accountDn.invalidate()),
TextView.BufferType.SPANNABLE); TextView.BufferType.SPANNABLE);
binding.accountUn.setText(String.format("@%s", account.acct)); binding.accountUn.setText(String.format("@%s", account.acct));
@ -368,8 +367,7 @@ public class ProfileActivity extends BaseActivity {
}); });
binding.accountNote.setText( binding.accountNote.setText(
account.getSpanNote(ProfileActivity.this, account.getSpanNote(ProfileActivity.this,
new WeakReference<>(binding.accountNote), new WeakReference<>(binding.accountNote)),
id -> binding.accountNote.invalidate()),
TextView.BufferType.SPANNABLE); TextView.BufferType.SPANNABLE);
binding.accountNote.setMovementMethod(LinkMovementMethod.getInstance()); binding.accountNote.setMovementMethod(LinkMovementMethod.getInstance());

View File

@ -79,32 +79,16 @@ public class Account implements Serializable {
@SerializedName("moved") @SerializedName("moved")
public Account moved; public Account moved;
public transient boolean emojiDisplayNameFetched = false; public synchronized Spannable getSpanDisplayName(Context context, WeakReference<View> viewWeakReference) {
public transient boolean emojiNoteFetched = false;
//Some extra spannable element - They will be filled automatically when fetching the account
private transient Spannable span_display_name;
private transient Spannable span_note;
public synchronized Spannable getSpanDisplayName(Context context, WeakReference<View> viewWeakReference, SpannableHelper.EmojiCallback callback) {
if (span_display_name != null) {
return span_display_name;
}
if (display_name == null) { if (display_name == null) {
display_name = username; display_name = username;
} }
span_display_name = SpannableHelper.convert(context, display_name, null, this, true, viewWeakReference, !emojiDisplayNameFetched ? callback : null); return SpannableHelper.convert(context, display_name, null, this, true, viewWeakReference);
emojiDisplayNameFetched = true;
return span_display_name;
} }
public synchronized Spannable getSpanNote(Context context, WeakReference<View> viewWeakReference, SpannableHelper.EmojiCallback callback) { public synchronized Spannable getSpanNote(Context context, WeakReference<View> viewWeakReference) {
if (span_note != null) { return SpannableHelper.convert(context, note, null, this, true, viewWeakReference);
return span_note;
}
span_note = SpannableHelper.convert(context, note, null, this, true, viewWeakReference, !emojiNoteFetched ? callback : null);
emojiNoteFetched = true;
return span_note;
} }
public transient RelationShip relationShip; public transient RelationShip relationShip;

View File

@ -58,16 +58,10 @@ public class Poll implements Serializable {
@SerializedName("votes_count") @SerializedName("votes_count")
public int votes_count; public int votes_count;
//Some extra spannable element - They will be filled automatically when fetching the poll public Spannable span_title;
public transient Spannable span_title;
public transient boolean emojiTitleFetched = false;
public Spannable getSpanTitle(Context context, Status status, WeakReference<View> viewWeakReference, SpannableHelper.EmojiCallback callback) { public Spannable getSpanTitle(Context context, Status status, WeakReference<View> viewWeakReference) {
if (span_title != null) { span_title = SpannableHelper.convert(context, title, status, null, true, viewWeakReference);
return span_title;
}
span_title = SpannableHelper.convert(context, title, status, null, true, viewWeakReference, !emojiTitleFetched ? callback : null);
emojiTitleFetched = true;
return span_title; return span_title;
} }
} }

View File

@ -93,9 +93,6 @@ public class Status implements Serializable, Cloneable {
public Attachment art_attachment; public Attachment art_attachment;
public transient boolean emojiContentFetched = false;
public transient boolean emojiSpoilerFetched = false;
public transient boolean emojiTranslateFetched = false;
public boolean isExpended = false; public boolean isExpended = false;
public boolean isTruncated = true; public boolean isTruncated = true;
public boolean isFetchMore = false; public boolean isFetchMore = false;
@ -110,44 +107,22 @@ public class Status implements Serializable, Cloneable {
public transient int cursorPosition = 0; public transient int cursorPosition = 0;
public transient boolean submitted = false; public transient boolean submitted = false;
//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
private transient Spannable span_content;
private transient Spannable span_spoiler_text;
private transient Spannable span_translate;
public synchronized Spannable getSpanContent(Context context, WeakReference<View> viewWeakReference, SpannableHelper.EmojiCallback callback) { public synchronized Spannable getSpanContent(Context context, WeakReference<View> viewWeakReference) {
if (span_content != null) { return SpannableHelper.convert(context, content, this, null, true, viewWeakReference);
return span_content;
}
span_content = SpannableHelper.convert(context, content, this, null, true, viewWeakReference, !emojiContentFetched ? callback : null);
emojiContentFetched = true;
return span_content;
} }
public Spannable getSpanContentNitter() { public Spannable getSpanContentNitter() {
if (span_content != null) { return SpannableHelper.convertNitter(content);
return span_content;
}
span_content = SpannableHelper.convertNitter(content);
return span_content;
} }
public synchronized Spannable getSpanSpoiler(Context context, WeakReference<View> viewWeakReference, SpannableHelper.EmojiCallback callback) { public synchronized Spannable getSpanSpoiler(Context context, WeakReference<View> viewWeakReference) {
if (span_spoiler_text != null) { return SpannableHelper.convert(context, spoiler_text, this, null, true, viewWeakReference);
return span_spoiler_text;
}
span_spoiler_text = SpannableHelper.convert(context, spoiler_text, this, null, true, viewWeakReference, !emojiSpoilerFetched ? callback : null);
emojiSpoilerFetched = true;
return span_spoiler_text;
} }
public synchronized Spannable getSpanTranslate(Context context, WeakReference<View> viewWeakReference, SpannableHelper.EmojiCallback callback) { public synchronized Spannable getSpanTranslate(Context context, WeakReference<View> viewWeakReference) {
if (span_translate != null) { return SpannableHelper.convert(context, translationContent, this, null, true, viewWeakReference);
return span_translate;
}
span_translate = SpannableHelper.convert(context, translationContent, this, null, true, viewWeakReference, !emojiTranslateFetched ? callback : null);
emojiTranslateFetched = true;
return span_translate;
} }
@NonNull @NonNull

View File

@ -40,7 +40,6 @@ import android.text.TextPaint;
import android.text.style.ClickableSpan; import android.text.style.ClickableSpan;
import android.text.style.ImageSpan; import android.text.style.ImageSpan;
import android.text.style.URLSpan; import android.text.style.URLSpan;
import android.util.Log;
import android.util.Patterns; import android.util.Patterns;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -88,8 +87,7 @@ public class SpannableHelper {
public static Spannable convert(Context context, String text, public static Spannable convert(Context context, String text,
Status status, Account account, Status status, Account account,
boolean convertHtml, boolean convertHtml,
WeakReference<View> viewWeakReference, WeakReference<View> viewWeakReference) {
EmojiCallback listener) {
SpannableString initialContent; SpannableString initialContent;
if (text == null) { if (text == null) {
@ -97,16 +95,13 @@ public class SpannableHelper {
} }
SpannableStringBuilder content; SpannableStringBuilder content;
View view = viewWeakReference.get(); View view = viewWeakReference.get();
String id = null;
List<Mention> mentionList = null; List<Mention> mentionList = null;
List<Emoji> emojiList = null; List<Emoji> emojiList = null;
if (status != null) { if (status != null) {
mentionList = status.mentions; mentionList = status.mentions;
emojiList = status.emojis; emojiList = status.emojis;
id = status.id;
} else if (account != null) { } else if (account != null) {
emojiList = account.emojis; emojiList = account.emojis;
id = account.id;
} }
HashMap<String, String> urlDetails = new HashMap<>(); HashMap<String, String> urlDetails = new HashMap<>();
if (convertHtml) { if (convertHtml) {
@ -142,24 +137,12 @@ public class SpannableHelper {
if (emojiList != null && emojiList.size() > 0) { if (emojiList != null && emojiList.size() > 0) {
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
boolean animate = !sharedpreferences.getBoolean(context.getString(R.string.SET_DISABLE_ANIMATED_EMOJI), false); boolean animate = !sharedpreferences.getBoolean(context.getString(R.string.SET_DISABLE_ANIMATED_EMOJI), false);
int count = 1;
for (Emoji emoji : emojiList) { for (Emoji emoji : emojiList) {
int finalCount = count;
List<Emoji> finalEmojiList = emojiList;
String finalId = id;
List<Emoji> finalEmojiList1 = emojiList;
Glide.with(context) Glide.with(context)
.asDrawable() .asDrawable()
.load(animate ? emoji.url : emoji.static_url) .load(animate ? emoji.url : emoji.static_url)
.into( .into(
new CustomTarget<Drawable>() { new CustomTarget<Drawable>() {
@Override
public void onLoadFailed(@Nullable Drawable errorDrawable) {
super.onLoadFailed(errorDrawable);
if (finalCount == finalEmojiList.size() && listener != null) {
listener.transformationDone(finalId);
}
}
@Override @Override
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) { public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
@ -202,11 +185,7 @@ public class SpannableHelper {
((Animatable) resource).start(); ((Animatable) resource).start();
} }
Log.v(Helper.TAG, ">: " + emoji.shortcode + " --> " + listener + " - " + finalCount + " <> " + finalEmojiList1.size());
if (finalCount == finalEmojiList.size() && listener != null) {
Log.v(Helper.TAG, "OK FOR: " + emoji.shortcode + " --> " + finalId);
listener.transformationDone(finalId);
}
} }
@Override @Override
@ -215,7 +194,6 @@ public class SpannableHelper {
} }
} }
); );
count++;
} }
} }
return trimSpannable(new SpannableStringBuilder(content)); return trimSpannable(new SpannableStringBuilder(content));
@ -677,9 +655,4 @@ public class SpannableHelper {
} }
return spannableString; return spannableString;
} }
public interface EmojiCallback {
void transformationDone(String id);
}
} }

View File

@ -227,14 +227,12 @@ public class AccountAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
} }
accountViewHolder.binding.displayName.setText( accountViewHolder.binding.displayName.setText(
account.getSpanDisplayName(context, account.getSpanDisplayName(context,
new WeakReference<>(accountViewHolder.binding.displayName), new WeakReference<>(accountViewHolder.binding.displayName)),
id -> adapter.notifyItemChanged(position)),
TextView.BufferType.SPANNABLE); TextView.BufferType.SPANNABLE);
accountViewHolder.binding.username.setText(String.format("@%s", account.acct)); accountViewHolder.binding.username.setText(String.format("@%s", account.acct));
accountViewHolder.binding.bio.setText( accountViewHolder.binding.bio.setText(
account.getSpanNote(context, account.getSpanNote(context,
new WeakReference<>(accountViewHolder.binding.bio), new WeakReference<>(accountViewHolder.binding.bio)),
id -> adapter.notifyItemChanged(position)),
TextView.BufferType.SPANNABLE); TextView.BufferType.SPANNABLE);
} }

View File

@ -81,8 +81,7 @@ public class AccountListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
MastodonHelper.loadPPMastodon(holder.binding.avatar, account); MastodonHelper.loadPPMastodon(holder.binding.avatar, account);
holder.binding.displayName.setText( holder.binding.displayName.setText(
account.getSpanDisplayName(context, account.getSpanDisplayName(context,
new WeakReference<>(holder.binding.displayName), new WeakReference<>(holder.binding.displayName)),
id -> notifyItemChanged(position)),
TextView.BufferType.SPANNABLE); TextView.BufferType.SPANNABLE);
holder.binding.username.setText(String.format("@%s", account.acct)); holder.binding.username.setText(String.format("@%s", account.acct));

View File

@ -1043,22 +1043,19 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
StatusSimpleViewHolder holder = (StatusSimpleViewHolder) viewHolder; StatusSimpleViewHolder holder = (StatusSimpleViewHolder) viewHolder;
holder.binding.statusContent.setText( holder.binding.statusContent.setText(
status.getSpanContent(context, status.getSpanContent(context,
new WeakReference<>(holder.binding.statusContent), new WeakReference<>(holder.binding.statusContent)),
id -> notifyItemChanged(position)),
TextView.BufferType.SPANNABLE); TextView.BufferType.SPANNABLE);
MastodonHelper.loadPPMastodon(holder.binding.avatar, status.account); MastodonHelper.loadPPMastodon(holder.binding.avatar, status.account);
holder.binding.displayName.setText( holder.binding.displayName.setText(
status.account.getSpanDisplayName(context, status.account.getSpanDisplayName(context,
new WeakReference<>(holder.binding.displayName), new WeakReference<>(holder.binding.displayName)),
id -> notifyItemChanged(position)),
TextView.BufferType.SPANNABLE); TextView.BufferType.SPANNABLE);
holder.binding.username.setText(String.format("@%s", status.account.acct)); holder.binding.username.setText(String.format("@%s", status.account.acct));
if (status.spoiler_text != null && !status.spoiler_text.trim().isEmpty()) { if (status.spoiler_text != null && !status.spoiler_text.trim().isEmpty()) {
holder.binding.spoiler.setVisibility(View.VISIBLE); holder.binding.spoiler.setVisibility(View.VISIBLE);
holder.binding.spoiler.setText( holder.binding.spoiler.setText(
status.getSpanSpoiler(context, status.getSpanSpoiler(context,
new WeakReference<>(holder.binding.spoiler), new WeakReference<>(holder.binding.spoiler)),
id -> notifyItemChanged(position)),
TextView.BufferType.SPANNABLE); TextView.BufferType.SPANNABLE);
} else { } else {
holder.binding.spoiler.setVisibility(View.GONE); holder.binding.spoiler.setVisibility(View.GONE);

View File

@ -140,8 +140,7 @@ public class ConversationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
holder.binding.spoiler.setVisibility(View.VISIBLE); holder.binding.spoiler.setVisibility(View.VISIBLE);
holder.binding.spoiler.setText( holder.binding.spoiler.setText(
conversation.last_status.getSpanSpoiler(context, conversation.last_status.getSpanSpoiler(context,
new WeakReference<>(holder.binding.spoiler), new WeakReference<>(holder.binding.spoiler)),
id -> notifyItemChanged(position)),
TextView.BufferType.SPANNABLE); TextView.BufferType.SPANNABLE);
} else { } else {
holder.binding.spoiler.setVisibility(View.GONE); holder.binding.spoiler.setVisibility(View.GONE);
@ -151,8 +150,7 @@ public class ConversationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
//--- MAIN CONTENT --- //--- MAIN CONTENT ---
holder.binding.statusContent.setText( holder.binding.statusContent.setText(
conversation.last_status.getSpanContent(context, conversation.last_status.getSpanContent(context,
new WeakReference<>(holder.binding.statusContent), new WeakReference<>(holder.binding.statusContent)),
id -> notifyItemChanged(position)),
TextView.BufferType.SPANNABLE); TextView.BufferType.SPANNABLE);
//--- DATE --- //--- DATE ---
holder.binding.lastMessageDate.setText(Helper.dateDiff(context, conversation.last_status.created_at)); holder.binding.lastMessageDate.setText(Helper.dateDiff(context, conversation.last_status.created_at));

View File

@ -144,8 +144,7 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
MastodonHelper.loadPPMastodon(holderFollow.binding.avatar, notification.account); MastodonHelper.loadPPMastodon(holderFollow.binding.avatar, notification.account);
holderFollow.binding.displayName.setText( holderFollow.binding.displayName.setText(
notification.account.getSpanDisplayName(context, notification.account.getSpanDisplayName(context,
new WeakReference<>(holderFollow.binding.displayName), new WeakReference<>(holderFollow.binding.displayName)),
id -> notifyItemChanged(getPositionAsync(notificationList, id))),
TextView.BufferType.SPANNABLE); TextView.BufferType.SPANNABLE);
holderFollow.binding.username.setText(String.format("@%s", notification.account.acct)); holderFollow.binding.username.setText(String.format("@%s", notification.account.acct));
if (getItemViewType(position) == TYPE_FOLLOW_REQUEST) { if (getItemViewType(position) == TYPE_FOLLOW_REQUEST) {
@ -217,8 +216,7 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
notification.account.display_name = title; notification.account.display_name = title;
holderStatus.bindingNotification.status.displayName.setText( holderStatus.bindingNotification.status.displayName.setText(
notification.account.getSpanDisplayName(context, notification.account.getSpanDisplayName(context,
new WeakReference<>(holderStatus.bindingNotification.status.displayName), new WeakReference<>(holderStatus.bindingNotification.status.displayName)),
id -> holderStatus.bindingNotification.status.displayName.post(() -> notifyItemChanged(getPositionAsync(notificationList, id)))),
TextView.BufferType.SPANNABLE); TextView.BufferType.SPANNABLE);
holderStatus.bindingNotification.status.username.setText(String.format("@%s", notification.account.acct)); holderStatus.bindingNotification.status.username.setText(String.format("@%s", notification.account.acct));
holderStatus.bindingNotification.containerTransparent.setAlpha(.1f); holderStatus.bindingNotification.containerTransparent.setAlpha(.1f);
@ -289,8 +287,7 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
notification.account.display_name = title; notification.account.display_name = title;
holderStatus.bindingNotification.status.displayName.setText( holderStatus.bindingNotification.status.displayName.setText(
notification.account.getSpanDisplayName(context, notification.account.getSpanDisplayName(context,
new WeakReference<>(holderStatus.bindingNotification.status.displayName), new WeakReference<>(holderStatus.bindingNotification.status.displayName)),
id -> holderStatus.bindingNotification.status.displayName.post(() -> notifyItemChanged(getPositionAsync(notificationList, id)))),
TextView.BufferType.SPANNABLE); TextView.BufferType.SPANNABLE);
holderStatus.bindingNotification.status.displayName.setText(title, TextView.BufferType.SPANNABLE); holderStatus.bindingNotification.status.displayName.setText(title, TextView.BufferType.SPANNABLE);
holderStatus.bindingNotification.status.username.setText(String.format("@%s", notification.account.acct)); holderStatus.bindingNotification.status.username.setText(String.format("@%s", notification.account.acct));

View File

@ -40,7 +40,6 @@ import android.text.SpannableString;
import android.text.Spanned; import android.text.Spanned;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.style.ForegroundColorSpan; import android.text.style.ForegroundColorSpan;
import android.util.Log;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.ContextThemeWrapper; import android.view.ContextThemeWrapper;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -747,8 +746,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
holder.binding.displayName.setText( holder.binding.displayName.setText(
statusToDeal.account.getSpanDisplayName(context, statusToDeal.account.getSpanDisplayName(context,
new WeakReference<>(holder.binding.displayName), new WeakReference<>(holder.binding.displayName)),
id -> holder.binding.displayName.post(() -> adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, id)))),
TextView.BufferType.SPANNABLE); TextView.BufferType.SPANNABLE);
if (theme_text_header_1_line != -1) { if (theme_text_header_1_line != -1) {
holder.binding.displayName.setTextColor(theme_text_header_1_line); holder.binding.displayName.setTextColor(theme_text_header_1_line);
@ -816,8 +814,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
holder.binding.spoiler.setVisibility(View.VISIBLE); holder.binding.spoiler.setVisibility(View.VISIBLE);
holder.binding.spoiler.setText( holder.binding.spoiler.setText(
statusToDeal.getSpanSpoiler(context, statusToDeal.getSpanSpoiler(context,
new WeakReference<>(holder.binding.spoiler), new WeakReference<>(holder.binding.spoiler)),
id -> holder.binding.spoiler.post(() -> adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, id)))),
TextView.BufferType.SPANNABLE); TextView.BufferType.SPANNABLE);
statusToDeal.isExpended = true; statusToDeal.isExpended = true;
statusToDeal.isMediaDisplayed = true; statusToDeal.isMediaDisplayed = true;
@ -832,8 +829,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
holder.binding.spoiler.setText( holder.binding.spoiler.setText(
statusToDeal.getSpanSpoiler(context, statusToDeal.getSpanSpoiler(context,
new WeakReference<>(holder.binding.spoiler), new WeakReference<>(holder.binding.spoiler)),
id -> holder.binding.spoiler.post(() -> adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, id)))),
TextView.BufferType.SPANNABLE); TextView.BufferType.SPANNABLE);
} }
if (statusToDeal.isExpended) { if (statusToDeal.isExpended) {
@ -853,8 +849,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
holder.binding.statusBoosterDisplayName.setText( holder.binding.statusBoosterDisplayName.setText(
status.account.getSpanDisplayName(context, status.account.getSpanDisplayName(context,
new WeakReference<>(holder.binding.statusBoosterDisplayName), new WeakReference<>(holder.binding.statusBoosterDisplayName)),
id -> holder.binding.statusBoosterDisplayName.post(() -> adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, id)))),
TextView.BufferType.SPANNABLE); TextView.BufferType.SPANNABLE);
holder.binding.statusBoosterInfo.setVisibility(View.VISIBLE); holder.binding.statusBoosterInfo.setVisibility(View.VISIBLE);
@ -890,12 +885,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
//--- MAIN CONTENT --- //--- MAIN CONTENT ---
holder.binding.statusContent.setText( holder.binding.statusContent.setText(
statusToDeal.getSpanContent(context, statusToDeal.getSpanContent(context,
new WeakReference<>(holder.binding.statusContent), new WeakReference<>(holder.binding.statusContent)),
id -> holder.binding.statusContent.post(() -> {
Log.v(Helper.TAG, "notifiy: " + id);
Log.v(Helper.TAG, "position: " + getPositionAsync(notificationList, statusList, id));
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, id));
})),
TextView.BufferType.SPANNABLE); TextView.BufferType.SPANNABLE);
if (truncate_toots_size > 0) { if (truncate_toots_size > 0) {
holder.binding.statusContent.setMaxLines(truncate_toots_size); holder.binding.statusContent.setMaxLines(truncate_toots_size);
@ -929,8 +919,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
holder.binding.containerTrans.setVisibility(View.VISIBLE); holder.binding.containerTrans.setVisibility(View.VISIBLE);
holder.binding.statusContentTranslated.setText( holder.binding.statusContentTranslated.setText(
statusToDeal.getSpanTranslate(context, statusToDeal.getSpanTranslate(context,
new WeakReference<>(holder.binding.statusContentTranslated), new WeakReference<>(holder.binding.statusContentTranslated)),
id -> holder.binding.statusContentTranslated.post(() -> adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, id)))),
TextView.BufferType.SPANNABLE); TextView.BufferType.SPANNABLE);
} else { } else {
holder.binding.containerTrans.setVisibility(View.GONE); holder.binding.containerTrans.setVisibility(View.GONE);
@ -1195,8 +1184,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
} }
pollItemBinding.pollItemText.setText( pollItemBinding.pollItemText.setText(
pollItem.getSpanTitle(context, statusToDeal, pollItem.getSpanTitle(context, statusToDeal,
new WeakReference<>(pollItemBinding.pollItemText), new WeakReference<>(pollItemBinding.pollItemText)),
id -> pollItemBinding.pollItemText.post(() -> adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, id)))),
TextView.BufferType.SPANNABLE); TextView.BufferType.SPANNABLE);
pollItemBinding.pollItemValue.setProgress((int) value); pollItemBinding.pollItemValue.setProgress((int) value);
if (pollItem.votes_count == greaterValue) { if (pollItem.votes_count == greaterValue) {
@ -1227,8 +1215,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
cb.setButtonTintList(ThemeHelper.getButtonColorStateList(context)); cb.setButtonTintList(ThemeHelper.getButtonColorStateList(context));
cb.setText( cb.setText(
pollOption.getSpanTitle(context, statusToDeal, pollOption.getSpanTitle(context, statusToDeal,
new WeakReference<>(cb), new WeakReference<>(cb)),
id -> cb.post(() -> adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, id)))),
TextView.BufferType.SPANNABLE); TextView.BufferType.SPANNABLE);
holder.binding.poll.multipleChoice.addView(cb); holder.binding.poll.multipleChoice.addView(cb);
} }
@ -1242,8 +1229,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
rb.setButtonTintList(ThemeHelper.getButtonColorStateList(context)); rb.setButtonTintList(ThemeHelper.getButtonColorStateList(context));
rb.setText( rb.setText(
pollOption.getSpanTitle(context, statusToDeal, pollOption.getSpanTitle(context, statusToDeal,
new WeakReference<>(rb), new WeakReference<>(rb)),
id -> rb.post(() -> adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, id)))),
TextView.BufferType.SPANNABLE); TextView.BufferType.SPANNABLE);
holder.binding.poll.singleChoiceRadioGroup.addView(rb); holder.binding.poll.singleChoiceRadioGroup.addView(rb);
@ -1846,8 +1832,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
.into(holder.bindingArt.artMedia); .into(holder.bindingArt.artMedia);
holder.bindingArt.artAcct.setText( holder.bindingArt.artAcct.setText(
status.account.getSpanDisplayName(context, status.account.getSpanDisplayName(context,
new WeakReference<>(holder.bindingArt.artAcct), new WeakReference<>(holder.bindingArt.artAcct)),
id -> holder.bindingArt.artAcct.post(() -> notifyItemChanged(getPositionAsync(null, statusList, id)))),
TextView.BufferType.SPANNABLE); TextView.BufferType.SPANNABLE);
holder.bindingArt.artUsername.setText(String.format(Locale.getDefault(), "@%s", status.account.acct)); holder.bindingArt.artUsername.setText(String.format(Locale.getDefault(), "@%s", status.account.acct));
holder.bindingArt.artPp.setOnClickListener(v -> { holder.bindingArt.artPp.setOnClickListener(v -> {