|
|
|
@ -5,10 +5,9 @@ import net.pokeranalytics.android.R |
|
|
|
import net.pokeranalytics.android.exceptions.FormattingException |
|
|
|
import net.pokeranalytics.android.exceptions.FormattingException |
|
|
|
import net.pokeranalytics.android.ui.view.RowRepresentable |
|
|
|
import net.pokeranalytics.android.ui.view.RowRepresentable |
|
|
|
import net.pokeranalytics.android.ui.view.RowViewType |
|
|
|
import net.pokeranalytics.android.ui.view.RowViewType |
|
|
|
import net.pokeranalytics.android.util.Preferences |
|
|
|
import net.pokeranalytics.android.util.FormatUtils |
|
|
|
import net.pokeranalytics.android.util.formatted |
|
|
|
import net.pokeranalytics.android.util.formatted |
|
|
|
import net.pokeranalytics.android.util.toMinutes |
|
|
|
import net.pokeranalytics.android.util.toMinutes |
|
|
|
import java.text.NumberFormat |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* An enum representing all the types of Session statistics |
|
|
|
* An enum representing all the types of Session statistics |
|
|
|
@ -131,9 +130,7 @@ class ComputedStat(stat: Stat, value: Double) { |
|
|
|
// 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.NET_BB_PER_100_HANDS, Stat.HOURLY_RATE_BB, |
|
|
|
Stat.AVERAGE_NET_BB -> { |
|
|
|
Stat.AVERAGE_NET_BB -> { |
|
|
|
val numberFormat = NumberFormat.getCurrencyInstance(Preferences.getCurrencyLocale(context)) |
|
|
|
val numberFormat= FormatUtils.getCurrencyFormatter(context) |
|
|
|
numberFormat.minimumFractionDigits = 0 |
|
|
|
|
|
|
|
numberFormat.maximumFractionDigits = 2 |
|
|
|
|
|
|
|
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 |
|
|
|
} // white integers |
|
|
|
@ -149,9 +146,7 @@ class ComputedStat(stat: Stat, value: Double) { |
|
|
|
} // white amounts |
|
|
|
} // white amounts |
|
|
|
Stat.AVERAGE_BUYIN, Stat.STANDARD_DEVIATION, Stat.STANDARD_DEVIATION_HOURLY, |
|
|
|
Stat.AVERAGE_BUYIN, Stat.STANDARD_DEVIATION, Stat.STANDARD_DEVIATION_HOURLY, |
|
|
|
Stat.STANDARD_DEVIATION_BB_PER_100_HANDS -> { |
|
|
|
Stat.STANDARD_DEVIATION_BB_PER_100_HANDS -> { |
|
|
|
val numberFormat = NumberFormat.getCurrencyInstance(Preferences.getCurrencyLocale(context)) |
|
|
|
val numberFormat= FormatUtils.getCurrencyFormatter(context) |
|
|
|
numberFormat.minimumFractionDigits = 0 |
|
|
|
|
|
|
|
numberFormat.maximumFractionDigits = 2 |
|
|
|
|
|
|
|
return TextFormat(numberFormat.format(this.value)) |
|
|
|
return TextFormat(numberFormat.format(this.value)) |
|
|
|
} |
|
|
|
} |
|
|
|
else -> throw FormattingException("Stat formatting of ${this.stat.name} not handled") |
|
|
|
else -> throw FormattingException("Stat formatting of ${this.stat.name} not handled") |
|
|
|
|