From d3f2a4316567f247de2e3ece53deccc3a00fd4dd Mon Sep 17 00:00:00 2001 From: dabitdev Date: Wed, 23 Jan 2019 11:57:49 -0500 Subject: [PATCH 1/2] Testing federation address. --- .../activities/StellarAddressActivity.kt | 12 ++++++++++++ app/src/main/res/layout/activity_stellar_address.xml | 2 -- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/blockeq/stellarwallet/activities/StellarAddressActivity.kt b/app/src/main/java/com/blockeq/stellarwallet/activities/StellarAddressActivity.kt index b4f83b34..ab259f04 100644 --- a/app/src/main/java/com/blockeq/stellarwallet/activities/StellarAddressActivity.kt +++ b/app/src/main/java/com/blockeq/stellarwallet/activities/StellarAddressActivity.kt @@ -14,11 +14,14 @@ import com.blockeq.stellarwallet.BuildConfig import com.blockeq.stellarwallet.R import com.blockeq.stellarwallet.WalletApplication import com.blockeq.stellarwallet.helpers.Constants.Companion.STELLAR_ADDRESS_LENGTH +import com.blockeq.stellarwallet.helpers.OnTextChanged import com.blockeq.stellarwallet.interfaces.ContactsRepository.ContactOperationStatus import com.blockeq.stellarwallet.models.Contact import com.blockeq.stellarwallet.vmodels.ContactsRepositoryImpl import com.google.zxing.integration.android.IntentIntegrator import kotlinx.android.synthetic.main.activity_stellar_address.* +import org.jetbrains.anko.doAsync +import org.stellar.sdk.federation.Federation import timber.log.Timber class StellarAddressActivity : BaseActivity(), View.OnClickListener { @@ -110,6 +113,15 @@ class StellarAddressActivity : BaseActivity(), View.OnClickListener { ContactNameText.visibility = View.GONE ContactNameEditText.visibility = View.GONE addressTitleText.text = getString(R.string.send_to_text) + addressEditText.addTextChangedListener(object : OnTextChanged() { + override fun onTextChanged(text: CharSequence, start: Int, before: Int, count: Int) { + if (text.contains("*")) { + doAsync { + addressEditText.setText(Federation.resolve(text.toString()).accountId) + } + } + } + }) } Mode.UPDATE_CONTACT -> { titleBalance.visibility = View.GONE diff --git a/app/src/main/res/layout/activity_stellar_address.xml b/app/src/main/res/layout/activity_stellar_address.xml index 35452294..e8dac84f 100644 --- a/app/src/main/res/layout/activity_stellar_address.xml +++ b/app/src/main/res/layout/activity_stellar_address.xml @@ -92,8 +92,6 @@ android:background="@color/addressBackGroundColor" android:textSize="15sp" android:scrollHorizontally="true" - android:digits="@string/stellar_address_alphabet" - android:inputType="textCapCharacters" android:hint="@string/send_address_hint" android:singleLine="true" android:importantForAutofill="no" From d20f63ca3743e097831f8f33f3da9a68ecfd6f59 Mon Sep 17 00:00:00 2001 From: dabitdev Date: Thu, 7 Feb 2019 20:04:56 -0500 Subject: [PATCH 2/2] Fix lint issues. --- app/build.gradle | 1 - app/src/main/res/layout/activity_stellar_address.xml | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 9b5825ec..48a330b0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -31,7 +31,6 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } - testOptions { unitTests.returnDefaultValues = true } diff --git a/app/src/main/res/layout/activity_stellar_address.xml b/app/src/main/res/layout/activity_stellar_address.xml index e8dac84f..8084a83a 100644 --- a/app/src/main/res/layout/activity_stellar_address.xml +++ b/app/src/main/res/layout/activity_stellar_address.xml @@ -96,7 +96,8 @@ android:singleLine="true" android:importantForAutofill="no" tool:text="ALAJSLDJFALSKDFJ2L3K4JLSDKFJL34KJ5LKSZJGFLKSJL4" - tool:ignore="UnusedAttribute" /> + tool:ignore="UnusedAttribute" + android:inputType="text" />