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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/preferences/autofill/AutofillProfileEditor.java

Issue 882123003: Use/save language code for autofill profiles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove poor use of statics Created 5 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/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 1e3e931647ff43c1e2be3723aa03524a405bde00..aeda56e5904eb52dc820d193d8cd13d8e3a270da 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
@@ -51,6 +51,8 @@ public class AutofillProfileEditor extends Fragment implements TextWatcher,
private Spinner mCountriesSpinner;
private ViewGroup mWidgetRoot;
private FloatLabelLayout[] mAddressFields;
+ private AutofillProfileBridge mAutofillProfileBridge;
+ private boolean mUseSavedProfileLanguage;
@Override
public void onCreate(Bundle savedState) {
@@ -86,6 +88,8 @@ public class AutofillProfileEditor extends Fragment implements TextWatcher,
mWidgetRoot = (ViewGroup) v.findViewById(R.id.autofill_profile_widget_root);
mCountriesSpinner = (Spinner) v.findViewById(R.id.countries);
+ mAutofillProfileBridge = new AutofillProfileBridge();
+
populateCountriesSpinner();
createAndPopulateEditFields();
hookupSaveCancelDeleteButtons(v);
@@ -123,6 +127,7 @@ public class AutofillProfileEditor extends Fragment implements TextWatcher,
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (position != mCurrentCountryPos) {
mCurrentCountryPos = position;
+ mUseSavedProfileLanguage = false;
// If all fields are empty (e.g. the user just entered the form and the first thing
// they did was select a country), focus on the first form element. Otherwise, don't.
resetFormFields(position, allFieldsEmpty());
@@ -161,6 +166,7 @@ public class AutofillProfileEditor extends Fragment implements TextWatcher,
}
mLanguageCodeString = profile.getLanguageCode();
+ mUseSavedProfileLanguage = true;
mCurrentCountryPos = mCountryCodes.indexOf(profile.getCountryCode());
if (mCurrentCountryPos == -1) {
@@ -213,8 +219,12 @@ public class AutofillProfileEditor extends Fragment implements TextWatcher,
mWidgetRoot.removeAllViews();
// Get address fields for the selected country.
- List<Pair<Integer, String>> fields = AutofillProfileBridge.getAddressUiComponents(
- mCountryCodes.get(countryCodeIndex));
+ List<Pair<Integer, String>> fields = mAutofillProfileBridge.getAddressUiComponents(
+ mCountryCodes.get(countryCodeIndex),
+ mLanguageCodeString);
+ if (!mUseSavedProfileLanguage) {
+ mLanguageCodeString = mAutofillProfileBridge.getCurrentBestLanguageCode();
+ }
// Create form fields and focus the first field if autoFocusFirstField is true.
boolean firstField = true;

Powered by Google App Engine
This is Rietveld 408576698