Fix #298
This commit is contained in:
parent
bfa48c2d3e
commit
77a2fd2a60
|
@ -4,7 +4,7 @@ import org.joinmastodon.android.model.Status;
|
||||||
|
|
||||||
public class StatusCountersUpdatedEvent{
|
public class StatusCountersUpdatedEvent{
|
||||||
public String id;
|
public String id;
|
||||||
public int favorites, reblogs, replies;
|
public long favorites, reblogs, replies;
|
||||||
public boolean favorited, reblogged;
|
public boolean favorited, reblogged;
|
||||||
|
|
||||||
public StatusCountersUpdatedEvent(Status s){
|
public StatusCountersUpdatedEvent(Status s){
|
||||||
|
|
|
@ -408,7 +408,7 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
|
||||||
|
|
||||||
private void bindHeaderView(){
|
private void bindHeaderView(){
|
||||||
setTitle(account.displayName);
|
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(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));
|
ViewImageLoader.load(cover, null, new UrlImageLoaderRequest(GlobalUserPreferences.playGifs ? account.header : account.headerStatic, 1000, 1000));
|
||||||
SpannableStringBuilder ssb=new SpannableStringBuilder(account.displayName);
|
SpannableStringBuilder ssb=new SpannableStringBuilder(account.displayName);
|
||||||
|
@ -445,9 +445,9 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
|
||||||
followersCount.setText(UiUtils.abbreviateNumber(account.followersCount));
|
followersCount.setText(UiUtils.abbreviateNumber(account.followersCount));
|
||||||
followingCount.setText(UiUtils.abbreviateNumber(account.followingCount));
|
followingCount.setText(UiUtils.abbreviateNumber(account.followingCount));
|
||||||
postsCount.setText(UiUtils.abbreviateNumber(account.statusesCount));
|
postsCount.setText(UiUtils.abbreviateNumber(account.statusesCount));
|
||||||
followersLabel.setText(getResources().getQuantityString(R.plurals.followers, Math.min(999, account.followersCount)));
|
followersLabel.setText(getResources().getQuantityString(R.plurals.followers, (int)Math.min(999, account.followersCount)));
|
||||||
followingLabel.setText(getResources().getQuantityString(R.plurals.following, Math.min(999, account.followingCount)));
|
followingLabel.setText(getResources().getQuantityString(R.plurals.following, (int)Math.min(999, account.followingCount)));
|
||||||
postsLabel.setText(getResources().getQuantityString(R.plurals.posts, Math.min(999, account.statusesCount)));
|
postsLabel.setText(getResources().getQuantityString(R.plurals.posts, (int)Math.min(999, account.statusesCount)));
|
||||||
|
|
||||||
UiUtils.loadCustomEmojiInTextView(name);
|
UiUtils.loadCustomEmojiInTextView(name);
|
||||||
UiUtils.loadCustomEmojiInTextView(bio);
|
UiUtils.loadCustomEmojiInTextView(bio);
|
||||||
|
|
|
@ -12,7 +12,7 @@ public class FollowerListFragment extends AccountRelatedAccountListFragment{
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState){
|
public void onCreate(Bundle savedInstanceState){
|
||||||
super.onCreate(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
|
@Override
|
||||||
|
|
|
@ -12,7 +12,7 @@ public class FollowingListFragment extends AccountRelatedAccountListFragment{
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState){
|
public void onCreate(Bundle savedInstanceState){
|
||||||
super.onCreate(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
|
@Override
|
||||||
|
|
|
@ -11,7 +11,7 @@ public class StatusFavoritesListFragment extends StatusRelatedAccountListFragmen
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState){
|
public void onCreate(Bundle savedInstanceState){
|
||||||
super.onCreate(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
|
@Override
|
||||||
|
|
|
@ -11,7 +11,7 @@ public class StatusReblogsListFragment extends StatusRelatedAccountListFragment{
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState){
|
public void onCreate(Bundle savedInstanceState){
|
||||||
super.onCreate(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
|
@Override
|
||||||
|
|
|
@ -220,9 +220,9 @@ public class DiscoverAccountsFragment extends BaseRecyclerFragment<DiscoverAccou
|
||||||
followersCount.setText(UiUtils.abbreviateNumber(item.account.followersCount));
|
followersCount.setText(UiUtils.abbreviateNumber(item.account.followersCount));
|
||||||
followingCount.setText(UiUtils.abbreviateNumber(item.account.followingCount));
|
followingCount.setText(UiUtils.abbreviateNumber(item.account.followingCount));
|
||||||
postsCount.setText(UiUtils.abbreviateNumber(item.account.statusesCount));
|
postsCount.setText(UiUtils.abbreviateNumber(item.account.statusesCount));
|
||||||
followersLabel.setText(getResources().getQuantityString(R.plurals.followers, Math.min(999, item.account.followersCount)));
|
followersLabel.setText(getResources().getQuantityString(R.plurals.followers, (int)Math.min(999, item.account.followersCount)));
|
||||||
followingLabel.setText(getResources().getQuantityString(R.plurals.following, Math.min(999, item.account.followingCount)));
|
followingLabel.setText(getResources().getQuantityString(R.plurals.following, (int)Math.min(999, item.account.followingCount)));
|
||||||
postsLabel.setText(getResources().getQuantityString(R.plurals.posts, Math.min(999, item.account.statusesCount)));
|
postsLabel.setText(getResources().getQuantityString(R.plurals.posts, (int)Math.min(999, item.account.statusesCount)));
|
||||||
relationship=relationships.get(item.account.id);
|
relationship=relationships.get(item.account.id);
|
||||||
if(relationship==null){
|
if(relationship==null){
|
||||||
actionWrap.setVisibility(View.GONE);
|
actionWrap.setVisibility(View.GONE);
|
||||||
|
|
|
@ -96,15 +96,15 @@ public class Account extends BaseModel{
|
||||||
/**
|
/**
|
||||||
* How many statuses are attached to this account.
|
* How many statuses are attached to this account.
|
||||||
*/
|
*/
|
||||||
public int statusesCount;
|
public long statusesCount;
|
||||||
/**
|
/**
|
||||||
* The reported followers of this profile.
|
* The reported followers of this profile.
|
||||||
*/
|
*/
|
||||||
public int followersCount;
|
public long followersCount;
|
||||||
/**
|
/**
|
||||||
* The reported follows of this profile.
|
* The reported follows of this profile.
|
||||||
*/
|
*/
|
||||||
public int followingCount;
|
public long followingCount;
|
||||||
|
|
||||||
// Optional attributes
|
// Optional attributes
|
||||||
|
|
||||||
|
|
|
@ -34,9 +34,9 @@ public class Status extends BaseModel implements DisplayItemsParent{
|
||||||
public List<Hashtag> tags;
|
public List<Hashtag> tags;
|
||||||
@RequiredField
|
@RequiredField
|
||||||
public List<Emoji> emojis;
|
public List<Emoji> emojis;
|
||||||
public int reblogsCount;
|
public long reblogsCount;
|
||||||
public int favouritesCount;
|
public long favouritesCount;
|
||||||
public int repliesCount;
|
public long repliesCount;
|
||||||
public Instant editedAt;
|
public Instant editedAt;
|
||||||
|
|
||||||
public String url;
|
public String url;
|
||||||
|
|
|
@ -115,9 +115,9 @@ public class AccountCardStatusDisplayItem extends StatusDisplayItem{
|
||||||
followersCount.setText(UiUtils.abbreviateNumber(item.account.followersCount));
|
followersCount.setText(UiUtils.abbreviateNumber(item.account.followersCount));
|
||||||
followingCount.setText(UiUtils.abbreviateNumber(item.account.followingCount));
|
followingCount.setText(UiUtils.abbreviateNumber(item.account.followingCount));
|
||||||
postsCount.setText(UiUtils.abbreviateNumber(item.account.statusesCount));
|
postsCount.setText(UiUtils.abbreviateNumber(item.account.statusesCount));
|
||||||
followersLabel.setText(item.parentFragment.getResources().getQuantityString(R.plurals.followers, Math.min(999, item.account.followersCount)));
|
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, Math.min(999, item.account.followingCount)));
|
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, Math.min(999, item.account.statusesCount)));
|
postsLabel.setText(item.parentFragment.getResources().getQuantityString(R.plurals.posts, (int)Math.min(999, item.account.statusesCount)));
|
||||||
relationship=item.parentFragment.getRelationship(item.account.id);
|
relationship=item.parentFragment.getRelationship(item.account.id);
|
||||||
if(relationship==null){
|
if(relationship==null){
|
||||||
actionWrap.setVisibility(View.GONE);
|
actionWrap.setVisibility(View.GONE);
|
||||||
|
|
|
@ -91,7 +91,7 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{
|
||||||
|| (item.status.visibility==StatusPrivacy.PRIVATE && item.status.account.id.equals(AccountSessionManager.getInstance().getAccount(item.accountID).self.id)));
|
|| (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){
|
if(count>0 && !item.hideCounts){
|
||||||
btn.setText(DecimalFormat.getIntegerInstance().format(count));
|
btn.setText(DecimalFormat.getIntegerInstance().format(count));
|
||||||
btn.setCompoundDrawablePadding(V.dp(8));
|
btn.setCompoundDrawablePadding(V.dp(8));
|
||||||
|
|
|
@ -180,6 +180,15 @@ public class UiUtils{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("DefaultLocale")
|
||||||
|
public static String abbreviateNumber(long n){
|
||||||
|
if(n<Integer.MAX_VALUE)
|
||||||
|
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.
|
* 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.
|
* This works around it by setting the tint colors directly to the drawables.
|
||||||
|
|
Loading…
Reference in New Issue