Greatly improved suggestion result speed
Bug: 3201805
This change does 2 key things. The first is it supports recycling
views. The second is local suggestions (bookmarks and history) no
longer wait for remote suggestions (search suggestions)
Change-Id: Ic659ce486a5b674490248b8c1ffb9a8c24afe609
diff --git a/src/com/android/browser/UrlInputView.java b/src/com/android/browser/UrlInputView.java
index e7fc233..2e29f26 100644
--- a/src/com/android/browser/UrlInputView.java
+++ b/src/com/android/browser/UrlInputView.java
@@ -18,7 +18,6 @@
import com.android.browser.SuggestionsAdapter.CompletionListener;
-import android.content.ContentResolver;
import android.content.Context;
import android.content.res.Configuration;
import android.util.AttributeSet;
@@ -68,6 +67,7 @@
setAdapter(mAdapter);
setSelectAllOnFocus(false);
onConfigurationChanged(ctx.getResources().getConfiguration());
+ setThreshold(1);
}
void setContainer(View container) {
@@ -76,29 +76,35 @@
@Override
protected void onConfigurationChanged(Configuration config) {
+ super.onConfigurationChanged(config);
mLandscape = (config.orientation &
Configuration.ORIENTATION_LANDSCAPE) > 0;
+ mAdapter.setLandscapeMode(mLandscape);
if (isPopupShowing() && (getVisibility() == View.VISIBLE)) {
- dismissDropDown();
- getFilter().filter(getText());
+ setupDropDown();
}
}
@Override
public void showDropDown() {
+ setupDropDown();
+ super.showDropDown();
+ }
+
+ @Override
+ public void dismissDropDown() {
+ super.dismissDropDown();
+ mAdapter.clearCache();
+ }
+
+ private void setupDropDown() {
int width = mContainer.getWidth();
- if (mLandscape && ((mAdapter.getLeftCount() == 0) ||
- (mAdapter.getRightCount() == 0))) {
- width = width / 2;
- }
if (width != getDropDownWidth()) {
setDropDownWidth(width);
}
if (getLeft() != -getDropDownHorizontalOffset()) {
setDropDownHorizontalOffset(-getLeft());
}
- mAdapter.setLandscapeMode(mLandscape);
- super.showDropDown();
}
@Override