|
|
|
|
@ -395,38 +395,42 @@ class HandHistoryViewModel : ViewModel(), RowRepresentableDataSource, CardCentra |
|
|
|
|
* Sets the typed amount in the relevant ComputedAction |
|
|
|
|
*/ |
|
|
|
|
fun amountValidated() { |
|
|
|
|
try { |
|
|
|
|
this.currentAmount?.toDouble()?.let { amount -> |
|
|
|
|
|
|
|
|
|
val row = this.rowRepresentables[this.currentSelection.index] |
|
|
|
|
when (row) { |
|
|
|
|
HandRowType.BLINDS -> { |
|
|
|
|
when (this.currentSelection.tag) { |
|
|
|
|
0 -> { |
|
|
|
|
this.handHistory.smallBlind = amount |
|
|
|
|
this.sortedActions.updateBlinds() |
|
|
|
|
} |
|
|
|
|
1 -> { |
|
|
|
|
this.handHistory.bigBlind = amount |
|
|
|
|
this.sortedActions.updateBlinds() |
|
|
|
|
} |
|
|
|
|
2 -> this.handHistory.ante = amount |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
is ComputedAction -> { |
|
|
|
|
this.sortedActions.setAmount(this.actionIndexForSelection, amount) |
|
|
|
|
|
|
|
|
|
val amount = try { |
|
|
|
|
this.currentAmount?.toDouble() |
|
|
|
|
} catch (e: NumberFormatException) { |
|
|
|
|
Timber.w("Parsing exception: ${e.message}") |
|
|
|
|
null |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
val row = this.rowRepresentables[this.currentSelection.index] |
|
|
|
|
when (row) { |
|
|
|
|
HandRowType.BLINDS -> { |
|
|
|
|
when (this.currentSelection.tag) { |
|
|
|
|
0 -> { |
|
|
|
|
this.handHistory.smallBlind = amount |
|
|
|
|
this.sortedActions.updateBlinds() |
|
|
|
|
} |
|
|
|
|
is PlayerSetupRow -> { |
|
|
|
|
row.setStack(amount) |
|
|
|
|
1 -> { |
|
|
|
|
this.handHistory.bigBlind = amount |
|
|
|
|
this.sortedActions.updateBlinds() |
|
|
|
|
} |
|
|
|
|
else -> {} |
|
|
|
|
2 -> this.handHistory.ante = amount ?: 0.0 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.currentAmount = null |
|
|
|
|
} |
|
|
|
|
} catch (e: NumberFormatException) { |
|
|
|
|
Timber.w("Parsing exception: ${e.message}") |
|
|
|
|
is ComputedAction -> { |
|
|
|
|
amount?.let { |
|
|
|
|
this.sortedActions.setAmount(this.actionIndexForSelection, amount) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
is PlayerSetupRow -> { |
|
|
|
|
row.setStack(amount) |
|
|
|
|
} |
|
|
|
|
else -> {} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.currentAmount = null |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
|