Fixes stat unit and label

feature/top10
Laurent 7 years ago
parent 1d73eef09c
commit 20b089ff27
  1. 11
      app/src/main/java/net/pokeranalytics/android/calculus/Stat.kt
  2. 2
      app/src/main/res/values/strings.xml

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

@ -13,7 +13,7 @@
<string name="number_of_groups">Number of sessions</string> <string name="number_of_groups">Number of sessions</string>
<string name="number_of_games">Number of games</string> <string name="number_of_games">Number of games</string>
<string name="average_duration">Average duration</string> <string name="average_duration">Average duration</string>
<string name="net_bb_per_100_hands">Net(BB) per 100 hands</string> <string name="net_bb_per_100_hands">Net per 100 hands (BB)</string>
<string name="hourly_rate_bb">Hourly rate (BB)</string> <string name="hourly_rate_bb">Hourly rate (BB)</string>
<string name="average_net_bb">Average net (BB)</string> <string name="average_net_bb">Average net (BB)</string>
<string name="roi">ROI</string> <string name="roi">ROI</string>

Loading…
Cancel
Save