-
Notifications
You must be signed in to change notification settings - Fork 662
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor CountryAutoCompleteTextView logic (#1828)
- Create `Country` model to use in `CountryAutoCompleteTextView` and `CountryAdapter` to simplify logic - Make `CountryAutoCompleteTextView.selectedCountry` non-null - Avoid redundant `setText()` calls in `CountryAutoCompleteTextView` after a user selects a dropdown item - Make `CountryAutoCompleteTextView.CountryChangeListener` a function type `(Country) -> Unit`
- Loading branch information
1 parent
3508d1d
commit 3380d20
Showing
9 changed files
with
126 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.stripe.android.view | ||
|
||
internal data class Country( | ||
val code: String, | ||
val name: String | ||
) { | ||
|
||
/** | ||
* @return display value for [CountryAutoCompleteTextView] text view | ||
*/ | ||
override fun toString(): String = name | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.