Fixes selection of board views

hh
Laurent 6 years ago
parent 93f17ef522
commit 6702ea04f7
  1. 14
      app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryAdapter.kt
  2. 13
      app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/StreetCardsRow.kt

@ -281,6 +281,9 @@ class HandHistoryAdapter(
dataSource.rowRepresentableForPosition(this.currentPosition)?.let { row -> dataSource.rowRepresentableForPosition(this.currentPosition)?.let { row ->
val focused = dataSource.isSelected(this.currentPosition, row, layout.tag as Int)
layout.setBackgroundColor(color(focused))
dataSource.contentForRow(row, itemView.context, Card::class).forEach { card -> dataSource.contentForRow(row, itemView.context, Card::class).forEach { card ->
val cardView = card.view(itemView.context, inflater, layout) val cardView = card.view(itemView.context, inflater, layout)
layout.addView(cardView) layout.addView(cardView)
@ -434,9 +437,16 @@ class HandHistoryAdapter(
*/ */
inner class RowHandStreet(itemView: View) : RowHandHolder(itemView) { inner class RowHandStreet(itemView: View) : RowHandHolder(itemView) {
init {
// itemView.cardsLayout.tag = 0
}
override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) { override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) {
super.onBind(position, row, adapter) super.onBind(position, row, adapter)
val streetCardsRow = row as StreetCardsRow
itemView.cardsLayout.tag = streetCardsRow.street.ordinal
configureCardsLayout(itemView.cardsLayout) configureCardsLayout(itemView.cardsLayout)
// itemView.cardsLayout.removeAllViews() // itemView.cardsLayout.removeAllViews()
@ -461,6 +471,9 @@ class HandHistoryAdapter(
inner class RowHandPlayerSummary(itemView: View) : RowHandHolder(itemView) { inner class RowHandPlayerSummary(itemView: View) : RowHandHolder(itemView) {
init { init {
itemView.handLayout.tag = PlayerCardsRow.Tag.CARDS.ordinal
// itemView.cardsEditText.tag = PlayerCardsRow.Tag.CARDS.ordinal // itemView.cardsEditText.tag = PlayerCardsRow.Tag.CARDS.ordinal
// Cards // Cards
@ -509,6 +522,7 @@ class HandHistoryAdapter(
init { init {
itemView.psHandLayout.tag = PlayerSetupRow.Tag.HAND.ordinal
itemView.stackEditText.tag = PlayerSetupRow.Tag.STACK.ordinal itemView.stackEditText.tag = PlayerSetupRow.Tag.STACK.ordinal
setClickListener(itemView.stackEditText) setClickListener(itemView.stackEditText)

@ -20,12 +20,13 @@ class StreetCardsRow(var street: Street, var handHistory: HandHistory) : CardsRo
} }
override fun tagsForCompletion(): List<Int> { override fun tagsForCompletion(): List<Int> {
return when (this.street) { return listOf(this.street.ordinal)
Street.PREFLOP -> listOf() // return when (this.street) {
Street.FLOP -> listOf(Street.FLOP.ordinal) // Street.PREFLOP -> listOf()
Street.TURN -> listOf(Street.FLOP.ordinal, Street.TURN.ordinal) // Street.FLOP -> listOf(Street.FLOP.ordinal)
Street.RIVER, Street.SUMMARY -> listOf(Street.FLOP.ordinal, Street.TURN.ordinal, Street.RIVER.ordinal) // Street.TURN -> listOf(Street.FLOP.ordinal, Street.TURN.ordinal)
} // Street.RIVER, Street.SUMMARY -> listOf(Street.FLOP.ordinal, Street.TURN.ordinal, Street.RIVER.ordinal)
// }
} }
override fun cardLimit() : Int { override fun cardLimit() : Int {

Loading…
Cancel
Save