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 imageHash = bundle.getString(ContactPickerSheetFragment.KEY_IMAGE_HASH)
|
||||
prefillToDirectly(accountNumber, label, subtitle, colorHex, imageHash)
|
||||
focusAmount()
|
||||
if (selectedAccount == null) {
|
||||
val defaultNum = CredentialStore(requireContext()).getDefaultAccountNumber()
|
||||
if (defaultNum != null) {
|
||||
@@ -726,13 +727,12 @@ class TransferFragment : Fragment() {
|
||||
}
|
||||
|
||||
private fun setupAccountLookup() {
|
||||
binding.tilTo.setEndIconOnClickListener {
|
||||
// M-Faisa source uses an entirely different lookup path (phone → basicBeneDetails)
|
||||
if (selectedAccount?.bank == "MFAISA") {
|
||||
mfaisaHandler().searchRecipient(binding.etTo.text?.toString().orEmpty())
|
||||
} else {
|
||||
lookupAccount()
|
||||
}
|
||||
binding.tilTo.setEndIconOnClickListener { searchTo() }
|
||||
binding.etTo.setOnEditorActionListener { _, actionId, _ ->
|
||||
if (actionId == android.view.inputmethod.EditorInfo.IME_ACTION_SEARCH) {
|
||||
searchTo()
|
||||
true
|
||||
} else false
|
||||
}
|
||||
|
||||
binding.btnClearToInfo.setOnClickListener {
|
||||
@@ -774,6 +774,28 @@ class TransferFragment : Fragment() {
|
||||
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). */
|
||||
private fun setupContactDropdown() {
|
||||
val adapter = ContactDropdownAdapter(requireContext()) { selectedAccount?.bank == "MFAISA" }
|
||||
@@ -793,6 +815,7 @@ class TransferFragment : Fragment() {
|
||||
colorHex = contact.bankColor,
|
||||
imageHash = contact.customerImgHash
|
||||
)
|
||||
focusAmount()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -831,6 +854,7 @@ class TransferFragment : Fragment() {
|
||||
colorHex = matchedContact.bankColor,
|
||||
imageHash = matchedContact.customerImgHash
|
||||
)
|
||||
focusAmount()
|
||||
return
|
||||
}
|
||||
|
||||
@@ -922,6 +946,7 @@ class TransferFragment : Fragment() {
|
||||
binding.cardToInfo.visibility = View.VISIBLE
|
||||
updateTransferButton()
|
||||
saveToRecents(info)
|
||||
focusAmount()
|
||||
|
||||
when {
|
||||
matchedAcc?.profileImageHash != null ->
|
||||
|
||||
@@ -194,5 +194,6 @@ class FahipayTransferHandler(
|
||||
colorHex = "#FF6B00",
|
||||
imageHash = null
|
||||
)
|
||||
fragment.focusAmount()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,6 +121,7 @@ class MfaisaTransferHandler(
|
||||
} else {
|
||||
recipient = result
|
||||
showResolvedRecipient(result)
|
||||
fragment.focusAmount()
|
||||
}
|
||||
} catch (_: MfaisaRecipientNotFoundException) {
|
||||
binding.tilTo.error = "No M-Faisa wallet found for this number"
|
||||
|
||||
@@ -156,7 +156,8 @@
|
||||
android:inputType="textNoSuggestions"
|
||||
android:maxLines="1"
|
||||
android:completionThreshold="3"
|
||||
android:dropDownHeight="wrap_content" />
|
||||
android:dropDownHeight="wrap_content"
|
||||
android:imeOptions="actionSearch" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user