Merge branch 'fix/contact-add-page-account-number-enter-behaviour'
Auto Tag on Version Change / check-version (push) Failing after 3s
Auto Tag on Version Change / check-version (push) Failing after 3s
# Conflicts: # app/src/main/java/sh/sar/basedbank/ui/home/TransferFragment.kt
This commit is contained in:
@@ -234,6 +234,12 @@ class AddContactSheetFragment : BottomSheetDialogFragment() {
|
|||||||
|
|
||||||
private fun setupAccountSearch() {
|
private fun setupAccountSearch() {
|
||||||
binding.tilAccount.setEndIconOnClickListener { performLookup() }
|
binding.tilAccount.setEndIconOnClickListener { performLookup() }
|
||||||
|
binding.etAccount.setOnEditorActionListener { _, actionId, _ ->
|
||||||
|
if (actionId == android.view.inputmethod.EditorInfo.IME_ACTION_SEARCH) {
|
||||||
|
performLookup()
|
||||||
|
true
|
||||||
|
} else false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun performLookup() {
|
private fun performLookup() {
|
||||||
@@ -387,7 +393,7 @@ class AddContactSheetFragment : BottomSheetDialogFragment() {
|
|||||||
|
|
||||||
// Auto-fill alias with existing alias or name
|
// Auto-fill alias with existing alias or name
|
||||||
if (binding.etAlias.text.isNullOrBlank()) {
|
if (binding.etAlias.text.isNullOrBlank()) {
|
||||||
binding.etAlias.setText(validation.name)
|
binding.etAlias.setText(sh.sar.basedbank.util.bmlapi.BmlDashboardParser.toTitleCase(validation.name))
|
||||||
}
|
}
|
||||||
binding.etCurrency.setText(validation.currency)
|
binding.etCurrency.setText(validation.currency)
|
||||||
|
|
||||||
|
|||||||
@@ -343,6 +343,7 @@ class TransferFragment : Fragment() {
|
|||||||
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)
|
||||||
selectDefaultSourceIfNone()
|
selectDefaultSourceIfNone()
|
||||||
|
focusAmount()
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.btnPickContact.setOnClickListener {
|
binding.btnPickContact.setOnClickListener {
|
||||||
@@ -715,13 +716,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 {
|
||||||
@@ -763,6 +763,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" }
|
||||||
@@ -783,6 +805,7 @@ class TransferFragment : Fragment() {
|
|||||||
imageHash = contact.customerImgHash
|
imageHash = contact.customerImgHash
|
||||||
)
|
)
|
||||||
selectDefaultSourceIfNone()
|
selectDefaultSourceIfNone()
|
||||||
|
focusAmount()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -829,6 +852,7 @@ class TransferFragment : Fragment() {
|
|||||||
colorHex = matchedContact.bankColor,
|
colorHex = matchedContact.bankColor,
|
||||||
imageHash = matchedContact.customerImgHash
|
imageHash = matchedContact.customerImgHash
|
||||||
)
|
)
|
||||||
|
focusAmount()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -920,6 +944,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