Index: chrome/android/java/src/org/chromium/chrome/browser/preferences/autofill/AutofillProfileEditor.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/autofill/AutofillProfileEditor.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/autofill/AutofillProfileEditor.java |
index e22b1f193c1428ef6b998c34f71afe9e126f6389..4859325e01eb97e7db2d578c6d0b5df97e66435d 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/autofill/AutofillProfileEditor.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/autofill/AutofillProfileEditor.java |
@@ -6,7 +6,6 @@ package org.chromium.chrome.browser.preferences.autofill; |
import android.os.Bundle; |
import android.text.TextUtils; |
-import android.util.Pair; |
import android.view.LayoutInflater; |
import android.view.View; |
import android.view.ViewGroup; |
@@ -20,7 +19,8 @@ import org.chromium.chrome.R; |
import org.chromium.chrome.browser.autofill.PersonalDataManager; |
import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; |
import org.chromium.chrome.browser.preferences.autofill.AutofillProfileBridge.AddressField; |
-import org.chromium.chrome.browser.preferences.autofill.AutofillProfileBridge.Country; |
+import org.chromium.chrome.browser.preferences.autofill.AutofillProfileBridge.AddressUiComponent; |
+import org.chromium.chrome.browser.preferences.autofill.AutofillProfileBridge.SpinnerKeyValue; |
import org.chromium.chrome.browser.widget.FloatLabelLayout; |
import java.util.ArrayList; |
@@ -113,15 +113,15 @@ public class AutofillProfileEditor extends AutofillEditorBase { |
} |
private void populateCountriesSpinner() { |
- List<Country> countries = AutofillProfileBridge.getSupportedCountries(); |
+ List<SpinnerKeyValue> countries = AutofillProfileBridge.getSupportedCountries(); |
mCountryCodes = new ArrayList<String>(); |
- for (Country country : countries) { |
- mCountryCodes.add(country.mCode); |
+ for (SpinnerKeyValue country : countries) { |
+ mCountryCodes.add(country.getKey()); |
} |
- ArrayAdapter<Country> countriesAdapter = new ArrayAdapter<Country>(getActivity(), |
- android.R.layout.simple_spinner_item, countries); |
+ ArrayAdapter<SpinnerKeyValue> countriesAdapter = new ArrayAdapter<SpinnerKeyValue>( |
+ getActivity(), android.R.layout.simple_spinner_item, countries); |
countriesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); |
mCountriesSpinner.setAdapter(countriesAdapter); |
} |
@@ -192,7 +192,7 @@ public class AutofillProfileEditor extends AutofillEditorBase { |
mWidgetRoot.removeAllViews(); |
// Get address fields for the selected country. |
- List<Pair<Integer, String>> fields = mAutofillProfileBridge.getAddressUiComponents( |
+ List<AddressUiComponent> fields = mAutofillProfileBridge.getAddressUiComponents( |
mCountryCodes.get(countryCodeIndex), |
mLanguageCodeString); |
if (!mUseSavedProfileLanguage) { |
@@ -201,23 +201,21 @@ public class AutofillProfileEditor extends AutofillEditorBase { |
// Create form fields and focus the first field if autoFocusFirstField is true. |
boolean firstField = true; |
- for (Pair<Integer, String> field : fields) { |
- int fieldId = field.first; |
- String fieldLabel = field.second; |
+ for (AddressUiComponent field : fields) { |
FloatLabelLayout fieldFloatLabel = (FloatLabelLayout) mInflater.inflate( |
R.layout.preference_address_float_label_layout, mWidgetRoot, false); |
- fieldFloatLabel.setHint(fieldLabel); |
+ fieldFloatLabel.setHint(field.label); |
EditText fieldEditText = |
(EditText) fieldFloatLabel.findViewById(R.id.address_edit_text); |
- fieldEditText.setHint(fieldLabel); |
- fieldEditText.setContentDescription(fieldLabel); |
+ fieldEditText.setHint(field.label); |
+ fieldEditText.setContentDescription(field.label); |
fieldEditText.addTextChangedListener(this); |
- if (fieldId == AddressField.STREET_ADDRESS) { |
+ if (field.id == AddressField.STREET_ADDRESS) { |
fieldEditText.setSingleLine(false); |
} |
- mAddressFields[fieldId] = fieldFloatLabel; |
+ mAddressFields[field.id] = fieldFloatLabel; |
mWidgetRoot.addView(fieldFloatLabel); |
if (firstField && autoFocusFirstField) { |