|
|
|
@ -9,6 +9,7 @@ import android.view.ViewGroup |
|
|
|
import android.widget.Button |
|
|
|
import android.widget.Button |
|
|
|
import android.widget.EditText |
|
|
|
import android.widget.EditText |
|
|
|
import android.widget.LinearLayout |
|
|
|
import android.widget.LinearLayout |
|
|
|
|
|
|
|
import android.widget.TextView |
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager |
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager |
|
|
|
import androidx.recyclerview.widget.RecyclerView |
|
|
|
import androidx.recyclerview.widget.RecyclerView |
|
|
|
import com.google.android.material.chip.Chip |
|
|
|
import com.google.android.material.chip.Chip |
|
|
|
@ -17,12 +18,15 @@ import kotlinx.android.synthetic.main.row_hand_action_read.view.* |
|
|
|
import kotlinx.android.synthetic.main.row_hand_cards.view.* |
|
|
|
import kotlinx.android.synthetic.main.row_hand_cards.view.* |
|
|
|
import kotlinx.android.synthetic.main.row_hand_player_summary.view.* |
|
|
|
import kotlinx.android.synthetic.main.row_hand_player_summary.view.* |
|
|
|
import kotlinx.android.synthetic.main.row_hhsettings_player_setup.view.* |
|
|
|
import kotlinx.android.synthetic.main.row_hhsettings_player_setup.view.* |
|
|
|
|
|
|
|
import kotlinx.android.synthetic.main.row_hhsettings_player_setup.view.posButton |
|
|
|
|
|
|
|
import kotlinx.android.synthetic.main.row_hhsettings_player_setup.view.psHandLayout |
|
|
|
|
|
|
|
import kotlinx.android.synthetic.main.row_hhsettings_player_setup.view.settings_container |
|
|
|
|
|
|
|
import kotlinx.android.synthetic.main.row_hhsettings_player_setup_read.view.* |
|
|
|
import kotlinx.android.synthetic.main.row_hhsettings_straddle.view.* |
|
|
|
import kotlinx.android.synthetic.main.row_hhsettings_straddle.view.* |
|
|
|
import net.pokeranalytics.android.R |
|
|
|
import net.pokeranalytics.android.R |
|
|
|
import net.pokeranalytics.android.exceptions.PAIllegalStateException |
|
|
|
import net.pokeranalytics.android.exceptions.PAIllegalStateException |
|
|
|
import net.pokeranalytics.android.model.handhistory.Position |
|
|
|
import net.pokeranalytics.android.model.handhistory.Position |
|
|
|
import net.pokeranalytics.android.model.realm.handhistory.Card |
|
|
|
import net.pokeranalytics.android.model.realm.handhistory.Card |
|
|
|
import net.pokeranalytics.android.model.realm.handhistory.HandHistory |
|
|
|
|
|
|
|
import net.pokeranalytics.android.ui.adapter.BindableHolder |
|
|
|
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 |
|
|
|
@ -37,7 +41,7 @@ import net.pokeranalytics.android.ui.view.rowrepresentable.ViewIdentifier |
|
|
|
import net.pokeranalytics.android.util.extensions.formatted |
|
|
|
import net.pokeranalytics.android.util.extensions.formatted |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum class HandRowType(var layoutRes: Int) : ViewIdentifier, RowRepresentable, HandHistoryRow { |
|
|
|
enum class HandRowType(var layoutRes: Int) : ViewIdentifier, RowRepresentable { |
|
|
|
DEFAULT(R.layout.row_title), |
|
|
|
DEFAULT(R.layout.row_title), |
|
|
|
HEADER(R.layout.row_header_value), |
|
|
|
HEADER(R.layout.row_header_value), |
|
|
|
ACTION(R.layout.row_hand_action), |
|
|
|
ACTION(R.layout.row_hand_action), |
|
|
|
@ -47,6 +51,7 @@ enum class HandRowType(var layoutRes: Int) : ViewIdentifier, RowRepresentable, H |
|
|
|
COMMENT(R.layout.row_hhsettings_comments), |
|
|
|
COMMENT(R.layout.row_hhsettings_comments), |
|
|
|
PLAYER_NUMBER(R.layout.row_title_value), |
|
|
|
PLAYER_NUMBER(R.layout.row_title_value), |
|
|
|
PLAYER_SETUP(R.layout.row_hhsettings_player_setup), |
|
|
|
PLAYER_SETUP(R.layout.row_hhsettings_player_setup), |
|
|
|
|
|
|
|
PLAYER_SETUP_READ(R.layout.row_hhsettings_player_setup_read), |
|
|
|
ANTE(R.layout.row_title_value), |
|
|
|
ANTE(R.layout.row_title_value), |
|
|
|
BIG_BLIND_ANTE(R.layout.row_title_switch), |
|
|
|
BIG_BLIND_ANTE(R.layout.row_title_switch), |
|
|
|
ACTION_READ(R.layout.row_hand_action_read) |
|
|
|
ACTION_READ(R.layout.row_hand_action_read) |
|
|
|
@ -57,50 +62,6 @@ enum class HandRowType(var layoutRes: Int) : ViewIdentifier, RowRepresentable, H |
|
|
|
override val identifier: Int |
|
|
|
override val identifier: Int |
|
|
|
get() { return this.ordinal } |
|
|
|
get() { return this.ordinal } |
|
|
|
|
|
|
|
|
|
|
|
override fun tagsForCompletion(): List<Int> { |
|
|
|
|
|
|
|
// return when (this) { |
|
|
|
|
|
|
|
// BLINDS -> listOf(0, 1) |
|
|
|
|
|
|
|
// else -> listOf() |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
return listOf() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun isFieldNeedsInput(tag: Int, handHistory: HandHistory): Boolean { |
|
|
|
|
|
|
|
// return when (this) { |
|
|
|
|
|
|
|
// BLINDS -> { |
|
|
|
|
|
|
|
// when (tag) { |
|
|
|
|
|
|
|
// 0 -> (handHistory.smallBlind == null) |
|
|
|
|
|
|
|
// 1 -> (handHistory.bigBlind == null) |
|
|
|
|
|
|
|
// else -> false |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
// else -> false |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun keyboardForTag(tag: Int): HHKeyboard? { |
|
|
|
|
|
|
|
// return when (this) { |
|
|
|
|
|
|
|
// BLINDS -> HHKeyboard.AMOUNT |
|
|
|
|
|
|
|
// else -> throw PAIllegalStateException("unmanaged tag $tag") |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
throw PAIllegalStateException("unmanaged tag $tag") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun amountForTag(handHistory: HandHistory, tag: Int): Double? { |
|
|
|
|
|
|
|
// return when (this) { |
|
|
|
|
|
|
|
// BLINDS -> { |
|
|
|
|
|
|
|
// when (tag) { |
|
|
|
|
|
|
|
// 0 -> handHistory.smallBlind |
|
|
|
|
|
|
|
// 1 -> handHistory.bigBlind |
|
|
|
|
|
|
|
// else -> null |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
// else -> null |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
return null |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override val bottomSheetType: BottomSheetType |
|
|
|
override val bottomSheetType: BottomSheetType |
|
|
|
get() { |
|
|
|
get() { |
|
|
|
return when(this) { |
|
|
|
return when(this) { |
|
|
|
@ -154,9 +115,9 @@ class HandHistoryAdapter( |
|
|
|
HandRowType.ACTION -> RowHandAction(layout) |
|
|
|
HandRowType.ACTION -> RowHandAction(layout) |
|
|
|
HandRowType.STREET -> RowHandStreet(layout) |
|
|
|
HandRowType.STREET -> RowHandStreet(layout) |
|
|
|
HandRowType.PLAYER_SUMMARY -> RowHandPlayerSummary(layout) |
|
|
|
HandRowType.PLAYER_SUMMARY -> RowHandPlayerSummary(layout) |
|
|
|
// HandRowType.BLINDS -> RowHandBlinds(layout) |
|
|
|
|
|
|
|
HandRowType.STRADDLE -> RowHandStraddle(layout) |
|
|
|
HandRowType.STRADDLE -> RowHandStraddle(layout) |
|
|
|
HandRowType.PLAYER_SETUP -> RowHandPlayerSetup(layout) |
|
|
|
HandRowType.PLAYER_SETUP -> RowHandPlayerSetup(layout) |
|
|
|
|
|
|
|
HandRowType.PLAYER_SETUP_READ -> RowHandReadOnlyPlayerSetup(layout) |
|
|
|
HandRowType.COMMENT -> RowViewHolder(layout) |
|
|
|
HandRowType.COMMENT -> RowViewHolder(layout) |
|
|
|
HandRowType.ACTION_READ -> RowActionRead(layout) |
|
|
|
HandRowType.ACTION_READ -> RowActionRead(layout) |
|
|
|
HandRowType.PLAYER_NUMBER, HandRowType.ANTE, HandRowType.BIG_BLIND_ANTE -> RowViewHolder(layout) |
|
|
|
HandRowType.PLAYER_NUMBER, HandRowType.ANTE, HandRowType.BIG_BLIND_ANTE -> RowViewHolder(layout) |
|
|
|
@ -211,7 +172,7 @@ class HandHistoryAdapter( |
|
|
|
this.configureEditTexts(index..index, position, row, adapter) |
|
|
|
this.configureEditTexts(index..index, position, row, adapter) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected fun configureEditTexts(tagRange: IntRange, position: Int, row: RowRepresentable, adapter: RecyclerAdapter) { |
|
|
|
private fun configureEditTexts(tagRange: IntRange, position: Int, row: RowRepresentable, adapter: RecyclerAdapter) { |
|
|
|
|
|
|
|
|
|
|
|
tagRange.forEach { tag -> |
|
|
|
tagRange.forEach { tag -> |
|
|
|
|
|
|
|
|
|
|
|
@ -245,6 +206,11 @@ class HandHistoryAdapter( |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected fun configureTextView(tag: Int, position: Int, row: RowRepresentable, adapter: RecyclerAdapter) { |
|
|
|
|
|
|
|
val textView = itemView.findViewWithTag<TextView>(tag) ?: throw PAIllegalStateException("TextView not found for tag: $tag, class: $this") |
|
|
|
|
|
|
|
textView.text = adapter.dataSource.charSequenceForRow(row, itemView.context, tag) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected fun setClickListener(editText: EditText) { |
|
|
|
protected fun setClickListener(editText: EditText) { |
|
|
|
|
|
|
|
|
|
|
|
editText.isFocusableInTouchMode = true |
|
|
|
editText.isFocusableInTouchMode = true |
|
|
|
@ -302,29 +268,6 @@ class HandHistoryAdapter( |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// inner class RowHandBlinds(itemView: View) : RowHandHolder(itemView) { |
|
|
|
|
|
|
|
// |
|
|
|
|
|
|
|
// init { |
|
|
|
|
|
|
|
//// itemView.smallBlindEditText.tag = 0 |
|
|
|
|
|
|
|
//// itemView.bigBlindEditText.tag = 1 |
|
|
|
|
|
|
|
// itemView.anteEditText.tag = 0 |
|
|
|
|
|
|
|
// |
|
|
|
|
|
|
|
//// setClickListener(itemView.smallBlindEditText) |
|
|
|
|
|
|
|
//// setClickListener(itemView.bigBlindEditText) |
|
|
|
|
|
|
|
// setClickListener(itemView.anteEditText) |
|
|
|
|
|
|
|
// |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
// |
|
|
|
|
|
|
|
// // sb, bb, ante, bb ante |
|
|
|
|
|
|
|
// |
|
|
|
|
|
|
|
// override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) { |
|
|
|
|
|
|
|
// super.onBind(position, row, adapter) |
|
|
|
|
|
|
|
// |
|
|
|
|
|
|
|
// configureEditTexts(0, position, row, adapter) |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
// |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inner class RowHandStraddle(itemView: View) : RowHandHolder(itemView) { |
|
|
|
inner class RowHandStraddle(itemView: View) : RowHandHolder(itemView) { |
|
|
|
|
|
|
|
|
|
|
|
override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) { |
|
|
|
override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) { |
|
|
|
@ -453,10 +396,6 @@ 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) |
|
|
|
|
|
|
|
|
|
|
|
@ -464,19 +403,6 @@ class HandHistoryAdapter( |
|
|
|
itemView.cardsLayout.tag = streetCardsRow.street.ordinal |
|
|
|
itemView.cardsLayout.tag = streetCardsRow.street.ordinal |
|
|
|
|
|
|
|
|
|
|
|
configureCardsLayout(itemView.cardsLayout) |
|
|
|
configureCardsLayout(itemView.cardsLayout) |
|
|
|
|
|
|
|
|
|
|
|
// itemView.cardsLayout.removeAllViews() |
|
|
|
|
|
|
|
// |
|
|
|
|
|
|
|
// val inflater = LayoutInflater.from(itemView.context) |
|
|
|
|
|
|
|
// adapter.dataSource.contentForRow(row, itemView.context, Card::class).forEach { card -> |
|
|
|
|
|
|
|
// val cardView = card.view(itemView.context, inflater, itemView.cardsLayout) |
|
|
|
|
|
|
|
// itemView.cardsLayout.addView(cardView) |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
// |
|
|
|
|
|
|
|
// itemView.cardsLayout.setOnClickListener { |
|
|
|
|
|
|
|
// adapter.delegate?.onRowSelected(position, row) |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
@ -487,30 +413,7 @@ 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.handLayout.tag = PlayerCardsRow.Tag.CARDS.ordinal |
|
|
|
|
|
|
|
|
|
|
|
// itemView.cardsEditText.tag = PlayerCardsRow.Tag.CARDS.ordinal |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Cards |
|
|
|
|
|
|
|
// itemView.findViewById<EditText>(R.id.cardsEditText)?.let { cardsEditText -> |
|
|
|
|
|
|
|
// |
|
|
|
|
|
|
|
// cardsEditText.isFocusableInTouchMode = true |
|
|
|
|
|
|
|
// cardsEditText.setOnTouchListener { _, event -> |
|
|
|
|
|
|
|
// |
|
|
|
|
|
|
|
// if (event.action == MotionEvent.ACTION_UP) { |
|
|
|
|
|
|
|
// // Both are required, otherwise requestFocus() fails |
|
|
|
|
|
|
|
// cardsEditText.isFocusable = true |
|
|
|
|
|
|
|
// cardsEditText.isFocusableInTouchMode = true |
|
|
|
|
|
|
|
// |
|
|
|
|
|
|
|
// cardsEditText.requestFocus() |
|
|
|
|
|
|
|
// |
|
|
|
|
|
|
|
// editTextSelected(cardsEditText, true, PlayerCardsRow.Tag.CARDS.ordinal) |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
// return@setOnTouchListener true |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
// |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) { |
|
|
|
override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) { |
|
|
|
@ -525,52 +428,41 @@ class HandHistoryAdapter( |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
configureCardsLayout(itemView.handLayout) |
|
|
|
configureCardsLayout(itemView.handLayout) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// configureEditTexts(PlayerCardsRow.Tag.CARDS.ordinal, position, row, adapter) |
|
|
|
inner class RowHandReadOnlyPlayerSetup(itemView: View) : AbstractRowHandPlayerSetup(itemView) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
init { |
|
|
|
|
|
|
|
itemView.stackTextView.tag = PlayerSetupRow.Tag.STACK.ordinal |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) { |
|
|
|
|
|
|
|
super.onBind(position, row, adapter) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
configureTextView(PlayerSetupRow.Tag.STACK.ordinal, position, row, adapter) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
inner class RowHandPlayerSetup(itemView: View) : RowHandHolder(itemView) { |
|
|
|
inner class RowHandPlayerSetup(itemView: View) : AbstractRowHandPlayerSetup(itemView) { |
|
|
|
|
|
|
|
|
|
|
|
private var positionAdapter: PositionAdapter = PositionAdapter() |
|
|
|
private var positionAdapter: PositionAdapter = PositionAdapter() |
|
|
|
private var delegate: RowRepresentableDelegate? = null |
|
|
|
private var positionViewManager: LinearLayoutManager |
|
|
|
|
|
|
|
|
|
|
|
init { |
|
|
|
init { |
|
|
|
|
|
|
|
|
|
|
|
itemView.psHandLayout.tag = PlayerSetupRow.Tag.HAND.ordinal |
|
|
|
|
|
|
|
itemView.stackEditText.tag = PlayerSetupRow.Tag.STACK.ordinal |
|
|
|
itemView.stackEditText.tag = PlayerSetupRow.Tag.STACK.ordinal |
|
|
|
|
|
|
|
itemView.stackEditText.inputType = InputType.TYPE_NUMBER_FLAG_DECIMAL |
|
|
|
setClickListener(itemView.stackEditText) |
|
|
|
setClickListener(itemView.stackEditText) |
|
|
|
|
|
|
|
|
|
|
|
// Position Recycler |
|
|
|
this.positionViewManager = LinearLayoutManager(itemView.context, RecyclerView.HORIZONTAL, false) |
|
|
|
val positionViewManager = LinearLayoutManager(itemView.context, RecyclerView.HORIZONTAL, false) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
itemView.positionRecyclerView.apply { |
|
|
|
itemView.positionRecyclerView.apply { |
|
|
|
setHasFixedSize(true) |
|
|
|
setHasFixedSize(true) |
|
|
|
layoutManager = positionViewManager |
|
|
|
layoutManager = positionViewManager |
|
|
|
adapter = positionAdapter |
|
|
|
adapter = positionAdapter |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
itemView.findViewById<EditText>(R.id.stackEditText)?.let { stackEditText -> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stackEditText.inputType = InputType.TYPE_NUMBER_FLAG_DECIMAL |
|
|
|
|
|
|
|
stackEditText.isFocusableInTouchMode = true |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stackEditText.setOnTouchListener { _, event -> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (event.action == MotionEvent.ACTION_UP) { |
|
|
|
|
|
|
|
// Both are required, otherwise requestFocus() fails |
|
|
|
|
|
|
|
stackEditText.isFocusable = true |
|
|
|
|
|
|
|
stackEditText.isFocusableInTouchMode = true |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stackEditText.requestFocus() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
editTextSelected(stackEditText, true, stackEditText.tag as Int) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return@setOnTouchListener true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) { |
|
|
|
override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) { |
|
|
|
@ -578,7 +470,6 @@ class HandHistoryAdapter( |
|
|
|
|
|
|
|
|
|
|
|
val setupRow = row as PlayerSetupRow |
|
|
|
val setupRow = row as PlayerSetupRow |
|
|
|
val state = setupRow.state |
|
|
|
val state = setupRow.state |
|
|
|
this.delegate = adapter.delegate |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Title |
|
|
|
// Title |
|
|
|
itemView.title.text = setupRow.title(itemView.context) |
|
|
|
itemView.title.text = setupRow.title(itemView.context) |
|
|
|
@ -595,13 +486,29 @@ class HandHistoryAdapter( |
|
|
|
this.delegate?.onRowValueChanged(pos, row) |
|
|
|
this.delegate?.onRowValueChanged(pos, row) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
configureEditTexts(PlayerSetupRow.Tag.STACK.ordinal, position, row, adapter) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
abstract inner class AbstractRowHandPlayerSetup(itemView: View) : RowHandHolder(itemView) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected var delegate: RowRepresentableDelegate? = null |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
init { |
|
|
|
|
|
|
|
itemView.psHandLayout.tag = PlayerSetupRow.Tag.HAND.ordinal |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) { |
|
|
|
|
|
|
|
super.onBind(position, row, adapter) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val setupRow = row as PlayerSetupRow |
|
|
|
|
|
|
|
val state = setupRow.state |
|
|
|
|
|
|
|
this.delegate = adapter.delegate |
|
|
|
|
|
|
|
|
|
|
|
// Position Button |
|
|
|
// Position Button |
|
|
|
itemView.posButton.text = adapter.dataSource.charSequenceForRow(row, itemView.context, PlayerSetupRow.Tag.POSITION.ordinal) |
|
|
|
itemView.posButton.text = adapter.dataSource.charSequenceForRow(row, itemView.context, PlayerSetupRow.Tag.POSITION.ordinal) |
|
|
|
// itemView.posButton.setOnClickListener { |
|
|
|
|
|
|
|
// setupRow.showPosition() |
|
|
|
|
|
|
|
// itemView.positionRecyclerView.visibility = View.VISIBLE |
|
|
|
|
|
|
|
// itemView.posButton.backgroundTintList = ColorStateList.valueOf(color(true)) |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
val positionSelected = adapter.dataSource.isSelected(position, row, PlayerSetupRow.Tag.POSITION.ordinal) |
|
|
|
val positionSelected = adapter.dataSource.isSelected(position, row, PlayerSetupRow.Tag.POSITION.ordinal) |
|
|
|
itemView.posButton.backgroundTintList = ColorStateList.valueOf(color(positionSelected)) |
|
|
|
itemView.posButton.backgroundTintList = ColorStateList.valueOf(color(positionSelected)) |
|
|
|
|
|
|
|
|
|
|
|
@ -609,8 +516,6 @@ class HandHistoryAdapter( |
|
|
|
itemView.settings_container.visibility = if (state == PlayerSetupRow.State.POSITIONS_ONLY) View.GONE else View.VISIBLE |
|
|
|
itemView.settings_container.visibility = if (state == PlayerSetupRow.State.POSITIONS_ONLY) View.GONE else View.VISIBLE |
|
|
|
|
|
|
|
|
|
|
|
configureCardsLayout(itemView.psHandLayout) |
|
|
|
configureCardsLayout(itemView.psHandLayout) |
|
|
|
// configureEditTexts(PlayerSetupRow.Tag.HAND.ordinal, position, row, adapter) |
|
|
|
|
|
|
|
configureEditTexts(PlayerSetupRow.Tag.STACK.ordinal, position, row, adapter) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|