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

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

Issue 2479613002: [Payments] Style the add address option in billing address selection. (Closed)
Patch Set: Addressed Dan's comments Created 4 years, 1 month 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 e99cb942c825f63b07ebf7558d382fe6f78b5c90..fcbed1fb0d60afa8447c07ea37e6e55234370963 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,7 +19,6 @@ 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;
/**
@@ -59,19 +58,14 @@ class EditorDropdownField implements EditorFieldView {
ArrayAdapter<DropdownKeyValue> adapter;
if (mFieldModel.getHint() != null) {
- // Make a copy of the list, so the hint is not added permanently.
- final List<DropdownKeyValue> tempDropdownKeyValues =
- new ArrayList<DropdownKeyValue>(dropdownKeyValues);
-
- // Add the hint as the last value.
- tempDropdownKeyValues.add(new DropdownKeyValue("", mFieldModel.getHint().toString()));
-
- // Use the HintArrayAdapter so the hint is not displayed as an option.
- adapter = new HintArrayAdapter<DropdownKeyValue>(
- context, R.layout.multiline_spinner_item, tempDropdownKeyValues);
-
- // If no value is selected, select the hint entry. Using getCount will not result in an
- // out of bounds index because the hint value is ommited in the count.
+ // Use the BillingAddressAdapter and pass it a hint to be displayed as default.
+ adapter = new BillingAddressAdapter<DropdownKeyValue>(
+ context, R.layout.multiline_spinner_item, dropdownKeyValues,
+ new DropdownKeyValue("", mFieldModel.getHint().toString()));
+
+ // If no value is selected, select the hint entry which is the last item in the adapter.
+ // Using getCount will not result in an out of bounds index because the hint value is
+ // ommited in the count.
if (mFieldModel.getValue() == null) mSelectedIndex = adapter.getCount();
} else {
adapter = new ArrayAdapter<DropdownKeyValue>(

Powered by Google App Engine
This is Rietveld 408576698