Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/preferences/autofill/AutofillProfileBridge.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/autofill/AutofillProfileBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/autofill/AutofillProfileBridge.java |
| index 7f0f63db0c8742eaadca5814a47eae45fbf82941..cc76e20c3887ab1e5a55fe07c1052cde2e3845ea 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/autofill/AutofillProfileBridge.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/autofill/AutofillProfileBridge.java |
| @@ -97,10 +97,31 @@ public class AutofillProfileBridge { |
| return result; |
| } |
| }); |
| - |
| return countries; |
| } |
| + /** @return The list of admin areas sorted by their localized display names. */ |
| + public static List<DropdownKeyValue> getAdminAreaDropdownList(String[] keys) { |
| + List<DropdownKeyValue> adminAreas = new ArrayList<>(); |
| + |
| + for (int i = 0; i < keys.length; ++i) { |
| + // TODO (@crbug.com/691643): show names, save keys. |
|
gone
2017/04/05 00:14:21
// TODO(parastoog): Show names, save keys. crbug.
Parastoo
2017/04/05 19:49:07
I was initially told to do otherwise, would you pl
gone
2017/04/05 20:21:38
git grep "TODO(.*)"
Parastoo
2017/04/05 20:44:31
Thanks.
|
| + adminAreas.add(new DropdownKeyValue(keys[i], keys[i])); |
| + } |
| + |
| + final Collator collator = Collator.getInstance(Locale.getDefault()); |
| + collator.setStrength(Collator.PRIMARY); |
| + Collections.sort(adminAreas, new Comparator<DropdownKeyValue>() { |
| + @Override |
| + public int compare(DropdownKeyValue lhs, DropdownKeyValue rhs) { |
| + // Sorted according to the admin area values, such as Quebec, |
| + // rather than the admin area keys, such as QC. |
| + return collator.compare(lhs.getValue(), rhs.getValue()); |
| + } |
| + }); |
| + return adminAreas; |
| + } |
| + |
| /** @return The list of required fields. COUNTRY is always included. RECIPIENT often omitted. */ |
| public static List<Integer> getRequiredAddressFields(String countryCode) { |
| List<Integer> requiredFields = new ArrayList<>(); |