Merge pull request #175 from CrystalPony/master
Fix the cursor position resetting to 0 when there's a space on either side of the address field
This commit is contained in:
commit
e9c166a47d
|
@ -69,10 +69,13 @@ class SendAddressFragment : BaseFragment<FragmentSendAddressBinding>(),
|
||||||
|
|
||||||
binding.inputZcashAddress.apply {
|
binding.inputZcashAddress.apply {
|
||||||
doAfterTextChanged {
|
doAfterTextChanged {
|
||||||
val trim = text.toString().trim()
|
val textStr = text.toString()
|
||||||
|
val trim = textStr.trim()
|
||||||
if (text.toString() != trim) {
|
if (text.toString() != trim) {
|
||||||
binding.inputZcashAddress
|
val textView = binding.inputZcashAddress.findViewById<EditText>(R.id.input_zcash_address)
|
||||||
.findViewById<EditText>(R.id.input_zcash_address).setText(trim)
|
val cursorPosition = textView.selectionEnd;
|
||||||
|
textView.setText(trim)
|
||||||
|
textView.setSelection(cursorPosition-(textStr.length-trim.length))
|
||||||
}
|
}
|
||||||
onAddressChanged(trim)
|
onAddressChanged(trim)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue