Tune Recents Search and Search Results

- add the capability to scroll recents and results with their
header (old request from UX)

See bug: #12910134 Implement Search into the Settings App

Change-Id: If3c4a23b928b189803f2ef8e13a61746c2790b4b
This commit is contained in:
Fabrice Di Meglio
2014-06-09 17:07:04 -07:00
parent 60c26572d1
commit 04cde98538
4 changed files with 65 additions and 22 deletions

View File

@@ -166,6 +166,9 @@ public class SearchResultsSummary extends Fragment {
mResultsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// We have a header, so we need to decrement the position by one
position--;
final Cursor cursor = mResultsAdapter.mCursor;
cursor.moveToPosition(position);
@@ -202,12 +205,17 @@ public class SearchResultsSummary extends Fragment {
saveQueryToDatabase();
}
});
mResultsListView.addHeaderView(
LayoutInflater.from(getActivity()).inflate(
R.layout.search_panel_results_header, mResultsListView, false));
mSuggestionsListView = (ListView) view.findViewById(R.id.list_suggestions);
mSuggestionsListView.setAdapter(mSuggestionsAdapter);
mSuggestionsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// We have a header, so we need to decrement the position by one
position--;
final Cursor cursor = mSuggestionsAdapter.mCursor;
cursor.moveToPosition(position);
@@ -216,6 +224,9 @@ public class SearchResultsSummary extends Fragment {
mSearchView.setQuery(mQuery, false);
}
});
mSuggestionsListView.addHeaderView(
LayoutInflater.from(getActivity()).inflate(
R.layout.search_panel_suggestions_header, mSuggestionsListView, false));
return view;
}