From 332355902a454cb9d3d0616455eaaa540d005360 Mon Sep 17 00:00:00 2001 From: Devin Morgan Date: Tue, 18 Jun 2024 09:40:31 -0400 Subject: [PATCH] Modify sample app to show all three vault elements This is the easiest way to confirm that the styling changes work. The plan is to make another branch on top of this that uses these same modifications to show what it would have looked like before the fix gets applied --- .../ecom/ui/element/ForagePINEditText.kt | 9 +- .../example/ui/catalog/CatalogFragment.kt | 12 --- .../src/main/res/layout/fragment_catalog.xml | 95 ++----------------- 3 files changed, 15 insertions(+), 101 deletions(-) diff --git a/forage-android/src/main/java/com/joinforage/forage/android/ecom/ui/element/ForagePINEditText.kt b/forage-android/src/main/java/com/joinforage/forage/android/ecom/ui/element/ForagePINEditText.kt index 6d9a6d1fa..b02f46a12 100644 --- a/forage-android/src/main/java/com/joinforage/forage/android/ecom/ui/element/ForagePINEditText.kt +++ b/forage-android/src/main/java/com/joinforage/forage/android/ecom/ui/element/ForagePINEditText.kt @@ -19,6 +19,7 @@ import com.joinforage.forage.android.core.ui.element.ForagePinElement import com.joinforage.forage.android.core.ui.getLogoImageViewLayout import com.joinforage.forage.android.ecom.ui.vault.bt.BTVaultWrapper import com.joinforage.forage.android.ecom.ui.vault.forage.RosettaPinElement +import com.joinforage.forage.android.ecom.ui.vault.vgs.VGSVaultWrapper import com.launchdarkly.sdk.android.LDConfig /** @@ -62,6 +63,7 @@ class ForagePINEditText @JvmOverloads constructor( ) : ForagePinElement(context, attrs, defStyleAttr), DynamicEnvElement { private val btVaultWrapper: BTVaultWrapper private val rosettaPinElement: RosettaPinElement + private val vgsVaultWrapper: VGSVaultWrapper /** * The `vault` property acts as an abstraction for the actual code @@ -102,11 +104,16 @@ class ForagePINEditText @JvmOverloads constructor( // Then, within setForageConfig, once we know the environment // and are thus able to initial LaunchDarkly and find out // whether to use BT or Forage. So, below we are hedging. + vgsVaultWrapper = VGSVaultWrapper(context, attrs, defStyleAttr) btVaultWrapper = BTVaultWrapper(context, attrs, defStyleAttr) rosettaPinElement = RosettaPinElement(context, attrs, defStyleAttr) // ensure all wrappers init with the // same typeface (or the attributes) btVaultWrapper.typeface = rosettaPinElement.typeface + + _linearLayout.addView(rosettaPinElement.getTextElement()) + _linearLayout.addView(btVaultWrapper.getTextElement()) + _linearLayout.addView(vgsVaultWrapper.getTextElement()) } finally { recycle() } @@ -126,7 +133,7 @@ class ForagePINEditText @JvmOverloads constructor( // it to the parent view _SET_ONLY_vault = determineBackingVault(forageConfig, logger) - _linearLayout.addView(vault.getTextElement()) +// _linearLayout.addView(vault.getTextElement()) _linearLayout.addView(getLogoImageViewLayout(context)) addView(_linearLayout) diff --git a/sample-app/src/main/java/com/joinforage/android/example/ui/catalog/CatalogFragment.kt b/sample-app/src/main/java/com/joinforage/android/example/ui/catalog/CatalogFragment.kt index e264adc6c..a5f2371bd 100644 --- a/sample-app/src/main/java/com/joinforage/android/example/ui/catalog/CatalogFragment.kt +++ b/sample-app/src/main/java/com/joinforage/android/example/ui/catalog/CatalogFragment.kt @@ -32,25 +32,13 @@ class CatalogFragment : Fragment() { merchantId = "0123456" ) - binding.firstForageEditText.setForageConfig(forageConfig) - binding.secondEditText.setForageConfig(forageConfig) - binding.thirdEditText.setForageConfig(forageConfig) - binding.fourthEditText.setForageConfig(forageConfig) binding.foragePinEditText.setForageConfig(forageConfig) - binding.secondForagePINEditText.setForageConfig(forageConfig) - binding.thirdForagePINEditText.setForageConfig(forageConfig) // NOTE: we call setForageConfig a second time here so that // the CI tests always confirm that running setForageConfig // more than once is OK and does not cause a crash. So, // these duplicate calls are intentional here - binding.firstForageEditText.setForageConfig(forageConfig) - binding.secondEditText.setForageConfig(forageConfig) - binding.thirdEditText.setForageConfig(forageConfig) - binding.fourthEditText.setForageConfig(forageConfig) binding.foragePinEditText.setForageConfig(forageConfig) - binding.secondForagePINEditText.setForageConfig(forageConfig) - binding.thirdForagePINEditText.setForageConfig(forageConfig) return root } diff --git a/sample-app/src/main/res/layout/fragment_catalog.xml b/sample-app/src/main/res/layout/fragment_catalog.xml index 227f54281..13ca6bb9f 100644 --- a/sample-app/src/main/res/layout/fragment_catalog.xml +++ b/sample-app/src/main/res/layout/fragment_catalog.xml @@ -7,96 +7,15 @@ android:layout_marginBottom="100dp" tools:context=".ui.catalog.CatalogFragment"> - - - - - - - - - - - - - - - - - - - - - + android:id="@+id/foragePinEditText" + style="@style/ForagePINEditTextStyle" + android:layout_width="match_parent" + android:layout_height="wrap_content" + /> \ No newline at end of file