Avoid selecting multiple stats for progress report

split
Laurent 5 years ago
parent 86cf721bbd
commit 21ad16c4c3
  1. 9
      app/src/main/java/net/pokeranalytics/android/calculus/Calculator.kt
  2. 18
      app/src/main/java/net/pokeranalytics/android/ui/fragment/ReportCreationFragment.kt

@ -107,6 +107,15 @@ class Calculator {
else -> false
}
}
val multipleStatSelection: Boolean
get() {
return when (this) {
PROGRESS -> false
else -> true
}
}
}
/**

@ -259,12 +259,22 @@ class Assistant {
this.nextStep()
}
Step.STAT -> {
val stat = this.dataSource[position] as Stat
if (this.stats.contains(stat)) {
this.stats.remove(stat)
} else {
this.stats.add(stat)
when (this.display.multipleStatSelection) {
true -> {
if (this.stats.contains(stat)) {
this.stats.remove(stat)
} else {
this.stats.add(stat)
}
}
false -> {
this.stats.clear()
this.stats.add(stat)
}
}
}
Step.COMPARATOR -> {
val item = this.dataSource[position]

Loading…
Cancel
Save