summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser/SuggestionsAdapter.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/browser/SuggestionsAdapter.java')
-rw-r--r--src/com/android/browser/SuggestionsAdapter.java24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/com/android/browser/SuggestionsAdapter.java b/src/com/android/browser/SuggestionsAdapter.java
index 30e46fe..903768c 100644
--- a/src/com/android/browser/SuggestionsAdapter.java
+++ b/src/com/android/browser/SuggestionsAdapter.java
@@ -79,6 +79,8 @@ public class SuggestionsAdapter extends BaseAdapter implements Filterable, OnCli
public void onSelect(String txt);
+ public void onFilterComplete(int count);
+
}
public SuggestionsAdapter(Context ctx, CompletionListener listener) {
@@ -179,7 +181,7 @@ public class SuggestionsAdapter extends BaseAdapter implements Filterable, OnCli
if (item != null) {
bindView(iv, item);
} else {
- iv.setVisibility((mResults.getLeftCount() == 0) ? View.GONE :
+ iv.setVisibility((mResults.getLeftCount() == 0) ? View.GONE :
View.INVISIBLE);
}
item = getItem(position + mResults.getLineCount());
@@ -190,7 +192,7 @@ public class SuggestionsAdapter extends BaseAdapter implements Filterable, OnCli
if (item != null) {
bindView(iv, item);
} else {
- iv.setVisibility((mResults.getRightCount() == 0) ? View.GONE :
+ iv.setVisibility((mResults.getRightCount() == 0) ? View.GONE :
View.INVISIBLE);
}
return view;
@@ -244,7 +246,6 @@ public class SuggestionsAdapter extends BaseAdapter implements Filterable, OnCli
class SuggestFilter extends Filter {
- int count;
SuggestionResults results;
@Override
@@ -269,14 +270,13 @@ public class SuggestionsAdapter extends BaseAdapter implements Filterable, OnCli
return res;
}
results = new SuggestionResults();
- count = 0;
if (constraint != null) {
for (CursorSource sc : mSources) {
sc.runQuery(constraint);
}
mixResults();
}
- res.count = count;
+ res.count = results.getLineCount();
res.values = results;
return res;
}
@@ -284,9 +284,9 @@ public class SuggestionsAdapter extends BaseAdapter implements Filterable, OnCli
void mixResults() {
for (int i = 0; i < mSources.size(); i++) {
CursorSource s = mSources.get(i);
- int n = Math.min(s.getCount(), (mLandscapeMode ? mLinesLandscape
+ int n = Math.min(s.getCount(), (mLandscapeMode ? mLinesLandscape
: mLinesPortrait));
- boolean more = true;
+ boolean more = false;
for (int j = 0; j < n; j++) {
results.addResult(s.getItem());
more = s.moveToNext();
@@ -305,12 +305,12 @@ public class SuggestionsAdapter extends BaseAdapter implements Filterable, OnCli
}
}
}
-
}
@Override
protected void publishResults(CharSequence constraint, FilterResults fresults) {
mResults = (SuggestionResults) fresults.values;
+ mListener.onFilterComplete(fresults.count);
notifyDataSetChanged();
}
@@ -454,10 +454,10 @@ public class SuggestionsAdapter extends BaseAdapter implements Filterable, OnCli
selection = COMBINED_SELECTION;
}
Uri.Builder ub = BrowserContract.Combined.CONTENT_URI.buildUpon();
- ub.appendQueryParameter(BrowserContract.PARAM_LIMIT,
+ ub.appendQueryParameter(BrowserContract.PARAM_LIMIT,
Integer.toString(mLinesPortrait));
mCursor =
- mContext.getContentResolver().query(ub.build(), COMBINED_PROJECTION,
+ mContext.getContentResolver().query(ub.build(), COMBINED_PROJECTION,
selection,
(constraint != null) ? args : null,
BrowserContract.Combined.VISITS + " DESC, " +
@@ -538,10 +538,10 @@ public class SuggestionsAdapter extends BaseAdapter implements Filterable, OnCli
String[] args = new String[] {constraint.toString()};
String selection = BrowserContract.Searches.SEARCH + " LIKE ?";
Uri.Builder ub = BrowserContract.Searches.CONTENT_URI.buildUpon();
- ub.appendQueryParameter(BrowserContract.PARAM_LIMIT,
+ ub.appendQueryParameter(BrowserContract.PARAM_LIMIT,
Integer.toString(mLinesPortrait));
mCursor =
- mContext.getContentResolver().query(ub.build(), SEARCHES_PROJECTION,
+ mContext.getContentResolver().query(ub.build(), SEARCHES_PROJECTION,
selection,
args, BrowserContract.Searches.DATE + " DESC");
if (mCursor != null) {