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() {
|
||||
binding.tilAccount.setEndIconOnClickListener { performLookup() }
|
||||
binding.etAccount.setOnEditorActionListener { _, actionId, _ ->
|
||||
if (actionId == android.view.inputmethod.EditorInfo.IME_ACTION_SEARCH) {
|
||||
performLookup()
|
||||
true
|
||||
} else false
|
||||
}
|
||||
}
|
||||
|
||||
private fun performLookup() {
|
||||
@@ -387,7 +393,7 @@ class AddContactSheetFragment : BottomSheetDialogFragment() {
|
||||
|
||||
// Auto-fill alias with existing alias or name
|
||||
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)
|
||||
|
||||
|
||||
@@ -343,6 +343,7 @@ class TransferFragment : Fragment() {
|
||||
val imageHash = bundle.getString(ContactPickerSheetFragment.KEY_IMAGE_HASH)
|
||||
prefillToDirectly(accountNumber, label, subtitle, colorHex, imageHash)
|
||||
selectDefaultSourceIfNone()
|
||||
focusAmount()
|
||||
}
|
||||
|
||||
binding.btnPickContact.setOnClickListener {
|
||||
@@ -715,13 +716,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 {
|
||||
@@ -763,6 +763,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" }
|
||||
@@ -783,6 +805,7 @@ class TransferFragment : Fragment() {
|
||||
imageHash = contact.customerImgHash
|
||||
)
|
||||
selectDefaultSourceIfNone()
|
||||
focusAmount()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -829,6 +852,7 @@ class TransferFragment : Fragment() {
|
||||
colorHex = matchedContact.bankColor,
|
||||
imageHash = matchedContact.customerImgHash
|
||||
)
|
||||
focusAmount()
|
||||
return
|
||||
}
|
||||
|
||||
@@ -920,6 +944,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