mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 01:40:07 +01:00
Implement new APIs for Boost badging.
This commit is contained in:
committed by
Greyson Parrelli
parent
48a81da883
commit
186bd9db48
@@ -60,6 +60,11 @@ public final class FiatMoneyUtil {
|
||||
formatter.setMinimumFractionDigits(amount.getCurrency().getDefaultFractionDigits());
|
||||
}
|
||||
|
||||
if (options.trimZerosAfterDecimal) {
|
||||
formatter.setMinimumFractionDigits(0);
|
||||
formatter.setMaximumFractionDigits(amount.getCurrency().getDefaultFractionDigits());
|
||||
}
|
||||
|
||||
String formattedAmount = formatter.format(amount.getAmount());
|
||||
if (amount.getTimestamp() > 0 && options.displayTime) {
|
||||
return resources.getString(R.string.CurrencyAmountFormatter_s_at_s,
|
||||
@@ -106,8 +111,9 @@ public final class FiatMoneyUtil {
|
||||
}
|
||||
|
||||
public static class FormatOptions {
|
||||
private boolean displayTime = true;
|
||||
private boolean withSymbol = true;
|
||||
private boolean displayTime = true;
|
||||
private boolean withSymbol = true;
|
||||
private boolean trimZerosAfterDecimal = false;
|
||||
|
||||
private FormatOptions() {
|
||||
}
|
||||
@@ -121,5 +127,10 @@ public final class FiatMoneyUtil {
|
||||
this.withSymbol = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public @NonNull FormatOptions trimZerosAfterDecimal() {
|
||||
this.trimZerosAfterDecimal = true;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user