|
|
|
|
@ -15,7 +15,6 @@ import com.google.android.material.chip.Chip |
|
|
|
|
import kotlinx.android.synthetic.main.row_hand_action.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_hhsettings_blinds.view.* |
|
|
|
|
import kotlinx.android.synthetic.main.row_hhsettings_player_setup.view.* |
|
|
|
|
import kotlinx.android.synthetic.main.row_hhsettings_straddle.view.* |
|
|
|
|
import net.pokeranalytics.android.R |
|
|
|
|
@ -42,11 +41,12 @@ enum class HandRowType(var layoutRes: Int) : ViewIdentifier, RowRepresentable, H |
|
|
|
|
ACTION(R.layout.row_hand_action), |
|
|
|
|
PLAYER_SUMMARY(R.layout.row_hand_player_summary), |
|
|
|
|
STREET(R.layout.row_hand_cards), |
|
|
|
|
BLINDS(R.layout.row_hhsettings_blinds), |
|
|
|
|
STRADDLE(R.layout.row_hhsettings_straddle), |
|
|
|
|
COMMENT(R.layout.row_hhsettings_comments), |
|
|
|
|
PLAYER_NUMBER(R.layout.row_title_value), |
|
|
|
|
PLAYER_SETUP(R.layout.row_hhsettings_player_setup) |
|
|
|
|
PLAYER_SETUP(R.layout.row_hhsettings_player_setup), |
|
|
|
|
ANTE(R.layout.row_title_value), |
|
|
|
|
BIG_BLIND_ANTE(R.layout.row_title_switch) |
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
override val viewType: Int = this.ordinal |
|
|
|
|
@ -55,59 +55,47 @@ enum class HandRowType(var layoutRes: Int) : ViewIdentifier, RowRepresentable, H |
|
|
|
|
get() { return this.ordinal } |
|
|
|
|
|
|
|
|
|
override fun tagsForCompletion(): List<Int> { |
|
|
|
|
return when (this) { |
|
|
|
|
BLINDS -> listOf(0, 1) |
|
|
|
|
else -> listOf() |
|
|
|
|
} |
|
|
|
|
// 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 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// override fun tagForCompletion( |
|
|
|
|
// handHistory: HandHistory, |
|
|
|
|
// minTag: Int? |
|
|
|
|
// ): Int? { |
|
|
|
|
// return when (this) { |
|
|
|
|
// BLINDS -> { |
|
|
|
|
// when { |
|
|
|
|
// handHistory.smallBlind == null -> 0 |
|
|
|
|
// handHistory.bigBlind == null -> 1 |
|
|
|
|
// else -> null |
|
|
|
|
// when (tag) { |
|
|
|
|
// 0 -> (handHistory.smallBlind == null) |
|
|
|
|
// 1 -> (handHistory.bigBlind == null) |
|
|
|
|
// else -> false |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// else -> null |
|
|
|
|
// } |
|
|
|
|
// else -> false |
|
|
|
|
// } |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun keyboardForTag(tag: Int): HHKeyboard? { |
|
|
|
|
return when (this) { |
|
|
|
|
BLINDS -> HHKeyboard.AMOUNT |
|
|
|
|
else -> throw PAIllegalStateException("unmanaged tag $tag") |
|
|
|
|
} |
|
|
|
|
// 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 when (this) { |
|
|
|
|
// BLINDS -> { |
|
|
|
|
// when (tag) { |
|
|
|
|
// 0 -> handHistory.smallBlind |
|
|
|
|
// 1 -> handHistory.bigBlind |
|
|
|
|
// else -> null |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// else -> null |
|
|
|
|
// } |
|
|
|
|
return null |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override val bottomSheetType: BottomSheetType |
|
|
|
|
@ -115,6 +103,7 @@ enum class HandRowType(var layoutRes: Int) : ViewIdentifier, RowRepresentable, H |
|
|
|
|
return when(this) { |
|
|
|
|
PLAYER_NUMBER -> BottomSheetType.GRID |
|
|
|
|
COMMENT -> BottomSheetType.EDIT_TEXT_MULTI_LINES |
|
|
|
|
ANTE -> BottomSheetType.NUMERIC_TEXT |
|
|
|
|
else -> BottomSheetType.NONE |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -124,6 +113,8 @@ enum class HandRowType(var layoutRes: Int) : ViewIdentifier, RowRepresentable, H |
|
|
|
|
return when(this) { |
|
|
|
|
PLAYER_NUMBER -> R.string.number_of_players |
|
|
|
|
COMMENT -> R.string.comment |
|
|
|
|
ANTE -> R.string.ante |
|
|
|
|
BIG_BLIND_ANTE -> R.string.bb_ante_option |
|
|
|
|
else -> null |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -160,11 +151,12 @@ class HandHistoryAdapter( |
|
|
|
|
HandRowType.ACTION -> RowHandAction(layout) |
|
|
|
|
HandRowType.STREET -> RowHandStreet(layout) |
|
|
|
|
HandRowType.PLAYER_SUMMARY -> RowHandPlayerSummary(layout) |
|
|
|
|
HandRowType.BLINDS -> RowHandBlinds(layout) |
|
|
|
|
// HandRowType.BLINDS -> RowHandBlinds(layout) |
|
|
|
|
HandRowType.STRADDLE -> RowHandStraddle(layout) |
|
|
|
|
HandRowType.PLAYER_SETUP -> RowHandPlayerSetup(layout) |
|
|
|
|
HandRowType.COMMENT -> RowViewHolder(layout) |
|
|
|
|
HandRowType.PLAYER_NUMBER -> RowViewHolder(layout) |
|
|
|
|
HandRowType.PLAYER_NUMBER, HandRowType.ANTE, |
|
|
|
|
HandRowType.BIG_BLIND_ANTE -> RowViewHolder(layout) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -304,28 +296,28 @@ class HandHistoryAdapter( |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
inner class RowHandBlinds(itemView: View) : RowHandHolder(itemView) { |
|
|
|
|
|
|
|
|
|
init { |
|
|
|
|
itemView.smallBlindEditText.tag = 0 |
|
|
|
|
itemView.bigBlindEditText.tag = 1 |
|
|
|
|
itemView.anteEditText.tag = 2 |
|
|
|
|
|
|
|
|
|
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..2, position, row, adapter) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
// 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) { |
|
|
|
|
|
|
|
|
|
@ -586,7 +578,6 @@ class HandHistoryAdapter( |
|
|
|
|
// Settings |
|
|
|
|
itemView.settings_container.visibility = if (state == PlayerSetupRow.State.POSITIONS_ONLY) View.GONE else View.VISIBLE |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
configureCardsLayout(itemView.psHandLayout) |
|
|
|
|
// configureEditTexts(PlayerSetupRow.Tag.HAND.ordinal, position, row, adapter) |
|
|
|
|
configureEditTexts(PlayerSetupRow.Tag.STACK.ordinal, position, row, adapter) |
|
|
|
|
|