|
|
|
@ -53,6 +53,10 @@ class HandHistoryViewModel : ViewModel(), RowRepresentableDataSource, CardCentra |
|
|
|
* Indicates whether the hand history is being edited or not |
|
|
|
* Indicates whether the hand history is being edited or not |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
var isEdited = true |
|
|
|
var isEdited = true |
|
|
|
|
|
|
|
set(value) { |
|
|
|
|
|
|
|
field = value |
|
|
|
|
|
|
|
createRowRepresentation() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
/*** |
|
|
|
* The user selection's live data inside the editor |
|
|
|
* The user selection's live data inside the editor |
|
|
|
@ -167,6 +171,25 @@ class HandHistoryViewModel : ViewModel(), RowRepresentableDataSource, CardCentra |
|
|
|
* Uses the action list to create the list of RowRepresentables, displayed to the user |
|
|
|
* Uses the action list to create the list of RowRepresentables, displayed to the user |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private fun createRowRepresentation() { |
|
|
|
private fun createRowRepresentation() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.rowsLiveData.value = if (this.isEdited) { |
|
|
|
|
|
|
|
editionRowRepresentation() |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
readRowRepresentation() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun readRowRepresentation(): MutableList<RowRepresentable> { |
|
|
|
|
|
|
|
val rows: MutableList<RowRepresentable> = mutableListOf() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO remove useless settings, collapse multifolds |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return rows |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun editionRowRepresentation(): MutableList<RowRepresentable> { |
|
|
|
|
|
|
|
|
|
|
|
val rows: MutableList<RowRepresentable> = mutableListOf() |
|
|
|
val rows: MutableList<RowRepresentable> = mutableListOf() |
|
|
|
|
|
|
|
|
|
|
|
rows.add(HandRowType.COMMENT) |
|
|
|
rows.add(HandRowType.COMMENT) |
|
|
|
@ -200,8 +223,8 @@ class HandHistoryViewModel : ViewModel(), RowRepresentableDataSource, CardCentra |
|
|
|
if (this.sortedActions.activePositions(lastActionIndex).size < 2 || this.sortedActions.isStreetActionClosed(lastActionIndex) == Street.SUMMARY) { |
|
|
|
if (this.sortedActions.activePositions(lastActionIndex).size < 2 || this.sortedActions.isStreetActionClosed(lastActionIndex) == Street.SUMMARY) { |
|
|
|
addStreetHeader(rows, street) |
|
|
|
addStreetHeader(rows, street) |
|
|
|
|
|
|
|
|
|
|
|
val positions = this.sortedActions.activePositions(lastActionIndex, true) |
|
|
|
val activePositions = this.sortedActions.activePositions(lastActionIndex, true) |
|
|
|
positions.forEach { position -> |
|
|
|
activePositions.forEach { position -> |
|
|
|
val positionIndex = this.sortedActions.positions.indexOf(position) |
|
|
|
val positionIndex = this.sortedActions.positions.indexOf(position) |
|
|
|
val playerCardsRow = PlayerCardsRow(this, |
|
|
|
val playerCardsRow = PlayerCardsRow(this, |
|
|
|
position, |
|
|
|
position, |
|
|
|
@ -221,7 +244,7 @@ class HandHistoryViewModel : ViewModel(), RowRepresentableDataSource, CardCentra |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
this.rowsLiveData.value = rows |
|
|
|
return rows |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
/*** |
|
|
|
|