From 2032ef90c9b1dcc2176d0bb215e332067469adca Mon Sep 17 00:00:00 2001 From: Devin Morgan Date: Fri, 1 Dec 2023 15:14:21 -0500 Subject: [PATCH] Update sample app to show usState of PAN The change of adding `details` to `ElementState` by making `ElementState` generic appears to be non-breaking becasue the compiler did not complain before making this commit (i.e. before modify the sample app). --- .../flow/tokenize/FlowTokenizeFragment.kt | 3 +++ .../main/res/layout/fragment_flow_tokenize.xml | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/sample-app/src/main/java/com/joinforage/android/example/ui/complete/flow/tokenize/FlowTokenizeFragment.kt b/sample-app/src/main/java/com/joinforage/android/example/ui/complete/flow/tokenize/FlowTokenizeFragment.kt index c5925074..32530ad1 100644 --- a/sample-app/src/main/java/com/joinforage/android/example/ui/complete/flow/tokenize/FlowTokenizeFragment.kt +++ b/sample-app/src/main/java/com/joinforage/android/example/ui/complete/flow/tokenize/FlowTokenizeFragment.kt @@ -60,6 +60,7 @@ class FlowTokenizeFragment : Fragment() { val isComplete: TextView = binding.isComplete val isEmpty: TextView = binding.isEmpty val isValid: TextView = binding.isValid + val usState: TextView = binding.usState fun setState() { val state = foragePanEditText.getElementState() @@ -67,6 +68,7 @@ class FlowTokenizeFragment : Fragment() { isComplete.text = "isComplete: ${state.isComplete}" isEmpty.text = "isEmpty: ${state.isEmpty}" isValid.text = "isValid: ${state.isValid}" + usState.text = "usState: ${state.details.derivedCardInfo?.usState?.abbreviation}" } foragePanEditText.setOnFocusEventListener { setState() } @@ -77,6 +79,7 @@ class FlowTokenizeFragment : Fragment() { isComplete.text = "isComplete: ${state.isComplete}" isEmpty.text = "isEmpty: ${state.isEmpty}" isValid.text = "isValid: ${state.isValid}" + usState.text ="usState: ${state.details.derivedCardInfo?.usState?.abbreviation}" viewModel.paymentMethod.observe(viewLifecycleOwner) { when (it == null) { diff --git a/sample-app/src/main/res/layout/fragment_flow_tokenize.xml b/sample-app/src/main/res/layout/fragment_flow_tokenize.xml index 1dc779a4..32768291 100644 --- a/sample-app/src/main/res/layout/fragment_flow_tokenize.xml +++ b/sample-app/src/main/res/layout/fragment_flow_tokenize.xml @@ -132,6 +132,21 @@ app:layout_constraintVertical_bias="0.0" tools:text="isValid: false" /> + +