|
|
|
@ -1,6 +1,5 @@ |
|
|
|
package net.pokeranalytics.android.ui.modules.handhistory |
|
|
|
package net.pokeranalytics.android.ui.modules.handhistory |
|
|
|
|
|
|
|
|
|
|
|
import android.app.Activity |
|
|
|
|
|
|
|
import android.content.res.ColorStateList |
|
|
|
import android.content.res.ColorStateList |
|
|
|
import android.text.InputType |
|
|
|
import android.text.InputType |
|
|
|
import android.view.LayoutInflater |
|
|
|
import android.view.LayoutInflater |
|
|
|
@ -21,7 +20,6 @@ import net.pokeranalytics.android.ui.adapter.BindableHolder |
|
|
|
import net.pokeranalytics.android.ui.adapter.RecyclerAdapter |
|
|
|
import net.pokeranalytics.android.ui.adapter.RecyclerAdapter |
|
|
|
import net.pokeranalytics.android.ui.adapter.RowRepresentableDataSource |
|
|
|
import net.pokeranalytics.android.ui.adapter.RowRepresentableDataSource |
|
|
|
import net.pokeranalytics.android.ui.adapter.RowRepresentableDelegate |
|
|
|
import net.pokeranalytics.android.ui.adapter.RowRepresentableDelegate |
|
|
|
import net.pokeranalytics.android.ui.extensions.hideKeyboard |
|
|
|
|
|
|
|
import net.pokeranalytics.android.ui.modules.handhistory.views.PlayerCardsRow |
|
|
|
import net.pokeranalytics.android.ui.modules.handhistory.views.PlayerCardsRow |
|
|
|
import net.pokeranalytics.android.ui.modules.handhistory.views.StreetCardsRow |
|
|
|
import net.pokeranalytics.android.ui.modules.handhistory.views.StreetCardsRow |
|
|
|
import net.pokeranalytics.android.ui.view.RowRepresentable |
|
|
|
import net.pokeranalytics.android.ui.view.RowRepresentable |
|
|
|
@ -114,7 +112,7 @@ class HandHistoryAdapter( |
|
|
|
// Action |
|
|
|
// Action |
|
|
|
itemView.findViewById<Button>(R.id.actionButton)?.let { actionButton -> |
|
|
|
itemView.findViewById<Button>(R.id.actionButton)?.let { actionButton -> |
|
|
|
actionButton.setOnClickListener { |
|
|
|
actionButton.setOnClickListener { |
|
|
|
buttonEdited(actionButton, true, HHKeyboard.ACTION.ordinal) |
|
|
|
buttonClicked(actionButton, true, HHKeyboard.ACTION.ordinal) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -141,10 +139,10 @@ class HandHistoryAdapter( |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun buttonEdited(button: Button, selected: Boolean, tag: Int) { |
|
|
|
private fun buttonClicked(button: Button, selected: Boolean, tag: Int) { |
|
|
|
|
|
|
|
|
|
|
|
button.backgroundTintList = ColorStateList.valueOf(color(selected)) |
|
|
|
button.backgroundTintList = ColorStateList.valueOf(color(selected)) |
|
|
|
(itemView.context as Activity).hideKeyboard() |
|
|
|
// (itemView.context as Activity).hideKeyboard() |
|
|
|
|
|
|
|
|
|
|
|
if (selected) { |
|
|
|
if (selected) { |
|
|
|
val row = dataSource.rowRepresentableForPosition(currentPosition) |
|
|
|
val row = dataSource.rowRepresentableForPosition(currentPosition) |
|
|
|
@ -199,16 +197,16 @@ class HandHistoryAdapter( |
|
|
|
amountEditText.isFocusable = selected && computedAction.amountCanBeEdited |
|
|
|
amountEditText.isFocusable = selected && computedAction.amountCanBeEdited |
|
|
|
amountEditText.isFocusableInTouchMode = selected && computedAction.amountCanBeEdited |
|
|
|
amountEditText.isFocusableInTouchMode = selected && computedAction.amountCanBeEdited |
|
|
|
|
|
|
|
|
|
|
|
Timber.d("Amount at $position is selected: $selected, focusable = ${amountEditText.isFocusable}, isFocusableInTouchMode = ${amountEditText.isFocusableInTouchMode}, hasFocus = ${amountEditText.hasFocus()}, enabled = ${amountEditText.isEnabled}") |
|
|
|
|
|
|
|
amountEditText.setBackgroundColor(color(selected)) |
|
|
|
amountEditText.setBackgroundColor(color(selected)) |
|
|
|
|
|
|
|
|
|
|
|
amountEditText.setText(computedAction.action.displayedFormattedAmount) |
|
|
|
amountEditText.setText(computedAction.action.formattedAmount) |
|
|
|
|
|
|
|
|
|
|
|
if (selected) { |
|
|
|
if (selected) { |
|
|
|
amountEditText.requestFocus() |
|
|
|
amountEditText.requestFocus() |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
amountEditText.clearFocus() |
|
|
|
amountEditText.clearFocus() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Timber.d("Amount at $position is selected: $selected, focusable = ${amountEditText.isFocusable}, isFocusableInTouchMode = ${amountEditText.isFocusableInTouchMode}, hasFocus = ${amountEditText.hasFocus()}, enabled = ${amountEditText.isEnabled}") |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -262,7 +260,7 @@ class HandHistoryAdapter( |
|
|
|
flopEditText.setText(text) |
|
|
|
flopEditText.setText(text) |
|
|
|
|
|
|
|
|
|
|
|
val selected = adapter.dataSource.isSelected(position, row, Street.FLOP.ordinal) |
|
|
|
val selected = adapter.dataSource.isSelected(position, row, Street.FLOP.ordinal) |
|
|
|
if (!selected) flopEditText.clearFocus() |
|
|
|
if (selected) flopEditText.requestFocus() else flopEditText.clearFocus() |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -278,7 +276,7 @@ class HandHistoryAdapter( |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
val selected = adapter.dataSource.isSelected(position, row, Street.FLOP.ordinal) |
|
|
|
val selected = adapter.dataSource.isSelected(position, row, Street.FLOP.ordinal) |
|
|
|
if (!selected) turnEditText.clearFocus() |
|
|
|
if (selected) turnEditText.requestFocus() else turnEditText.clearFocus() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
itemView.findViewById<EditText>(R.id.riverEditText)?.let { riverEditText -> |
|
|
|
itemView.findViewById<EditText>(R.id.riverEditText)?.let { riverEditText -> |
|
|
|
@ -293,7 +291,7 @@ class HandHistoryAdapter( |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
val selected = adapter.dataSource.isSelected(position, row, Street.FLOP.ordinal) |
|
|
|
val selected = adapter.dataSource.isSelected(position, row, Street.FLOP.ordinal) |
|
|
|
if (!selected) riverEditText.clearFocus() |
|
|
|
if (selected) riverEditText.requestFocus() else riverEditText.clearFocus() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|