From c437b35ffb12a7ac9373a1b1ebc970ed7f342177 Mon Sep 17 00:00:00 2001 From: SeniorZhai Date: Thu, 31 Oct 2024 20:35:09 +0800 Subject: [PATCH] Format address from scan --- .../mixin/android/web3/send/InputAddressFragment.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/one/mixin/android/web3/send/InputAddressFragment.kt b/app/src/main/java/one/mixin/android/web3/send/InputAddressFragment.kt index ea3df40793..a4073cf94f 100644 --- a/app/src/main/java/one/mixin/android/web3/send/InputAddressFragment.kt +++ b/app/src/main/java/one/mixin/android/web3/send/InputAddressFragment.kt @@ -176,11 +176,20 @@ class InputAddressFragment() : BaseFragment(R.layout.fragment_address_input) { if (isIcapAddress(text)) { binding.addrEt.setText(decodeICAP(text)) } else { - binding.addrEt.setText(text) + binding.addrEt.setText(formatAddress(text)) } } } + private fun formatAddress(text: String): String { + val colonIndex = text.indexOf(':') + return if (colonIndex != -1) { + text.substring(colonIndex + 1) + } else { + text + } + } + private val mWatcher: TextWatcher = object : TextWatcher { override fun beforeTextChanged(