Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upOptionally specify to format the badge text for large counts #817
Conversation
…xt for large counts
coveralls
commented
Jul 14, 2017
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.
This comment has been minimized.
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).
|
check #859 to see if it helps |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

javidesmaeeli commentedJul 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.