|
|
|
|
@ -39,7 +39,12 @@ class HandHistoryViewModel : ViewModel(), RowRepresentableDataSource, CardCentra |
|
|
|
|
private set |
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
* |
|
|
|
|
* The hand setup |
|
|
|
|
*/ |
|
|
|
|
private var handSetup: HandSetup = HandSetup() |
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
* Indicats whether the HH is new or not |
|
|
|
|
*/ |
|
|
|
|
private var isNew: Boolean = true |
|
|
|
|
|
|
|
|
|
@ -102,11 +107,6 @@ class HandHistoryViewModel : ViewModel(), RowRepresentableDataSource, CardCentra |
|
|
|
|
*/ |
|
|
|
|
private var firstStraddlePosition: Position? = null |
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
* The hand setup |
|
|
|
|
*/ |
|
|
|
|
private var handSetup: HandSetup = HandSetup() |
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
* The board cards sorted by position |
|
|
|
|
*/ |
|
|
|
|
@ -161,7 +161,7 @@ class HandHistoryViewModel : ViewModel(), RowRepresentableDataSource, CardCentra |
|
|
|
|
* Pre-computes the potsizes for the video export |
|
|
|
|
*/ |
|
|
|
|
private fun load() { |
|
|
|
|
this.setNumberOfPlayers(handHistory.numberOfPlayers) |
|
|
|
|
this.sortedActions.positions = Position.positionsPerPlayers(this.handHistory.numberOfPlayers) |
|
|
|
|
this.sortedActions.load(this.handHistory) |
|
|
|
|
this.createRowRepresentation() |
|
|
|
|
} |
|
|
|
|
@ -174,9 +174,9 @@ class HandHistoryViewModel : ViewModel(), RowRepresentableDataSource, CardCentra |
|
|
|
|
|
|
|
|
|
rows.add(HandRowType.COMMENT) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rows.add(CustomizableRowRepresentable(customViewType = HandRowType.HEADER, resId = R.string.settings, value = "")) |
|
|
|
|
|
|
|
|
|
rows.add(HandRowType.PLAYER_NUMBER) |
|
|
|
|
rows.add(HandRowType.BLINDS) |
|
|
|
|
|
|
|
|
|
if (this.isNew) { // don't allow any straddle changes if not new |
|
|
|
|
@ -243,9 +243,12 @@ class HandHistoryViewModel : ViewModel(), RowRepresentableDataSource, CardCentra |
|
|
|
|
* Sets the number of players playing the hand |
|
|
|
|
* Defines the appropriate positions for this player count |
|
|
|
|
*/ |
|
|
|
|
private fun setNumberOfPlayers(playerCount: Int) { |
|
|
|
|
fun setNumberOfPlayers(playerCount: Int) { |
|
|
|
|
if (playerCount != this.handHistory.numberOfPlayers) { |
|
|
|
|
this.handHistory.numberOfPlayers = playerCount |
|
|
|
|
this.sortedActions.positions = Position.positionsPerPlayers(playerCount) |
|
|
|
|
this.handHistory.configure(this.handSetup) |
|
|
|
|
load() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
@ -437,7 +440,6 @@ class HandHistoryViewModel : ViewModel(), RowRepresentableDataSource, CardCentra |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Card Centralizer |
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
@ -536,6 +538,7 @@ class HandHistoryViewModel : ViewModel(), RowRepresentableDataSource, CardCentra |
|
|
|
|
override fun stringForRow(row: RowRepresentable, context: Context, tag: Int): String { |
|
|
|
|
|
|
|
|
|
return when (row) { |
|
|
|
|
HandRowType.PLAYER_NUMBER -> this.handHistory.numberOfPlayers.toString() |
|
|
|
|
HandRowType.COMMENT -> this.handHistory.comment ?: context.getString(R.string.comment) |
|
|
|
|
HandRowType.BLINDS -> { |
|
|
|
|
when (tag) { |
|
|
|
|
|