|
|
|
@ -55,7 +55,8 @@ enum class HandRowType(var layoutRes: Int) : ViewIdentifier, RowRepresentable { |
|
|
|
PLAYER_SETUP_READ(R.layout.row_hhsettings_player_setup_read), |
|
|
|
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), |
|
|
|
|
|
|
|
HERO_POSITION(R.layout.row_hhsettings_hero_position) |
|
|
|
; |
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
override val viewType: Int = this.ordinal |
|
|
|
override val viewType: Int = this.ordinal |
|
|
|
@ -113,14 +114,15 @@ class HandHistoryAdapter( |
|
|
|
return when (rowType) { |
|
|
|
return when (rowType) { |
|
|
|
HandRowType.DEFAULT -> RowViewHolder(layout) |
|
|
|
HandRowType.DEFAULT -> RowViewHolder(layout) |
|
|
|
HandRowType.HEADER -> RowViewHolder(layout) |
|
|
|
HandRowType.HEADER -> RowViewHolder(layout) |
|
|
|
HandRowType.ACTION -> RowHandAction(layout) |
|
|
|
HandRowType.ACTION -> RowActionHolder(layout) |
|
|
|
HandRowType.STREET -> RowHandStreet(layout) |
|
|
|
HandRowType.STREET -> RowStreetHolder(layout) |
|
|
|
HandRowType.PLAYER_SUMMARY -> RowHandPlayerSummary(layout) |
|
|
|
HandRowType.PLAYER_SUMMARY -> RowPlayerSummaryHolder(layout) |
|
|
|
HandRowType.STRADDLE -> RowHandStraddle(layout) |
|
|
|
HandRowType.STRADDLE -> RowStraddleHolder(layout) |
|
|
|
HandRowType.PLAYER_SETUP -> RowHandPlayerSetup(layout) |
|
|
|
HandRowType.PLAYER_SETUP -> RowPlayerSetupHolder(layout) |
|
|
|
HandRowType.PLAYER_SETUP_READ -> RowHandReadOnlyPlayerSetup(layout) |
|
|
|
HandRowType.PLAYER_SETUP_READ -> RowReadOnlyPlayerSetupHolder(layout) |
|
|
|
HandRowType.COMMENT -> RowViewHolder(layout) |
|
|
|
HandRowType.COMMENT -> RowViewHolder(layout) |
|
|
|
HandRowType.ACTION_READ -> RowActionRead(layout) |
|
|
|
HandRowType.ACTION_READ -> RowActionReadHolder(layout) |
|
|
|
|
|
|
|
HandRowType.HERO_POSITION -> RowPositionHolder(layout) |
|
|
|
HandRowType.PLAYER_NUMBER, HandRowType.ANTE, HandRowType.BIG_BLIND_ANTE -> RowViewHolder(layout) |
|
|
|
HandRowType.PLAYER_NUMBER, HandRowType.ANTE, HandRowType.BIG_BLIND_ANTE -> RowViewHolder(layout) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -290,7 +292,7 @@ class HandHistoryAdapter( |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
inner class RowHandStraddle(itemView: View) : RowHandHolder(itemView) { |
|
|
|
inner class RowStraddleHolder(itemView: View) : RowHandHolder(itemView) { |
|
|
|
|
|
|
|
|
|
|
|
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) |
|
|
|
@ -325,7 +327,7 @@ class HandHistoryAdapter( |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Display a hand action |
|
|
|
* Display a hand action |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
inner class RowHandAction(itemView: View) : RowHandHolder(itemView) { |
|
|
|
inner class RowActionHolder(itemView: View) : RowHandHolder(itemView) { |
|
|
|
|
|
|
|
|
|
|
|
init { |
|
|
|
init { |
|
|
|
itemView.actionButton.tag = ComputedAction.Tag.ACTION.ordinal |
|
|
|
itemView.actionButton.tag = ComputedAction.Tag.ACTION.ordinal |
|
|
|
@ -404,7 +406,7 @@ class HandHistoryAdapter( |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
inner class RowActionRead(itemView: View) : RowHandHolder(itemView) { |
|
|
|
inner class RowActionReadHolder(itemView: View) : RowHandHolder(itemView) { |
|
|
|
|
|
|
|
|
|
|
|
override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) { |
|
|
|
override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) { |
|
|
|
|
|
|
|
|
|
|
|
@ -420,7 +422,7 @@ class HandHistoryAdapter( |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Display a hand street |
|
|
|
* Display a hand street |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
inner class RowHandStreet(itemView: View) : RowHandHolder(itemView) { |
|
|
|
inner class RowStreetHolder(itemView: View) : RowHandHolder(itemView) { |
|
|
|
|
|
|
|
|
|
|
|
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) |
|
|
|
@ -436,7 +438,7 @@ class HandHistoryAdapter( |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Display a hand action |
|
|
|
* Display a hand action |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
inner class RowHandPlayerSummary(itemView: View) : RowHandHolder(itemView) { |
|
|
|
inner class RowPlayerSummaryHolder(itemView: View) : RowHandHolder(itemView) { |
|
|
|
|
|
|
|
|
|
|
|
init { |
|
|
|
init { |
|
|
|
itemView.handLayout.tag = PlayerCardsRow.Tag.CARDS.ordinal |
|
|
|
itemView.handLayout.tag = PlayerCardsRow.Tag.CARDS.ordinal |
|
|
|
@ -502,7 +504,7 @@ class HandHistoryAdapter( |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
inner class RowHandReadOnlyPlayerSetup(itemView: View) : AbstractRowHandPlayerSetup(itemView) { |
|
|
|
inner class RowReadOnlyPlayerSetupHolder(itemView: View) : AbstractRowHandPlayerSetup(itemView) { |
|
|
|
|
|
|
|
|
|
|
|
init { |
|
|
|
init { |
|
|
|
itemView.ps_player_image.tag = PlayerSetupRow.Tag.PLAYER.ordinal |
|
|
|
itemView.ps_player_image.tag = PlayerSetupRow.Tag.PLAYER.ordinal |
|
|
|
@ -520,7 +522,36 @@ class HandHistoryAdapter( |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
inner class RowHandPlayerSetup(itemView: View) : AbstractRowHandPlayerSetup(itemView) { |
|
|
|
inner class RowPositionHolder(itemView: View) : RowHandHolder(itemView) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private var positionAdapter: PositionAdapter = PositionAdapter() |
|
|
|
|
|
|
|
private var positionViewManager: LinearLayoutManager = |
|
|
|
|
|
|
|
LinearLayoutManager(itemView.context, RecyclerView.HORIZONTAL, false) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
init { |
|
|
|
|
|
|
|
itemView.position_recycler.apply { |
|
|
|
|
|
|
|
setHasFixedSize(true) |
|
|
|
|
|
|
|
layoutManager = positionViewManager |
|
|
|
|
|
|
|
adapter = positionAdapter |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) { |
|
|
|
|
|
|
|
super.onBind(position, row, adapter) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.positionAdapter.positions = adapter.dataSource.contentForRow(row, itemView.context, Position::class) |
|
|
|
|
|
|
|
this.positionAdapter.setOnClickListener { pos -> |
|
|
|
|
|
|
|
adapter.delegate?.onRowValueChanged(pos, row) |
|
|
|
|
|
|
|
this.positionAdapter.notifyDataSetChanged() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val heroIndex = adapter.dataSource.intForRow(row) |
|
|
|
|
|
|
|
positionAdapter.setSelectedPosition(heroIndex) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inner class RowPlayerSetupHolder(itemView: View) : AbstractRowHandPlayerSetup(itemView) { |
|
|
|
|
|
|
|
|
|
|
|
private var positionAdapter: PositionAdapter = PositionAdapter() |
|
|
|
private var positionAdapter: PositionAdapter = PositionAdapter() |
|
|
|
private var positionViewManager: LinearLayoutManager |
|
|
|
private var positionViewManager: LinearLayoutManager |
|
|
|
|