| 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 57871a3a8d371be585790d9dd67ca66f63787fb5..8a1628adce103d4cd2ac00fc1ea2a587ebe1744e 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
|
| @@ -56,8 +56,22 @@ class EditorDropdownField implements EditorFieldView {
|
| final List<DropdownKeyValue> dropdownKeyValues = mFieldModel.getDropdownKeyValues();
|
| mSelectedIndex = getDropdownIndex(dropdownKeyValues, mFieldModel.getValue());
|
|
|
| - ArrayAdapter<DropdownKeyValue> adapter = new ArrayAdapter<DropdownKeyValue>(
|
| - context, R.layout.multiline_spinner_item, dropdownKeyValues);
|
| + ArrayAdapter<DropdownKeyValue> adapter;
|
| + if (mFieldModel.getHint() != null) {
|
| + // Add the hint as the last value.
|
| + dropdownKeyValues.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, dropdownKeyValues);
|
| +
|
| + // 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.
|
| + if (mFieldModel.getValue() == null) mSelectedIndex = adapter.getCount();
|
| + } else {
|
| + adapter = new ArrayAdapter<DropdownKeyValue>(
|
| + context, R.layout.multiline_spinner_item, dropdownKeyValues);
|
| + }
|
| adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
|
|
| mDropdown = (Spinner) mLayout.findViewById(R.id.spinner);
|
|
|