use of android.icu.text.NumberFormat in project android_packages_apps_Settings by omnirom.
the class FileSizeFormatter method formatRoundedBytesResult.
private static String formatRoundedBytesResult(@NonNull Context context, @NonNull RoundedBytesResult input) {
final Locale locale = localeFromContext(context);
final NumberFormat numberFormatter = getNumberFormatter(locale, input.fractionDigits);
return formatMeasureShort(locale, numberFormatter, input.value, input.units);
}
use of android.icu.text.NumberFormat in project android_packages_apps_Settings by crdroidandroid.
the class FileSizeFormatter method formatRoundedBytesResult.
private static String formatRoundedBytesResult(@NonNull Context context, @NonNull RoundedBytesResult input) {
final Locale locale = localeFromContext(context);
final NumberFormat numberFormatter = getNumberFormatter(locale, input.fractionDigits);
return formatMeasureShort(locale, numberFormatter, input.value, input.units);
}
use of android.icu.text.NumberFormat in project android_packages_apps_Settings by SudaMod.
the class FileSizeFormatter method formatRoundedBytesResult.
private static String formatRoundedBytesResult(@NonNull Context context, @NonNull RoundedBytesResult input) {
final Locale locale = localeFromContext(context);
final NumberFormat numberFormatter = getNumberFormatter(locale, input.fractionDigits);
return formatMeasureShort(locale, numberFormatter, input.value, input.units);
}
use of android.icu.text.NumberFormat in project android_packages_apps_Settings by DirtyUnicorns.
the class FileSizeFormatter method getNumberFormatter.
private static NumberFormat getNumberFormatter(Locale locale, int fractionDigits) {
final NumberFormat numberFormatter = NumberFormat.getInstance(locale);
numberFormatter.setMinimumFractionDigits(fractionDigits);
numberFormatter.setMaximumFractionDigits(fractionDigits);
numberFormatter.setGroupingUsed(false);
if (numberFormatter instanceof DecimalFormat) {
// We do this only for DecimalFormat, since in the general NumberFormat case, calling
// setRoundingMode may throw an exception.
numberFormatter.setRoundingMode(BigDecimal.ROUND_HALF_UP);
}
return numberFormatter;
}
use of android.icu.text.NumberFormat in project android_packages_apps_Settings by DirtyUnicorns.
the class FileSizeFormatter method formatRoundedBytesResult.
private static String formatRoundedBytesResult(@NonNull Context context, @NonNull RoundedBytesResult input) {
final Locale locale = localeFromContext(context);
final NumberFormat numberFormatter = getNumberFormatter(locale, input.fractionDigits);
return formatMeasureShort(locale, numberFormatter, input.value, input.units);
}
Aggregations