From e50df3ea6d0527d2ad45085c28000476725a8575 Mon Sep 17 00:00:00 2001 From: FineFindus Date: Tue, 16 May 2023 16:18:56 +0200 Subject: [PATCH] feat: hide bossts on non-boostable status --- .../org/joinmastodon/android/fragments/ThreadFragment.java | 2 +- .../ui/displayitems/ExtendedFooterStatusDisplayItem.java | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/ThreadFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/ThreadFragment.java index 3693210d0..6e55cf69e 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ThreadFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ThreadFragment.java @@ -62,7 +62,7 @@ public class ThreadFragment extends StatusListFragment implements DomainDisplay{ else if(item instanceof FooterStatusDisplayItem footer) footer.hideCounts=true; } - items.add(new ExtendedFooterStatusDisplayItem(s.id, this, s.getContentStatus())); + items.add(new ExtendedFooterStatusDisplayItem(s.id, this, accountID, s.getContentStatus())); } return items; } diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/ExtendedFooterStatusDisplayItem.java b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/ExtendedFooterStatusDisplayItem.java index 4a830e273..3afc8a134 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/ExtendedFooterStatusDisplayItem.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/ExtendedFooterStatusDisplayItem.java @@ -14,6 +14,7 @@ import android.widget.ImageView; 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.fragments.StatusEditHistoryFragment; import org.joinmastodon.android.fragments.account_list.StatusFavoritesListFragment; @@ -34,12 +35,14 @@ import me.grishka.appkit.Nav; public class ExtendedFooterStatusDisplayItem extends StatusDisplayItem{ public final Status status; + public final String accountID; private static final DateTimeFormatter TIME_FORMATTER=DateTimeFormatter.ofLocalizedDateTime(FormatStyle.LONG, FormatStyle.SHORT); - public ExtendedFooterStatusDisplayItem(String parentID, BaseStatusListFragment parentFragment, Status status){ + public ExtendedFooterStatusDisplayItem(String parentID, BaseStatusListFragment parentFragment, String accountID, Status status){ super(parentID, parentFragment); this.status=status; + this.accountID=accountID; } @Override @@ -75,7 +78,7 @@ public class ExtendedFooterStatusDisplayItem extends StatusDisplayItem{ favorites.setText(context.getResources().getQuantityString(R.plurals.x_favorites, (int)(s.favouritesCount%1000), s.favouritesCount)); reblogs.setText(context.getResources().getQuantityString(R.plurals.x_reblogs, (int) (s.reblogsCount % 1000), s.reblogsCount)); - if (s.visibility==StatusPrivacy.DIRECT) + if (!s.canBeBoosted(item.accountID)) reblogs.setVisibility(View.GONE); if(s.editedAt!=null){