@@ -100,7 +100,14 @@ internal fun formatBitcoinPlaceholder(
100100 displayUnit : BitcoinDisplayUnit ,
101101 locale : Locale = Locale .getDefault(),
102102): String {
103- if (btcValue.isEmpty() || displayUnit.isModern()) return " "
103+ if (btcValue.isEmpty()) {
104+ return if (displayUnit.isModern()) {
105+ ZERO_PLACEHOLDER
106+ } else {
107+ ZERO_PLACEHOLDER + DECIMAL_SEPARATOR + " 0" .repeat(CLASSIC_DECIMALS )
108+ }
109+ }
110+ if (displayUnit.isModern()) return " "
104111 val normalizedBtcValue = sanitizeDecimalInput(
105112 raw = normalizeCalculatorDecimalInput(
106113 rawValue = btcValue,
@@ -112,14 +119,15 @@ internal fun formatBitcoinPlaceholder(
112119 return formatMissingDecimalZeros(
113120 value = normalizedBtcValue,
114121 maxDecimalPlaces = CLASSIC_DECIMALS ,
122+ includeDecimalSeparatorIfMissing = true ,
115123 )
116124}
117125
118126internal fun formatFiatPlaceholder (
119127 fiatValue : String ,
120128 locale : Locale = Locale .getDefault(),
121129): String {
122- if (fiatValue.isEmpty()) return " "
130+ if (fiatValue.isEmpty()) return ZERO_PLACEHOLDER
123131 val normalizedFiatValue = sanitizeDecimalInput(
124132 raw = normalizeCalculatorDecimalInput(
125133 rawValue = fiatValue,
@@ -268,8 +276,15 @@ private fun formatGroupedIntegerPreservingZeros(
268276private fun formatMissingDecimalZeros (
269277 value : String ,
270278 maxDecimalPlaces : Int ,
279+ includeDecimalSeparatorIfMissing : Boolean = false,
271280): String {
272- if (! value.contains(PERIOD_SEPARATOR )) return " "
281+ if (! value.contains(PERIOD_SEPARATOR )) {
282+ return if (includeDecimalSeparatorIfMissing) {
283+ DECIMAL_SEPARATOR + " 0" .repeat(maxDecimalPlaces)
284+ } else {
285+ " "
286+ }
287+ }
273288
274289 val decimalLength = value.substringAfter(PERIOD_SEPARATOR ).length
275290 val remainingDecimals = maxDecimalPlaces - decimalLength
@@ -298,5 +313,6 @@ private fun BigDecimal.toSatsLongClamped(): Long {
298313private val MAX_SATS_DECIMAL = BigDecimal .valueOf(Long .MAX_VALUE )
299314
300315private const val GROUP_SIZE = 3
316+ private const val ZERO_PLACEHOLDER = " 0"
301317private const val COMMA_SEPARATOR = ' ,'
302318private const val PERIOD_SEPARATOR = ' .'
0 commit comments