|
|
|
|
@ -124,12 +124,17 @@ class ComputedStat(var stat: Stat, var value: Double, var currency: Currency? = |
|
|
|
|
|
|
|
|
|
when (this.stat) { |
|
|
|
|
// Amounts + red/green |
|
|
|
|
Stat.NETRESULT, Stat.HOURLY_RATE, Stat.AVERAGE, Stat.NET_BB_PER_100_HANDS, Stat.HOURLY_RATE_BB, |
|
|
|
|
Stat.AVERAGE_NET_BB -> { |
|
|
|
|
Stat.NETRESULT, Stat.HOURLY_RATE, Stat.AVERAGE -> { |
|
|
|
|
val numberFormat= CurrencyUtils.getCurrencyFormatter(context, currency) |
|
|
|
|
val color = if (this.value >= this.stat.threshold) R.color.green else R.color.red |
|
|
|
|
return TextFormat(numberFormat.format(this.value), color) |
|
|
|
|
} // white integers |
|
|
|
|
} |
|
|
|
|
// Red/green values |
|
|
|
|
Stat.HOURLY_RATE_BB, Stat.AVERAGE_NET_BB, Stat.NET_BB_PER_100_HANDS -> { |
|
|
|
|
val color = if (this.value >= this.stat.threshold) R.color.green else R.color.red |
|
|
|
|
return TextFormat(this.value.formatted(), color) |
|
|
|
|
} |
|
|
|
|
// white integers |
|
|
|
|
Stat.NUMBER_OF_SETS, Stat.NUMBER_OF_GAMES, Stat.HANDS_PLAYED -> { |
|
|
|
|
return TextFormat("${value.toInt()}") |
|
|
|
|
} // white durations |
|
|
|
|
|