Laurent 6 years ago
parent 46089b13c6
commit cb055bcaa3
  1. 28
      app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryAdapter.kt

@ -80,7 +80,7 @@ class HandHistoryAdapter(
} }
} }
abstract inner class RowHandHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { abstract inner class RowHandHolder(itemView: View) : RecyclerView.ViewHolder(itemView), BindableHolder {
var currentPosition = 0 var currentPosition = 0
@ -100,13 +100,16 @@ class HandHistoryAdapter(
} }
} }
override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) {
this.currentPosition = position
}
} }
/** /**
* Display a hand action * Display a hand action
*/ */
inner class RowHandAction(itemView: View) : RowHandHolder(itemView), inner class RowHandAction(itemView: View) : RowHandHolder(itemView) {
BindableHolder {
init { init {
// Action // Action
@ -144,10 +147,7 @@ class HandHistoryAdapter(
} }
override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) { override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) {
super.onBind(position, row, adapter)
Timber.d("onbind @position = $position")
this.currentPosition = position
val computedAction = row as ComputedAction val computedAction = row as ComputedAction
@ -204,7 +204,7 @@ class HandHistoryAdapter(
/** /**
* Display a hand street * Display a hand street
*/ */
inner class RowHandStreet(itemView: View) : RowHandHolder(itemView), BindableHolder { inner class RowHandStreet(itemView: View) : RowHandHolder(itemView) {
init { init {
@ -232,7 +232,7 @@ class HandHistoryAdapter(
override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) { override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) {
this.currentPosition = position super.onBind(position, row, adapter)
val streetCardView = row as StreetCardsRow val streetCardView = row as StreetCardsRow
val street = streetCardView.street val street = streetCardView.street
@ -289,8 +289,7 @@ class HandHistoryAdapter(
/** /**
* Display a hand action * Display a hand action
*/ */
inner class RowHandPlayerSummary(itemView: View) : RowHandHolder(itemView), inner class RowHandPlayerSummary(itemView: View) : RowHandHolder(itemView) {
BindableHolder {
init { init {
@ -318,9 +317,7 @@ class HandHistoryAdapter(
override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) { override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) {
Timber.d("onbind @position = $position") super.onBind(position, row, adapter)
this.currentPosition = position
val playerCardView = row as PlayerCardsRow val playerCardView = row as PlayerCardsRow
@ -349,11 +346,8 @@ class HandHistoryAdapter(
} else { } else {
cardsEditText.clearFocus() cardsEditText.clearFocus()
} }
} }
} }
} }
} }
Loading…
Cancel
Save