diff --git a/mastodon/src/main/java/org/joinmastodon/android/events/StatusCountersUpdatedEvent.java b/mastodon/src/main/java/org/joinmastodon/android/events/StatusCountersUpdatedEvent.java index 2e26e9b50..a786e9c70 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/events/StatusCountersUpdatedEvent.java +++ b/mastodon/src/main/java/org/joinmastodon/android/events/StatusCountersUpdatedEvent.java @@ -4,7 +4,7 @@ import org.joinmastodon.android.model.Status; public class StatusCountersUpdatedEvent{ public String id; - public int favorites, reblogs, replies; + public long favorites, reblogs, replies; public boolean favorited, reblogged, pinned; public StatusCountersUpdatedEvent(Status s){ diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java index 1a10e5aea..265596e30 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java @@ -570,6 +570,7 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr if(editingStatus!=null){ updateCharCounter(); + visibilityBtn.setEnabled(false); } } diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java index 31d7e3895..779189fcd 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java @@ -414,7 +414,7 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList private void bindHeaderView(){ setTitle(account.displayName); - setSubtitle(getResources().getQuantityString(R.plurals.x_posts, account.statusesCount, account.statusesCount)); + setSubtitle(getResources().getQuantityString(R.plurals.x_posts, (int)(account.statusesCount%1000), account.statusesCount)); ViewImageLoader.load(avatar, null, new UrlImageLoaderRequest(GlobalUserPreferences.playGifs ? account.avatar : account.avatarStatic, V.dp(100), V.dp(100))); ViewImageLoader.load(cover, null, new UrlImageLoaderRequest(GlobalUserPreferences.playGifs ? account.header : account.headerStatic, 1000, 1000)); SpannableStringBuilder ssb=new SpannableStringBuilder(account.displayName); @@ -451,9 +451,9 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList followersCount.setText(UiUtils.abbreviateNumber(account.followersCount)); followingCount.setText(UiUtils.abbreviateNumber(account.followingCount)); postsCount.setText(UiUtils.abbreviateNumber(account.statusesCount)); - followersLabel.setText(getResources().getQuantityString(R.plurals.followers, Math.min(999, account.followersCount))); - followingLabel.setText(getResources().getQuantityString(R.plurals.following, Math.min(999, account.followingCount))); - postsLabel.setText(getResources().getQuantityString(R.plurals.posts, Math.min(999, account.statusesCount))); + followersLabel.setText(getResources().getQuantityString(R.plurals.followers, (int)Math.min(999, account.followersCount))); + followingLabel.setText(getResources().getQuantityString(R.plurals.following, (int)Math.min(999, account.followingCount))); + postsLabel.setText(getResources().getQuantityString(R.plurals.posts, (int)Math.min(999, account.statusesCount))); UiUtils.loadCustomEmojiInTextView(name); UiUtils.loadCustomEmojiInTextView(bio); diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/account_list/FollowerListFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/account_list/FollowerListFragment.java index 3642fbacb..1a7b3c8e2 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/account_list/FollowerListFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/account_list/FollowerListFragment.java @@ -12,7 +12,7 @@ public class FollowerListFragment extends AccountRelatedAccountListFragment{ @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); - setSubtitle(getResources().getQuantityString(R.plurals.x_followers, account.followersCount, account.followersCount)); + setSubtitle(getResources().getQuantityString(R.plurals.x_followers, (int)(account.followersCount%1000), account.followersCount)); } @Override diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/account_list/FollowingListFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/account_list/FollowingListFragment.java index d1daf9992..83351e751 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/account_list/FollowingListFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/account_list/FollowingListFragment.java @@ -12,7 +12,7 @@ public class FollowingListFragment extends AccountRelatedAccountListFragment{ @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); - setSubtitle(getResources().getQuantityString(R.plurals.x_following, account.followingCount, account.followingCount)); + setSubtitle(getResources().getQuantityString(R.plurals.x_following, (int)(account.followingCount%1000), account.followingCount)); } @Override diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/account_list/StatusFavoritesListFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/account_list/StatusFavoritesListFragment.java index 50a71d62f..f62e40ac5 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/account_list/StatusFavoritesListFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/account_list/StatusFavoritesListFragment.java @@ -11,7 +11,7 @@ public class StatusFavoritesListFragment extends StatusRelatedAccountListFragmen @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); - setTitle(getResources().getQuantityString(R.plurals.x_favorites, status.favouritesCount, status.favouritesCount)); + setTitle(getResources().getQuantityString(R.plurals.x_favorites, (int)(status.favouritesCount%1000), status.favouritesCount)); } @Override diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/account_list/StatusReblogsListFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/account_list/StatusReblogsListFragment.java index e2cb0c0ad..6d494e198 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/account_list/StatusReblogsListFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/account_list/StatusReblogsListFragment.java @@ -11,7 +11,7 @@ public class StatusReblogsListFragment extends StatusRelatedAccountListFragment{ @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); - setTitle(getResources().getQuantityString(R.plurals.x_reblogs, status.reblogsCount, status.reblogsCount)); + setTitle(getResources().getQuantityString(R.plurals.x_reblogs, (int)(status.reblogsCount%1000), status.reblogsCount)); } @Override diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/DiscoverAccountsFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/DiscoverAccountsFragment.java index 9216cf545..fb95db010 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/DiscoverAccountsFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/DiscoverAccountsFragment.java @@ -220,9 +220,9 @@ public class DiscoverAccountsFragment extends BaseRecyclerFragment tags; @RequiredField public List emojis; - public int reblogsCount; - public int favouritesCount; - public int repliesCount; + public long reblogsCount; + public long favouritesCount; + public long repliesCount; public Instant editedAt; public String url; diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/AccountCardStatusDisplayItem.java b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/AccountCardStatusDisplayItem.java index 196aa51af..9fb35ddeb 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/AccountCardStatusDisplayItem.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/AccountCardStatusDisplayItem.java @@ -115,9 +115,9 @@ public class AccountCardStatusDisplayItem extends StatusDisplayItem{ followersCount.setText(UiUtils.abbreviateNumber(item.account.followersCount)); followingCount.setText(UiUtils.abbreviateNumber(item.account.followingCount)); postsCount.setText(UiUtils.abbreviateNumber(item.account.statusesCount)); - followersLabel.setText(item.parentFragment.getResources().getQuantityString(R.plurals.followers, Math.min(999, item.account.followersCount))); - followingLabel.setText(item.parentFragment.getResources().getQuantityString(R.plurals.following, Math.min(999, item.account.followingCount))); - postsLabel.setText(item.parentFragment.getResources().getQuantityString(R.plurals.posts, Math.min(999, item.account.statusesCount))); + followersLabel.setText(item.parentFragment.getResources().getQuantityString(R.plurals.followers, (int)Math.min(999, item.account.followersCount))); + followingLabel.setText(item.parentFragment.getResources().getQuantityString(R.plurals.following, (int)Math.min(999, item.account.followingCount))); + postsLabel.setText(item.parentFragment.getResources().getQuantityString(R.plurals.posts, (int)Math.min(999, item.account.statusesCount))); relationship=item.parentFragment.getRelationship(item.account.id); if(relationship==null){ actionWrap.setVisibility(View.GONE); diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/FooterStatusDisplayItem.java b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/FooterStatusDisplayItem.java index 145726021..e83f6d33b 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/FooterStatusDisplayItem.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/FooterStatusDisplayItem.java @@ -97,7 +97,7 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{ || (item.status.visibility==StatusPrivacy.PRIVATE && item.status.account.id.equals(AccountSessionManager.getInstance().getAccount(item.accountID).self.id))); } - private void bindButton(TextView btn, int count){ + private void bindButton(TextView btn, long count){ if(count>0 && !item.hideCounts){ btn.setText(DecimalFormat.getIntegerInstance().format(count)); btn.setCompoundDrawablePadding(V.dp(8)); diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/utils/UiUtils.java b/mastodon/src/main/java/org/joinmastodon/android/ui/utils/UiUtils.java index 4e5c4eaa7..62fb11936 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/utils/UiUtils.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/utils/UiUtils.java @@ -193,6 +193,15 @@ public class UiUtils{ } } + @SuppressLint("DefaultLocale") + public static String abbreviateNumber(long n){ + if(n<1_000_000_000L) + return abbreviateNumber((int)n); + + double a=n/1_000_000_000.0; + return a>99f ? String.format("%,dB", (int)Math.floor(a)) : String.format("%,.1fB", n/1_000_000_000.0); + } + /** * Android 6.0 has a bug where start and end compound drawables don't get tinted. * This works around it by setting the tint colors directly to the drawables.