|
|
|
@ -338,27 +338,31 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL |
|
|
|
|
|
|
|
|
|
|
|
if (row is HandHistoryRow) { |
|
|
|
if (row is HandHistoryRow) { |
|
|
|
|
|
|
|
|
|
|
|
this.model.selectionLiveData.value?.index?.let { oldIndex -> |
|
|
|
if (this.model.hasSelection()) { |
|
|
|
refreshRowAtIndexAndCurrent(oldIndex) |
|
|
|
this.model.amountValidated() // validates any edited amount before possibly clearing action |
|
|
|
|
|
|
|
refreshRowAtIndexAndCurrent(this.model.currentSelection.index) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.model.selectionLiveData.value = HHSelection(position, tag) |
|
|
|
// this.model.selectionLiveData.value?.index?.let { oldIndex -> |
|
|
|
|
|
|
|
// refreshRowAtIndexAndCurrent(oldIndex) |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val newSelection = HHSelection(position, tag) |
|
|
|
|
|
|
|
this.model.setSelection(newSelection) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// this.model.selectionLiveData.value = HHSelection(position, tag) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onRowDeselected(position: Int, row: RowRepresentable) { |
|
|
|
override fun onRowDeselected(position: Int, row: RowRepresentable) { |
|
|
|
this.model.selectionLiveData.value = null |
|
|
|
this.model.clearSelection() |
|
|
|
this.model.currentAmount = null |
|
|
|
this.model.currentAmount = null |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onRowValueChanged(value: Any?, row: RowRepresentable) { |
|
|
|
override fun onRowValueChanged(value: Any?, row: RowRepresentable) { |
|
|
|
|
|
|
|
|
|
|
|
if (this.model.selectionLiveData.value != null) { |
|
|
|
|
|
|
|
this.model.amountValidated() // validates any edited amount before possibly clearing action |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
when (row) { |
|
|
|
when (row) { |
|
|
|
HandRowType.COMMENT -> { |
|
|
|
HandRowType.COMMENT -> { |
|
|
|
this.model.handHistory.comment = value as? String |
|
|
|
this.model.handHistory.comment = value as? String |
|
|
|
@ -489,7 +493,7 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
override fun closeKeyboard() { |
|
|
|
override fun closeKeyboard() { |
|
|
|
val currentIndex = this.model.currentSelection.index |
|
|
|
val currentIndex = this.model.currentSelection.index |
|
|
|
this.model.selectionLiveData.value = null |
|
|
|
this.model.clearSelection() |
|
|
|
this.handHistoryAdapter.notifyItemChanged(currentIndex) |
|
|
|
this.handHistoryAdapter.notifyItemChanged(currentIndex) |
|
|
|
this.animateKeyboard(false) |
|
|
|
this.animateKeyboard(false) |
|
|
|
// this.hideKeyboard() |
|
|
|
// this.hideKeyboard() |
|
|
|
@ -530,10 +534,16 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL |
|
|
|
* Refreshes the selected row |
|
|
|
* Refreshes the selected row |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private fun refreshSelectedRow() { |
|
|
|
private fun refreshSelectedRow() { |
|
|
|
this.model.selectionLiveData.value?.index?.let { |
|
|
|
|
|
|
|
Timber.d("refreshes row at index = $it") |
|
|
|
if (this.model.hasSelection()) { |
|
|
|
this.handHistoryAdapter.notifyItemChanged(it) |
|
|
|
val index = this.model.currentSelection.index |
|
|
|
|
|
|
|
this.handHistoryAdapter.notifyItemChanged(index) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// this.model.selectionLiveData.value?.index?.let { |
|
|
|
|
|
|
|
// Timber.d("refreshes row at index = $it") |
|
|
|
|
|
|
|
// this.handHistoryAdapter.notifyItemChanged(it) |
|
|
|
|
|
|
|
// } |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
/*** |
|
|
|
@ -587,14 +597,6 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL |
|
|
|
lp.guideEnd = 0 |
|
|
|
lp.guideEnd = 0 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun showNextHand() { |
|
|
|
|
|
|
|
TODO("not implemented") //To change body of created functions use File | Settings | File Templates. |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun showPreviousHand() { |
|
|
|
|
|
|
|
TODO("not implemented") //To change body of created functions use File | Settings | File Templates. |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
/*** |
|
|
|
* Deletes the current hand |
|
|
|
* Deletes the current hand |
|
|
|
* Finishes the activity to go back |
|
|
|
* Finishes the activity to go back |
|
|
|
|