diff options
author | John Reck <jreck@google.com> | 2011-01-10 18:11:18 -0800 |
---|---|---|
committer | John Reck <jreck@google.com> | 2011-01-10 18:12:46 -0800 |
commit | 1605bef4e1f99805a801308f97ade622b907dc7a (patch) | |
tree | 5af09ae6533c76b107272fa024b58508e0eddd54 /src/com/android/browser | |
parent | 860662adbb4d12a89f34efd32b42e594cf612228 (diff) | |
download | packages_apps_Browser-1605bef4e1f99805a801308f97ade622b907dc7a.zip packages_apps_Browser-1605bef4e1f99805a801308f97ade622b907dc7a.tar.gz packages_apps_Browser-1605bef4e1f99805a801308f97ade622b907dc7a.tar.bz2 |
Reverse suggestions for quick controls
Reverses the URL suggestions when in quick controls mode
Change-Id: Icd010f4b5803a8633f5b41fb393a91ff0c2206cb
Diffstat (limited to 'src/com/android/browser')
-rw-r--r-- | src/com/android/browser/SuggestionsAdapter.java | 10 | ||||
-rw-r--r-- | src/com/android/browser/TitleBarXLarge.java | 5 | ||||
-rw-r--r-- | src/com/android/browser/UrlInputView.java | 5 |
3 files changed, 16 insertions, 4 deletions
diff --git a/src/com/android/browser/SuggestionsAdapter.java b/src/com/android/browser/SuggestionsAdapter.java index 7ee5c2a..e2d9386 100644 --- a/src/com/android/browser/SuggestionsAdapter.java +++ b/src/com/android/browser/SuggestionsAdapter.java @@ -67,6 +67,7 @@ public class SuggestionsAdapter extends BaseAdapter implements Filterable, OnCli int mLinesLandscape; Object mResultsLock = new Object(); List<String> mVoiceResults; + boolean mReverseResults; interface CompletionListener { @@ -133,6 +134,9 @@ public class SuggestionsAdapter extends BaseAdapter implements Filterable, OnCli @Override public SuggestItem getItem(int position) { + if (mReverseResults) { + position = (getCount() - 1) - position; + } if (mVoiceResults != null) { return new SuggestItem(mVoiceResults.get(position), null, TYPE_SEARCH); @@ -143,9 +147,13 @@ public class SuggestionsAdapter extends BaseAdapter implements Filterable, OnCli return mMixedResults.items.get(position); } + public void setReverseResults(boolean reverse) { + mReverseResults = reverse; + } + @Override public long getItemId(int position) { - return 0; + return position; } @Override diff --git a/src/com/android/browser/TitleBarXLarge.java b/src/com/android/browser/TitleBarXLarge.java index b479139..57cc724 100644 --- a/src/com/android/browser/TitleBarXLarge.java +++ b/src/com/android/browser/TitleBarXLarge.java @@ -87,11 +87,11 @@ public class TitleBarXLarge extends TitleBarBase R.drawable.textfield_active_holo_dark); mUnfocusDrawable = resources.getDrawable( R.drawable.textfield_default_holo_dark); - rebuildLayout(activity, true); + initLayout(activity); mInVoiceMode = false; } - private void rebuildLayout(Context context, boolean rebuildData) { + private void initLayout(Context context) { LayoutInflater factory = LayoutInflater.from(context); factory.inflate(R.layout.url_bar, this); @@ -143,6 +143,7 @@ public class TitleBarXLarge extends TitleBarBase void setUseQuickControls(boolean useQuickControls) { mUseQuickControls = useQuickControls; + mUrlInput.setReverseResults(mUseQuickControls); if (mUseQuickControls) { mBackButton.setVisibility(View.GONE); mForwardButton.setVisibility(View.GONE); diff --git a/src/com/android/browser/UrlInputView.java b/src/com/android/browser/UrlInputView.java index 8aeef31..428a0f2 100644 --- a/src/com/android/browser/UrlInputView.java +++ b/src/com/android/browser/UrlInputView.java @@ -29,7 +29,6 @@ import android.view.View.OnFocusChangeListener; import android.view.inputmethod.InputMethodManager; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; -import android.widget.AdapterView.OnItemSelectedListener; import android.widget.AutoCompleteTextView; import android.widget.TextView; import android.widget.TextView.OnEditorActionListener; @@ -218,4 +217,8 @@ public class UrlInputView extends AutoCompleteTextView item.extra); } + public void setReverseResults(boolean reverse) { + mAdapter.setReverseResults(reverse); + } + } |