|
|
|
|
@ -26,9 +26,11 @@ import net.pokeranalytics.android.ui.modules.handhistory.views.CardCentralizer |
|
|
|
|
import net.pokeranalytics.android.ui.view.RowRepresentable |
|
|
|
|
import net.pokeranalytics.android.ui.view.RowRepresentableEditDescriptor |
|
|
|
|
import net.pokeranalytics.android.ui.view.rows.CustomizableRowRepresentable |
|
|
|
|
import net.pokeranalytics.android.util.CrashLogging |
|
|
|
|
import net.pokeranalytics.android.util.extensions.findById |
|
|
|
|
import net.pokeranalytics.android.util.extensions.formatted |
|
|
|
|
import timber.log.Timber |
|
|
|
|
import java.lang.Exception |
|
|
|
|
import java.text.DecimalFormat |
|
|
|
|
import java.text.ParseException |
|
|
|
|
import kotlin.coroutines.CoroutineContext |
|
|
|
|
@ -543,17 +545,24 @@ class EditorViewModel : ViewModel(), RowRepresentableDataSource, CardCentralizer |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
when (val row = this.rowRepresentables[this.currentSelection.index]) { |
|
|
|
|
is ComputedAction -> { |
|
|
|
|
this.sortedActions.setAmount(this.actionIndexForSelection, amount) |
|
|
|
|
} |
|
|
|
|
is PlayerSetupRow -> { |
|
|
|
|
row.setStack(amount) |
|
|
|
|
this.sortedActions.updateRemainingStacksForPositions(listOf(row.positionIndex)) |
|
|
|
|
try { // can crash in setAmount for example |
|
|
|
|
when (val row = this.rowRepresentables[this.currentSelection.index]) { |
|
|
|
|
is ComputedAction -> { |
|
|
|
|
this.sortedActions.setAmount(this.actionIndexForSelection, amount) |
|
|
|
|
} |
|
|
|
|
is PlayerSetupRow -> { |
|
|
|
|
row.setStack(amount) |
|
|
|
|
this.sortedActions.updateRemainingStacksForPositions(listOf(row.positionIndex)) |
|
|
|
|
} |
|
|
|
|
else -> {} |
|
|
|
|
} |
|
|
|
|
else -> {} |
|
|
|
|
} catch (e: Exception) { |
|
|
|
|
val actions = this.sortedActions.joinToString("\n") { it.logRepresentation } |
|
|
|
|
CrashLogging.log(actions) |
|
|
|
|
throw e |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.currentAmount = null |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|