diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/ReblogOrReplyLineStatusDisplayItem.java b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/ReblogOrReplyLineStatusDisplayItem.java index 3a1158c00f..180c27ef43 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/ReblogOrReplyLineStatusDisplayItem.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/ReblogOrReplyLineStatusDisplayItem.java @@ -16,6 +16,7 @@ import org.joinmastodon.android.R; import org.joinmastodon.android.api.session.AccountSessionManager; import org.joinmastodon.android.fragments.BaseStatusListFragment; +import org.joinmastodon.android.model.Account; import org.joinmastodon.android.model.Emoji; import org.joinmastodon.android.model.Status; import org.joinmastodon.android.model.StatusPrivacy; @@ -47,12 +48,13 @@ public class ReblogOrReplyLineStatusDisplayItem extends StatusDisplayItem{ public boolean needBottomPadding; ReblogOrReplyLineStatusDisplayItem extra; CharSequence fullText; + CharSequence boostingTimestamp; public ReblogOrReplyLineStatusDisplayItem(String parentID, BaseStatusListFragment parentFragment, CharSequence text, List emojis, @DrawableRes int icon, StatusPrivacy visibility, @Nullable View.OnClickListener handleClick, Status status) { - this(parentID, parentFragment, text, emojis, icon, visibility, handleClick, text, status); + this(parentID, parentFragment, text, emojis, icon, visibility, handleClick, text, status, null); } - public ReblogOrReplyLineStatusDisplayItem(String parentID, BaseStatusListFragment parentFragment, CharSequence text, List emojis, @DrawableRes int icon, StatusPrivacy visibility, @Nullable View.OnClickListener handleClick, CharSequence fullText, Status status) { + public ReblogOrReplyLineStatusDisplayItem(String parentID, BaseStatusListFragment parentFragment, CharSequence text, List emojis, @DrawableRes int icon, StatusPrivacy visibility, @Nullable View.OnClickListener handleClick, CharSequence fullText, Status status, Account account) { super(parentID, parentFragment); SpannableStringBuilder ssb=new SpannableStringBuilder(text); if(AccountSessionManager.get(parentFragment.getAccountID()).getLocalPreferences().customEmojiInNames) @@ -64,6 +66,14 @@ public ReblogOrReplyLineStatusDisplayItem(String parentID, BaseStatusListFragmen ssb.setSpan(new AvatarSpan(status.account), 0, 1, Spanned.SPAN_INCLUSIVE_EXCLUSIVE); ssb.setSpan(new SpacerSpan(15, 20), 1, 2, Spanned.SPAN_INCLUSIVE_EXCLUSIVE); } + int replyPrefixLength=context.getString(R.string.in_reply_to).length()-2; //subtract 2 for placeholder + if(status.inReplyToAccountId!=null&&ssb.length()>replyPrefixLength&&account!=null){ + //add temp chars for span replacement, should be same as spans added below + ssb.insert(replyPrefixLength, " "); + ssb.setSpan(new SpacerSpan(15, 20), replyPrefixLength+1, replyPrefixLength+2, Spanned.SPAN_INCLUSIVE_EXCLUSIVE); + ssb.setSpan(new AvatarSpan(account), replyPrefixLength+1, replyPrefixLength+2, Spanned.SPAN_INCLUSIVE_EXCLUSIVE); + ssb.setSpan(new SpacerSpan(15, 20), replyPrefixLength+2, replyPrefixLength+3, Spanned.SPAN_INCLUSIVE_EXCLUSIVE); + } this.text=ssb; emojiHelper.setText(ssb); this.fullText=fullText; diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/StatusDisplayItem.java b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/StatusDisplayItem.java index 4e6193cebe..91aa1b309a 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/StatusDisplayItem.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/StatusDisplayItem.java @@ -151,7 +151,7 @@ public static ReblogOrReplyLineStatusDisplayItem buildReplyLine(BaseStatusListFr : fragment.getString(R.string.in_reply_to, account.getDisplayName()); return new ReblogOrReplyLineStatusDisplayItem( parentID, fragment, text, account == null ? List.of() : account.emojis, - R.drawable.ic_fluent_arrow_reply_20sp_filled, null, null, fullText, status + R.drawable.ic_fluent_arrow_reply_20sp_filled, null, null, fullText, status, account ); } @@ -182,7 +182,7 @@ public static ArrayList buildItems(BaseStatusListFragment items.add(new ReblogOrReplyLineStatusDisplayItem(parentID, fragment, text, status.account.emojis, R.drawable.ic_fluent_arrow_repeat_all_20sp_filled, isOwnPost ? status.visibility : null, i->{ args.putParcelable("profileAccount", Parcels.wrap(status.account)); Nav.go(fragment.getActivity(), ProfileFragment.class, args); - }, null, status)); + }, null, status, status.account)); } else if (!(status.tags.isEmpty() || fragment instanceof HashtagTimelineFragment || fragment instanceof ListTimelineFragment