Skip to content

Commit

Permalink
Default CardMultilineWidget to global postal code configuration (#2279)
Browse files Browse the repository at this point in the history
Summary
To require a US zip code via code:
```
cardMultilineWidget.usZipCodeRequired = true
```

To require a US zip code via XML layout:
```
<com.stripe.android.view.CardMultilineWidget
    android:id="@+id/card_multiline_widget"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:shouldRequireUsZipCode="true"/>
```

Motivation
Fixes #2129
  • Loading branch information
mshafrir-stripe authored Mar 10, 2020
1 parent cbfc611 commit ace6ab1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ class CardMultilineWidget @JvmOverloads constructor(

override fun onFinishInflate() {
super.onFinishInflate()
postalCodeEditText.config = PostalCodeEditText.Config.US
postalCodeEditText.config = PostalCodeEditText.Config.Global
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ internal class CardMultilineWidgetTest {
@Test
fun onFinishInflate_shouldSetPostalCodeInputLayoutHint() {
assertThat(cardMultilineWidget.postalInputLayout.hint)
.isEqualTo("ZIP code")
.isEqualTo("Postal code")
}

@Test
Expand Down

0 comments on commit ace6ab1

Please sign in to comment.