Index: trunk/src/ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java |
=================================================================== |
--- trunk/src/ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java (revision 234202) |
+++ trunk/src/ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java (working copy) |
@@ -16,9 +16,6 @@ |
import android.widget.TextView; |
import java.util.ArrayList; |
-import java.util.Arrays; |
-import java.util.HashSet; |
-import java.util.List; |
import org.chromium.ui.R; |
import org.chromium.ui.ViewAndroidDelegate; |
@@ -32,12 +29,11 @@ |
* Constants defining types of Autofill suggestion entries. |
* Has to be kept in sync with enum in WebAutofillClient.h |
* |
- * Not supported: MenuItemIDWarningMessage, MenuItemIDClearForm, and |
+ * Not supported: MenuItemIDWarningMessage, MenuItemIDSeparator, MenuItemIDClearForm, and |
* MenuItemIDAutofillOptions. |
*/ |
private static final int ITEM_ID_AUTOCOMPLETE_ENTRY = 0; |
private static final int ITEM_ID_PASSWORD_ENTRY = -2; |
- private static final int ITEM_ID_SEPARATOR_ENTRY = -3; |
private static final int ITEM_ID_DATA_LIST_ENTRY = -6; |
private static final int TEXT_PADDING_DP = 30; |
@@ -53,7 +49,6 @@ |
private Paint mLabelViewPaint; |
private Paint mSublabelViewPaint; |
private OnLayoutChangeListener mLayoutChangeListener; |
- private List<AutofillSuggestion> mSuggestions; |
/** |
* An interface to handle the touch interaction with an AutofillPopup object. |
@@ -110,7 +105,6 @@ |
// An ugly hack to keep the popup from expanding on top of the keyboard. |
setInputMethodMode(INPUT_METHOD_NEEDED); |
super.show(); |
- getListView().setDividerHeight(0); |
} |
/** |
@@ -137,20 +131,16 @@ |
* @param suggestions Autofill suggestion data. |
*/ |
public void show(AutofillSuggestion[] suggestions) { |
- mSuggestions = new ArrayList<AutofillSuggestion>(Arrays.asList(suggestions)); |
// Remove the AutofillSuggestions with IDs that are not supported by Android |
ArrayList<AutofillSuggestion> cleanedData = new ArrayList<AutofillSuggestion>(); |
- HashSet<Integer> separators = new HashSet<Integer>(); |
for (int i = 0; i < suggestions.length; i++) { |
int itemId = suggestions[i].mUniqueId; |
if (itemId > 0 || itemId == ITEM_ID_AUTOCOMPLETE_ENTRY || |
itemId == ITEM_ID_PASSWORD_ENTRY || itemId == ITEM_ID_DATA_LIST_ENTRY) { |
cleanedData.add(suggestions[i]); |
- } else if (itemId == ITEM_ID_SEPARATOR_ENTRY) { |
- separators.add(cleanedData.size()); |
} |
} |
- setAdapter(new AutofillListAdapter(mContext, cleanedData, separators)); |
+ setAdapter(new AutofillListAdapter(mContext, cleanedData)); |
// Once the mAnchorRect is resized and placed correctly, it will show the Autofill popup. |
mAnchorWidth = Math.max(getDesiredWidth(cleanedData), mAnchorWidth); |
mViewAndroidDelegate.setAnchorViewPosition(mAnchorView, mAnchorX, mAnchorY, mAnchorWidth, |
@@ -218,10 +208,7 @@ |
@Override |
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
- AutofillListAdapter adapter = (AutofillListAdapter) parent.getAdapter(); |
- int listIndex = mSuggestions.indexOf(adapter.getItem(position)); |
- assert listIndex > -1; |
- mAutofillCallback.suggestionSelected(listIndex); |
+ mAutofillCallback.suggestionSelected(position); |
} |
} |