Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3152)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorDropdownField.java

Issue 2614193002: [Payments] List incomplete addresses in the billing address dropdown (Closed)
Patch Set: fix nits Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorDropdownField.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorDropdownField.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorDropdownField.java
index 52a78e5d87fb1753e12c189104fcfaff4716561f..4501767f8699b6432fb103da68fe2ca83b9adb04 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorDropdownField.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorDropdownField.java
@@ -19,6 +19,7 @@ import org.chromium.chrome.R;
import org.chromium.chrome.browser.preferences.autofill.AutofillProfileBridge.DropdownKeyValue;
import org.chromium.ui.UiUtils;
+import java.util.ArrayList;
import java.util.List;
/**
@@ -56,12 +57,13 @@ class EditorDropdownField implements EditorFieldView {
final List<DropdownKeyValue> dropdownKeyValues = mFieldModel.getDropdownKeyValues();
mSelectedIndex = getDropdownIndex(dropdownKeyValues, mFieldModel.getValue());
- ArrayAdapter<DropdownKeyValue> adapter;
+ final List<CharSequence> dropdownValues = getDropdownValues(dropdownKeyValues);
+ ArrayAdapter<CharSequence> adapter;
if (mFieldModel.getHint() != null) {
// Use the BillingAddressAdapter and pass it a hint to be displayed as default.
- adapter = new BillingAddressAdapter<DropdownKeyValue>(context,
- R.layout.multiline_spinner_item, R.id.spinner_item, dropdownKeyValues,
- new DropdownKeyValue("", mFieldModel.getHint().toString()));
+ adapter = new BillingAddressAdapter<CharSequence>(context,
+ R.layout.multiline_spinner_item, R.id.spinner_item, dropdownValues,
+ mFieldModel.getHint().toString());
// Wrap the TextView in the dropdown popup around with a FrameLayout to display the text
// in multiple lines.
// Note that the TextView in the dropdown popup is displayed in a DropDownListView for
@@ -74,8 +76,8 @@ class EditorDropdownField implements EditorFieldView {
// ommited in the count.
if (mFieldModel.getValue() == null) mSelectedIndex = adapter.getCount();
} else {
- adapter = new ArrayAdapter<DropdownKeyValue>(
- context, R.layout.multiline_spinner_item, dropdownKeyValues);
+ adapter = new ArrayAdapter<CharSequence>(
+ context, R.layout.multiline_spinner_item, dropdownValues);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
}
@@ -156,6 +158,14 @@ class EditorDropdownField implements EditorFieldView {
mDropdown.setSelection(mSelectedIndex);
}
+ private static List<CharSequence> getDropdownValues(List<DropdownKeyValue> dropdownKeyValues) {
+ List<CharSequence> dropdownValues = new ArrayList<CharSequence>();
+ for (int i = 0; i < dropdownKeyValues.size(); i++) {
+ dropdownValues.add(dropdownKeyValues.get(i).getValue());
+ }
+ return dropdownValues;
+ }
+
private static int getDropdownIndex(
List<DropdownKeyValue> dropdownKeyValues, CharSequence value) {
for (int i = 0; i < dropdownKeyValues.size(); i++) {

Powered by Google App Engine
This is Rietveld 408576698