diff --git a/res/layout/search_panel.xml b/res/layout/search_panel.xml index 1242c73581c..c892ff98baf 100644 --- a/res/layout/search_panel.xml +++ b/res/layout/search_panel.xml @@ -33,17 +33,6 @@ android:layout_gravity="center" android:orientation="vertical"> - - - - + + + diff --git a/res/layout/search_panel_suggestions_header.xml b/res/layout/search_panel_suggestions_header.xml new file mode 100644 index 00000000000..21500bc7e33 --- /dev/null +++ b/res/layout/search_panel_suggestions_header.xml @@ -0,0 +1,27 @@ + + + + diff --git a/src/com/android/settings/dashboard/SearchResultsSummary.java b/src/com/android/settings/dashboard/SearchResultsSummary.java index c31a8933137..69816347542 100644 --- a/src/com/android/settings/dashboard/SearchResultsSummary.java +++ b/src/com/android/settings/dashboard/SearchResultsSummary.java @@ -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; }