|
|
|
|
@ -384,7 +384,7 @@ class HandHistoryAdapter( |
|
|
|
|
flopEditText.setText(text) |
|
|
|
|
|
|
|
|
|
val selected = adapter.dataSource.isSelected(position, row, Street.FLOP.ordinal) |
|
|
|
|
if (selected) flopEditText.requestFocus() else flopEditText.clearFocus() |
|
|
|
|
toggleFocus(flopEditText, selected) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -399,8 +399,8 @@ class HandHistoryAdapter( |
|
|
|
|
turnEditText.text = null |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
val selected = adapter.dataSource.isSelected(position, row, Street.FLOP.ordinal) |
|
|
|
|
if (selected) turnEditText.requestFocus() else turnEditText.clearFocus() |
|
|
|
|
val selected = adapter.dataSource.isSelected(position, row, Street.TURN.ordinal) |
|
|
|
|
toggleFocus(turnEditText, selected) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
itemView.findViewById<EditText>(R.id.riverEditText)?.let { riverEditText -> |
|
|
|
|
@ -414,8 +414,8 @@ class HandHistoryAdapter( |
|
|
|
|
riverEditText.text = null |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
val selected = adapter.dataSource.isSelected(position, row, Street.FLOP.ordinal) |
|
|
|
|
if (selected) riverEditText.requestFocus() else riverEditText.clearFocus() |
|
|
|
|
val selected = adapter.dataSource.isSelected(position, row, Street.RIVER.ordinal) |
|
|
|
|
toggleFocus(riverEditText, selected) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
@ -428,23 +428,25 @@ class HandHistoryAdapter( |
|
|
|
|
*/ |
|
|
|
|
inner class RowHandPlayerSummary(itemView: View) : RowHandHolder(itemView) { |
|
|
|
|
|
|
|
|
|
private val CARDS_TAG = 0 |
|
|
|
|
|
|
|
|
|
init { |
|
|
|
|
|
|
|
|
|
// Cards |
|
|
|
|
itemView.findViewById<EditText>(R.id.cardsEditText)?.let { amountEditText -> |
|
|
|
|
itemView.findViewById<EditText>(R.id.cardsEditText)?.let { cardsEditText -> |
|
|
|
|
|
|
|
|
|
amountEditText.isFocusableInTouchMode = true |
|
|
|
|
cardsEditText.isFocusableInTouchMode = true |
|
|
|
|
|
|
|
|
|
amountEditText.setOnTouchListener { _, event -> |
|
|
|
|
cardsEditText.setOnTouchListener { _, event -> |
|
|
|
|
|
|
|
|
|
if (event.action == MotionEvent.ACTION_UP) { |
|
|
|
|
// Both are required, otherwise requestFocus() fails |
|
|
|
|
amountEditText.isFocusable = true |
|
|
|
|
amountEditText.isFocusableInTouchMode = true |
|
|
|
|
cardsEditText.isFocusable = true |
|
|
|
|
cardsEditText.isFocusableInTouchMode = true |
|
|
|
|
|
|
|
|
|
amountEditText.requestFocus() |
|
|
|
|
cardsEditText.requestFocus() |
|
|
|
|
|
|
|
|
|
editTextSelected(amountEditText, true, HHKeyboard.AMOUNT.ordinal) |
|
|
|
|
editTextSelected(cardsEditText, true, CARDS_TAG) |
|
|
|
|
} |
|
|
|
|
return@setOnTouchListener true |
|
|
|
|
} |
|
|
|
|
@ -459,30 +461,24 @@ class HandHistoryAdapter( |
|
|
|
|
val playerCardView = row as PlayerCardsRow |
|
|
|
|
|
|
|
|
|
// Position |
|
|
|
|
itemView.findViewById<Button>(R.id.positionButton)?.let { button -> |
|
|
|
|
button.text = playerCardView.position.value |
|
|
|
|
itemView.findViewById<Button>(R.id.positionButton)?.let { positionButton -> |
|
|
|
|
positionButton.text = playerCardView.position.value |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Amount |
|
|
|
|
itemView.findViewById<EditText>(R.id.cardsEditText)?.let { cardsEditText -> |
|
|
|
|
val tag = HHKeyboard.AMOUNT.ordinal |
|
|
|
|
|
|
|
|
|
val selected = adapter.dataSource.isSelected(position, row, tag) |
|
|
|
|
val selected = adapter.dataSource.isSelected(position, row, CARDS_TAG) |
|
|
|
|
|
|
|
|
|
// Both are required, otherwise requestFocus() fails |
|
|
|
|
cardsEditText.isFocusable = selected |
|
|
|
|
cardsEditText.isFocusableInTouchMode = selected |
|
|
|
|
|
|
|
|
|
Timber.d("Amount at $position is selected: $selected, focusable = ${cardsEditText.isFocusable}, isFocusableInTouchMode = ${cardsEditText.isFocusableInTouchMode}, hasFocus = ${cardsEditText.hasFocus()}, enabled = ${cardsEditText.isEnabled}") |
|
|
|
|
Timber.d("cardsEditText at $position is selected: $selected, focusable = ${cardsEditText.isFocusable}, isFocusableInTouchMode = ${cardsEditText.isFocusableInTouchMode}, hasFocus = ${cardsEditText.hasFocus()}, enabled = ${cardsEditText.isEnabled}") |
|
|
|
|
cardsEditText.setBackgroundColor(color(selected)) |
|
|
|
|
|
|
|
|
|
cardsEditText.setText(playerCardView.cardHolder?.cards?.formatted(itemView.context)) |
|
|
|
|
|
|
|
|
|
if (selected) { |
|
|
|
|
cardsEditText.requestFocus() |
|
|
|
|
} else { |
|
|
|
|
cardsEditText.clearFocus() |
|
|
|
|
} |
|
|
|
|
toggleFocus(cardsEditText, selected) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|