@@ -190,14 +190,20 @@ public static String shortCount(@NonNull final Context context, final long count
190190
191191 final double value = (double ) count ;
192192 if (count >= 1000000000 ) {
193- return localizeNumber (round (value / 1000000000 ))
194- + context .getString (R .string .short_billion );
193+ final double shortenedValue = value / 1000000000 ;
194+ final int scale = shortenedValue >= 100 ? 0 : 1 ;
195+ return context .getString (R .string .short_billion ,
196+ localizeNumber (round (shortenedValue , scale )));
195197 } else if (count >= 1000000 ) {
196- return localizeNumber (round (value / 1000000 ))
197- + context .getString (R .string .short_million );
198+ final double shortenedValue = value / 1000000 ;
199+ final int scale = shortenedValue >= 100 ? 0 : 1 ;
200+ return context .getString (R .string .short_million ,
201+ localizeNumber (round (shortenedValue , scale )));
198202 } else if (count >= 1000 ) {
199- return localizeNumber (round (value / 1000 ))
200- + context .getString (R .string .short_thousand );
203+ final double shortenedValue = value / 1000 ;
204+ final int scale = shortenedValue >= 100 ? 0 : 1 ;
205+ return context .getString (R .string .short_thousand ,
206+ localizeNumber (round (shortenedValue , scale )));
201207 } else {
202208 return localizeNumber (value );
203209 }
@@ -416,8 +422,8 @@ private static Locale getLocaleFromPrefs(@NonNull final Context context,
416422 }
417423 }
418424
419- private static double round (final double value ) {
420- return new BigDecimal (value ).setScale (1 , RoundingMode .HALF_UP ).doubleValue ();
425+ private static double round (final double value , final int scale ) {
426+ return new BigDecimal (value ).setScale (scale , RoundingMode .HALF_UP ).doubleValue ();
421427 }
422428
423429 private static String getQuantity (@ NonNull final Context context ,
0 commit comments