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

Unified Diff: chrome/android/shell/java/src/org/chromium/chrome/shell/omnibox/SuggestionArrayAdapter.java

Issue 557263002: Adding option to move suggestion popup item text to omnibox. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Modified code as per review comments. Created 6 years, 3 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
« no previous file with comments | « no previous file | chrome/android/shell/java/src/org/chromium/chrome/shell/omnibox/SuggestionPopup.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/shell/java/src/org/chromium/chrome/shell/omnibox/SuggestionArrayAdapter.java
diff --git a/chrome/android/shell/java/src/org/chromium/chrome/shell/omnibox/SuggestionArrayAdapter.java b/chrome/android/shell/java/src/org/chromium/chrome/shell/omnibox/SuggestionArrayAdapter.java
index fbd147f1e36fdbe0484a17ed3566067aca901dd1..30abb4e06ded38581f3bc81e5ac9acf64d60d839 100644
--- a/chrome/android/shell/java/src/org/chromium/chrome/shell/omnibox/SuggestionArrayAdapter.java
+++ b/chrome/android/shell/java/src/org/chromium/chrome/shell/omnibox/SuggestionArrayAdapter.java
@@ -10,6 +10,8 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView.LayoutParams;
import android.widget.ArrayAdapter;
+import android.widget.EditText;
+import android.widget.ImageView;
import android.widget.TextView;
import org.chromium.chrome.browser.omnibox.OmniboxSuggestion;
@@ -22,10 +24,13 @@ import java.util.List;
*/
class SuggestionArrayAdapter extends ArrayAdapter<OmniboxSuggestion> {
private final List<OmniboxSuggestion> mSuggestions;
+ private EditText mUrlTextView;
- public SuggestionArrayAdapter(Context context, int res, List<OmniboxSuggestion> suggestions) {
+ public SuggestionArrayAdapter(Context context, int res, List<OmniboxSuggestion> suggestions,
+ EditText urlTextView) {
super(context, res, suggestions);
mSuggestions = suggestions;
+ mUrlTextView = urlTextView;
}
@Override
@@ -34,16 +39,26 @@ class SuggestionArrayAdapter extends ArrayAdapter<OmniboxSuggestion> {
if (v == null) {
LayoutInflater vi = (LayoutInflater) getContext().getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
- v = vi.inflate(R.layout.dropdown_item, null);
+ v = vi.inflate(R.layout.suggestion_item, null);
int height = getContext().getResources().getDimensionPixelSize(
R.dimen.dropdown_item_height);
v.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, height));
}
- TextView t1 = (TextView) v.findViewById(R.id.dropdown_label);
- t1.setText(mSuggestions.get(position).getDisplayText());
+ TextView t1 = (TextView) v.findViewById(R.id.suggestion_item_label);
+ final String suggestionText = mSuggestions.get(position).getDisplayText();
+ t1.setText(suggestionText);
- TextView t2 = (TextView) v.findViewById(R.id.dropdown_sublabel);
+ TextView t2 = (TextView) v.findViewById(R.id.suggestion_item_sublabel);
t2.setText(mSuggestions.get(position).getUrl());
+
+ ImageView arrow = (ImageView) v.findViewById(R.id.suggestion_item_arrow);
+ arrow.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ mUrlTextView.setText(suggestionText);
+ mUrlTextView.setSelection(suggestionText.length());
+ }
+ });
return v;
}
}
« no previous file with comments | « no previous file | chrome/android/shell/java/src/org/chromium/chrome/shell/omnibox/SuggestionPopup.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698