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 else -> false
} }
} }
val multipleStatSelection: Boolean
get() {
return when (this) {
PROGRESS -> false
else -> true
}
}
} }
/** /**

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

Loading…
Cancel
Save