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

Unified Diff: ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java

Issue 1134793004: Autofill item deletion on android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clean up Created 5 years, 7 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: ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java
diff --git a/ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java b/ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java
index f41c3f464f3aa46ab6cad8df33584d17936838af..45764d871a79c2d2d5bd35444ec9b6c14ed55627 100644
--- a/ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java
+++ b/ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java
@@ -25,7 +25,7 @@ import java.util.List;
* The Autofill suggestion popup that lists relevant suggestions.
*/
public class AutofillPopup extends DropdownPopupWindow implements AdapterView.OnItemClickListener,
- PopupWindow.OnDismissListener {
+ AdapterView.OnItemLongClickListener, PopupWindow.OnDismissListener {
/**
* The constant used to specify a separator in a list of Autofill suggestions.
@@ -52,6 +52,8 @@ public class AutofillPopup extends DropdownPopupWindow implements AdapterView.On
* @param listIndex The index of the selected Autofill suggestion.
*/
public void suggestionSelected(int listIndex);
+
+ public void deleteSuggestion(int listIndex);
Ted C 2015/05/14 21:56:40 javadoc
Evan Stade 2015/05/14 23:12:05 Done.
}
/**
@@ -95,6 +97,7 @@ public class AutofillPopup extends DropdownPopupWindow implements AdapterView.On
setAdapter(new DropdownAdapter(mContext, cleanedData, separators));
setRtl(isRtl);
show();
+ getListView().setOnItemLongClickListener(this);
}
@Override
@@ -106,6 +109,19 @@ public class AutofillPopup extends DropdownPopupWindow implements AdapterView.On
}
@Override
+ public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
+//Log.e("estade", "long click found");
Ted C 2015/05/14 21:56:40 :-)
Evan Stade 2015/05/14 23:12:05 ah, good thing I didn't write a more embarrassing
+ DropdownAdapter adapter = (DropdownAdapter) parent.getAdapter();
+ AutofillSuggestion suggestion = (AutofillSuggestion) adapter.getItem(position);
+ if (!suggestion.isDeletable()) return false;
+
+ int listIndex = mSuggestions.indexOf(suggestion);
+ assert listIndex > -1;
+ mAutofillCallback.deleteSuggestion(listIndex);
+ return true;
+ }
+
+ @Override
public void onDismiss() {
mAutofillCallback.dismissed();
}

Powered by Google App Engine
This is Rietveld 408576698