|
|
|
@ -68,11 +68,6 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL |
|
|
|
initUI() |
|
|
|
initUI() |
|
|
|
this.edit() |
|
|
|
this.edit() |
|
|
|
|
|
|
|
|
|
|
|
// this.model.selectionLiveData.value?.index?.let { |
|
|
|
|
|
|
|
// Timber.d(">>>> attempt to retrieveEditTextInputConnection") |
|
|
|
|
|
|
|
// this.retrieveEditTextInputConnection(it) |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun initData() { |
|
|
|
private fun initData() { |
|
|
|
@ -127,8 +122,10 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL |
|
|
|
// At first, the selection is defined before the holder is bound, |
|
|
|
// At first, the selection is defined before the holder is bound, |
|
|
|
// so we retrieve the editText inputConnection once the recycler view has been rendered |
|
|
|
// so we retrieve the editText inputConnection once the recycler view has been rendered |
|
|
|
this.recyclerView.viewTreeObserver.addOnGlobalLayoutListener { |
|
|
|
this.recyclerView.viewTreeObserver.addOnGlobalLayoutListener { |
|
|
|
this.model.selectionLiveData.value?.index?.let { |
|
|
|
this.model.selectionLiveData.value?.let { selection -> |
|
|
|
retrieveEditTextInputConnection(it) |
|
|
|
if (selection.keyboard == HHKeyboard.AMOUNT) { |
|
|
|
|
|
|
|
retrieveEditTextInputConnection(selection.index) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -140,7 +137,7 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL |
|
|
|
|
|
|
|
|
|
|
|
val computedAction = this.model.rowRepresentableForPosition(position) as? ComputedAction |
|
|
|
val computedAction = this.model.rowRepresentableForPosition(position) as? ComputedAction |
|
|
|
|
|
|
|
|
|
|
|
val holder = recyclerView.findViewHolderForAdapterPosition(position) as? HandHistoryAdapter.RowHandAction |
|
|
|
val holder = recyclerView.findViewHolderForAdapterPosition(position) |
|
|
|
holder?.let { |
|
|
|
holder?.let { |
|
|
|
val amountEditText = it.itemView.findViewById<EditText>(R.id.amountEditText) |
|
|
|
val amountEditText = it.itemView.findViewById<EditText>(R.id.amountEditText) |
|
|
|
this.keyboard.setAmountEditText(amountEditText, computedAction?.action?.amount) |
|
|
|
this.keyboard.setAmountEditText(amountEditText, computedAction?.action?.amount) |
|
|
|
@ -173,7 +170,8 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL |
|
|
|
} ?: run { |
|
|
|
} ?: run { |
|
|
|
this.keyboard.hide() |
|
|
|
this.keyboard.hide() |
|
|
|
} |
|
|
|
} |
|
|
|
this.refreshCells(startIndex) |
|
|
|
this.handHistoryAdapter.notifyDataSetChanged() |
|
|
|
|
|
|
|
// this.refreshCells(startIndex) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onRowSelected(position: Int, row: RowRepresentable, tag: Int) { |
|
|
|
override fun onRowSelected(position: Int, row: RowRepresentable, tag: Int) { |
|
|
|
@ -283,9 +281,12 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL |
|
|
|
this.findNextActionToEdit() |
|
|
|
this.findNextActionToEdit() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun amountChanged(amount: String?) { |
|
|
|
|
|
|
|
this.model.amountChanged(amount) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun amountCleared() { |
|
|
|
override fun amountCleared() { |
|
|
|
this.model.clearAmount() |
|
|
|
this.model.clearAmount() |
|
|
|
// this.refreshCurrentRow() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun closeKeyboard() { |
|
|
|
override fun closeKeyboard() { |
|
|
|
@ -296,10 +297,6 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL |
|
|
|
this.keyboard?.hide() |
|
|
|
this.keyboard?.hide() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun amountChanged(amount: String?) { |
|
|
|
|
|
|
|
this.model.amountChanged(amount) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun positionSelected(position: Position) { |
|
|
|
override fun positionSelected(position: Position) { |
|
|
|
val rowRepresentableIndex = this.model.nextActionIndexForPosition(position) |
|
|
|
val rowRepresentableIndex = this.model.nextActionIndexForPosition(position) |
|
|
|
this.model.rowRepresentableForPosition(rowRepresentableIndex)?.let { |
|
|
|
this.model.rowRepresentableForPosition(rowRepresentableIndex)?.let { |
|
|
|
|