diff --git a/app/src/main/java/net/pokeranalytics/android/model/realm/handhistory/Action.kt b/app/src/main/java/net/pokeranalytics/android/model/realm/handhistory/Action.kt index ce90eb68..172365d0 100644 --- a/app/src/main/java/net/pokeranalytics/android/model/realm/handhistory/Action.kt +++ b/app/src/main/java/net/pokeranalytics/android/model/realm/handhistory/Action.kt @@ -15,21 +15,22 @@ import net.pokeranalytics.android.util.extensions.formatted * An extension to transform a list of ComputedAction into * a more compact and read-friendly list of ActionReadRow */ -fun List.compact(positions: LinkedHashSet): List { +fun List.compact(positions: LinkedHashSet, heroIndex: Int?): List { val rows = mutableListOf() this.forEach { if (it.type == Action.Type.FOLD && rows.lastOrNull()?.action == Action.Type.FOLD) { rows.lastOrNull()?.positions?.add(positions.elementAt(it.position)) } else { - rows.add(it.toReadRow(positions)) + rows.add(it.toReadRow(positions, heroIndex)) } } return rows } -fun Action.toReadRow(positions: LinkedHashSet): ActionReadRow { +fun Action.toReadRow(positions: LinkedHashSet, heroIndex: Int?): ActionReadRow { val pos = positions.elementAt(this.position) - return ActionReadRow(mutableListOf(pos), this.position, this.type, this.amount) + val isHero = (heroIndex == this.position) + return ActionReadRow(mutableListOf(pos), this.position, this.type, this.amount, isHero) } open class Action : RealmObject() { diff --git a/app/src/main/java/net/pokeranalytics/android/model/realm/handhistory/HandHistory.kt b/app/src/main/java/net/pokeranalytics/android/model/realm/handhistory/HandHistory.kt index 788ac1cb..20d3b89c 100644 --- a/app/src/main/java/net/pokeranalytics/android/model/realm/handhistory/HandHistory.kt +++ b/app/src/main/java/net/pokeranalytics/android/model/realm/handhistory/HandHistory.kt @@ -309,7 +309,7 @@ open class HandHistory : RealmObject(), Deletable, RowRepresentable, Identifiabl string = string.addLineReturn(2) - val streetActions = sortedActions.filter { it.street == street }.compact(positions) + val streetActions = sortedActions.filter { it.street == street }.compact(positions, this.heroIndex) if (streetActions.isNotEmpty()) { val streetItems = mutableListOf(context.getString(street.resId)) diff --git a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryAdapter.kt b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryAdapter.kt index 200224a5..88d5a680 100644 --- a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryAdapter.kt +++ b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryAdapter.kt @@ -448,6 +448,8 @@ class HandHistoryAdapter( // Position itemView.findViewById