also add search button to keyboard in transfer page to feild and move focus to amount feild on search search or to field fill
This commit is contained in:
@@ -342,6 +342,7 @@ class TransferFragment : Fragment() {
|
|||||||
val colorHex = bundle.getString(ContactPickerSheetFragment.KEY_COLOR) ?: "#607D8B"
|
val colorHex = bundle.getString(ContactPickerSheetFragment.KEY_COLOR) ?: "#607D8B"
|
||||||
val imageHash = bundle.getString(ContactPickerSheetFragment.KEY_IMAGE_HASH)
|
val imageHash = bundle.getString(ContactPickerSheetFragment.KEY_IMAGE_HASH)
|
||||||
prefillToDirectly(accountNumber, label, subtitle, colorHex, imageHash)
|
prefillToDirectly(accountNumber, label, subtitle, colorHex, imageHash)
|
||||||
|
focusAmount()
|
||||||
if (selectedAccount == null) {
|
if (selectedAccount == null) {
|
||||||
val defaultNum = CredentialStore(requireContext()).getDefaultAccountNumber()
|
val defaultNum = CredentialStore(requireContext()).getDefaultAccountNumber()
|
||||||
if (defaultNum != null) {
|
if (defaultNum != null) {
|
||||||
@@ -726,13 +727,12 @@ class TransferFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun setupAccountLookup() {
|
private fun setupAccountLookup() {
|
||||||
binding.tilTo.setEndIconOnClickListener {
|
binding.tilTo.setEndIconOnClickListener { searchTo() }
|
||||||
// M-Faisa source uses an entirely different lookup path (phone → basicBeneDetails)
|
binding.etTo.setOnEditorActionListener { _, actionId, _ ->
|
||||||
if (selectedAccount?.bank == "MFAISA") {
|
if (actionId == android.view.inputmethod.EditorInfo.IME_ACTION_SEARCH) {
|
||||||
mfaisaHandler().searchRecipient(binding.etTo.text?.toString().orEmpty())
|
searchTo()
|
||||||
} else {
|
true
|
||||||
lookupAccount()
|
} else false
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.btnClearToInfo.setOnClickListener {
|
binding.btnClearToInfo.setOnClickListener {
|
||||||
@@ -774,6 +774,28 @@ class TransferFragment : Fragment() {
|
|||||||
setupContactDropdown()
|
setupContactDropdown()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun searchTo() {
|
||||||
|
// M-Faisa source uses an entirely different lookup path (phone → basicBeneDetails)
|
||||||
|
if (selectedAccount?.bank == "MFAISA") {
|
||||||
|
mfaisaHandler().searchRecipient(binding.etTo.text?.toString().orEmpty())
|
||||||
|
} else {
|
||||||
|
lookupAccount()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Moves focus to the amount field and brings up the keyboard once a recipient is resolved. */
|
||||||
|
internal fun focusAmount() {
|
||||||
|
val et = binding.etAmount
|
||||||
|
// Posted so it runs after the To-row visibility changes and any closing picker sheet
|
||||||
|
et.post {
|
||||||
|
if (_binding == null) return@post
|
||||||
|
et.requestFocus()
|
||||||
|
et.setSelection(et.text?.length ?: 0)
|
||||||
|
val imm = requireContext().getSystemService(Context.INPUT_METHOD_SERVICE) as android.view.inputmethod.InputMethodManager
|
||||||
|
imm.showSoftInput(et, android.view.inputmethod.InputMethodManager.SHOW_IMPLICIT)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Live "search contacts as you type" dropdown on the To field (shown once 3+ chars are entered). */
|
/** Live "search contacts as you type" dropdown on the To field (shown once 3+ chars are entered). */
|
||||||
private fun setupContactDropdown() {
|
private fun setupContactDropdown() {
|
||||||
val adapter = ContactDropdownAdapter(requireContext()) { selectedAccount?.bank == "MFAISA" }
|
val adapter = ContactDropdownAdapter(requireContext()) { selectedAccount?.bank == "MFAISA" }
|
||||||
@@ -793,6 +815,7 @@ class TransferFragment : Fragment() {
|
|||||||
colorHex = contact.bankColor,
|
colorHex = contact.bankColor,
|
||||||
imageHash = contact.customerImgHash
|
imageHash = contact.customerImgHash
|
||||||
)
|
)
|
||||||
|
focusAmount()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -831,6 +854,7 @@ class TransferFragment : Fragment() {
|
|||||||
colorHex = matchedContact.bankColor,
|
colorHex = matchedContact.bankColor,
|
||||||
imageHash = matchedContact.customerImgHash
|
imageHash = matchedContact.customerImgHash
|
||||||
)
|
)
|
||||||
|
focusAmount()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -922,6 +946,7 @@ class TransferFragment : Fragment() {
|
|||||||
binding.cardToInfo.visibility = View.VISIBLE
|
binding.cardToInfo.visibility = View.VISIBLE
|
||||||
updateTransferButton()
|
updateTransferButton()
|
||||||
saveToRecents(info)
|
saveToRecents(info)
|
||||||
|
focusAmount()
|
||||||
|
|
||||||
when {
|
when {
|
||||||
matchedAcc?.profileImageHash != null ->
|
matchedAcc?.profileImageHash != null ->
|
||||||
|
|||||||
@@ -194,5 +194,6 @@ class FahipayTransferHandler(
|
|||||||
colorHex = "#FF6B00",
|
colorHex = "#FF6B00",
|
||||||
imageHash = null
|
imageHash = null
|
||||||
)
|
)
|
||||||
|
fragment.focusAmount()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ class MfaisaTransferHandler(
|
|||||||
} else {
|
} else {
|
||||||
recipient = result
|
recipient = result
|
||||||
showResolvedRecipient(result)
|
showResolvedRecipient(result)
|
||||||
|
fragment.focusAmount()
|
||||||
}
|
}
|
||||||
} catch (_: MfaisaRecipientNotFoundException) {
|
} catch (_: MfaisaRecipientNotFoundException) {
|
||||||
binding.tilTo.error = "No M-Faisa wallet found for this number"
|
binding.tilTo.error = "No M-Faisa wallet found for this number"
|
||||||
|
|||||||
@@ -156,7 +156,8 @@
|
|||||||
android:inputType="textNoSuggestions"
|
android:inputType="textNoSuggestions"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:completionThreshold="3"
|
android:completionThreshold="3"
|
||||||
android:dropDownHeight="wrap_content" />
|
android:dropDownHeight="wrap_content"
|
||||||
|
android:imeOptions="actionSearch" />
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user