feat: display boost timestamp
This commit is contained in:
parent
72940832a6
commit
2071602607
|
@ -16,6 +16,7 @@ import android.widget.TextView;
|
|||
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<Emoji> 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<Emoji> emojis, @DrawableRes int icon, StatusPrivacy visibility, @Nullable View.OnClickListener handleClick, CharSequence fullText, Status status) {
|
||||
public ReblogOrReplyLineStatusDisplayItem(String parentID, BaseStatusListFragment parentFragment, CharSequence text, List<Emoji> 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 class ReblogOrReplyLineStatusDisplayItem extends StatusDisplayItem{
|
|||
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;
|
||||
|
|
|
@ -151,7 +151,7 @@ public abstract class StatusDisplayItem{
|
|||
: 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 abstract class StatusDisplayItem{
|
|||
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
|
||||
|
|
Loading…
Reference in New Issue