The Wayback Machine - https://web.archive.org/web/20200927115922/https://github.com/roughike/BottomBar/pull/817
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optionally specify to format the badge text for large counts #817

Open

Conversation

@javidesmaeeli
Copy link

javidesmaeeli commented Jul 14, 2017

Overload a new function for BottomBarBadge.setCount to allow specifying if the badge text should be formatted (summarized) for large counts (1000~1999 to 1K, and so on) which reduces the length of badge text by 2 for large badges, resulting in a more appealing badge.
The default behavior for the setCount(int count) is not altered.

…xt for large counts
@coveralls
Copy link

coveralls commented Jul 14, 2017

Coverage Status

Coverage increased (+0.1%) to 63.406% when pulling aa2e75d on javidesmaeeli:option-to-format-large-badge-counts into 711fcaf on roughike:master.

Copy link

sadegh left a comment

Looks good. 👍

this.count = count;
setText(String.valueOf(count));
if (formatBadge && count > 1000) {
setText(String.format(getResources().getString(R.string.badge_format), count / 1000));

This comment has been minimized.

@sadegh

sadegh Jul 15, 2017

R.string.badge_format can be defined as %1$dK, then you can use it without calling String.format() as follows:
getResources().getString(R.string.badge_format), count / 1000).

@sadegh
sadegh approved these changes Jul 15, 2017
@leonardo2204
Copy link
Contributor

leonardo2204 commented Oct 9, 2017

check #859 to see if it helps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants
You can’t perform that action at this time.