Skip to content

Commit

Permalink
Merge branch 'shorten-big-prices'
Browse files Browse the repository at this point in the history
  • Loading branch information
shorthouse committed Apr 2, 2024
2 parents 905bab0 + e6b15ca commit cd96f17
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions app/src/main/java/dev/shorthouse/coinwatch/model/Price.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@ data class Price(val price: String?, val currency: Currency = Currency.USD) : Co
currencyFormat
}

val formattedAmount: String by lazy {
when {
price.isNullOrBlank() -> "${currency.symbol}--"
amount in belowOneThreshold -> currencyFormat.format(amount)
amount in smallThreshold -> currencyFormat.format(amount)
else -> formatLargeAmount()
}
val formattedAmount: String = when {
price.isNullOrBlank() -> "${currency.symbol}--"
amount in belowOneThreshold -> currencyFormat.format(amount)
amount in smallThreshold -> currencyFormat.format(amount)
else -> formatLargeAmount()
}

private fun formatLargeAmount(): String {
Expand Down

0 comments on commit cd96f17

Please sign in to comment.