|
|
|
|
@ -105,11 +105,16 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDataSource, RowRepr |
|
|
|
|
findNextActionToEdit(0) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun findNextActionToEdit() { |
|
|
|
|
val index = this.model.currentSelection?.index ?: throw PAIllegalStateException("Request next with no selection") |
|
|
|
|
this.findNextActionToEdit(index) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private fun findNextActionToEdit(startIndex: Int) { |
|
|
|
|
this.model.findIndexForEdition(startIndex)?.let { |
|
|
|
|
// this.handHistoryAdapter.notifyItemChanged(startIndex) |
|
|
|
|
this.keyboard.show(it) |
|
|
|
|
this.highlightCell() |
|
|
|
|
this.highlightCell(startIndex) |
|
|
|
|
} ?: run { |
|
|
|
|
this.keyboard.hide() |
|
|
|
|
} |
|
|
|
|
@ -119,9 +124,11 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDataSource, RowRepr |
|
|
|
|
this.model.isEdited = false |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private fun highlightCell() { |
|
|
|
|
private fun highlightCell(oldIndex: Int) { |
|
|
|
|
|
|
|
|
|
this.handHistoryAdapter.notifyItemChanged(oldIndex) |
|
|
|
|
this.model.currentSelection?.index?.let { |
|
|
|
|
Timber.d("refreshes old = $oldIndex, new = $it") |
|
|
|
|
this.handHistoryAdapter.notifyItemChanged(it) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -155,19 +162,21 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDataSource, RowRepr |
|
|
|
|
|
|
|
|
|
this.model.currentSelection = HHSelection(position, HHKeyboard.values()[tag]) |
|
|
|
|
|
|
|
|
|
when (row) { |
|
|
|
|
val keyboard = when (row) { |
|
|
|
|
is ComputedAction -> { |
|
|
|
|
val keyboard = when (tag) { |
|
|
|
|
when (tag) { |
|
|
|
|
HHKeyboard.ACTION.ordinal -> HHKeyboard.ACTION |
|
|
|
|
HHKeyboard.AMOUNT.ordinal -> HHKeyboard.AMOUNT |
|
|
|
|
else -> throw PAIllegalStateException("Unmanaged tag value: $tag") |
|
|
|
|
} |
|
|
|
|
this.keyboard.show(keyboard) |
|
|
|
|
} |
|
|
|
|
is StreetCardHeader -> { |
|
|
|
|
this.keyboard.show(HHKeyboard.CARD) |
|
|
|
|
HHKeyboard.CARD |
|
|
|
|
} |
|
|
|
|
else -> null |
|
|
|
|
} |
|
|
|
|
Timber.d("row $position selected, show keyboard = $keyboard") |
|
|
|
|
keyboard?.let { this.keyboard.show(keyboard) } |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -183,7 +192,7 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDataSource, RowRepr |
|
|
|
|
val currentSelection = this.model.currentSelection |
|
|
|
|
val isSelectedIndex = (position == currentSelection?.index) |
|
|
|
|
val isSelectedAction = (tag == currentSelection?.keyboard?.ordinal) |
|
|
|
|
Timber.d("position = $position, tag = $tag, current index = ${currentSelection?.index}, kb = ${currentSelection?.keyboard}") |
|
|
|
|
// Timber.d("position = $position, tag = $tag, current index = ${currentSelection?.index}, kb = ${currentSelection?.keyboard}") |
|
|
|
|
return isSelectedIndex && isSelectedAction |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -193,7 +202,7 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDataSource, RowRepr |
|
|
|
|
Timber.d(">>> action $action selected") |
|
|
|
|
this.model.actionSelected(action) |
|
|
|
|
// this.handHistoryAdapter.notifyDataSetChanged() |
|
|
|
|
this.findNextActionToEdit(this.model.actionIndexForSelection) |
|
|
|
|
this.findNextActionToEdit() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun cardValueSelected(value: Int) { |
|
|
|
|
@ -216,7 +225,7 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDataSource, RowRepr |
|
|
|
|
Timber.d(">>> amount validated") |
|
|
|
|
this.model.amountValidated() |
|
|
|
|
// this.handHistoryAdapter.notifyDataSetChanged() |
|
|
|
|
this.findNextActionToEdit(this.model.actionIndexForSelection) |
|
|
|
|
this.findNextActionToEdit() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |