Restoring search query after orientation change in two pane mode
This commit is contained in:
parent
eb66cc5db8
commit
b2d935dd6d
|
@ -244,6 +244,9 @@ public class VideoItemListActivity extends AppCompatActivity
|
||||||
// the support version on SearchView, so it needs to be set programmatically.
|
// the support version on SearchView, so it needs to be set programmatically.
|
||||||
searchView.setIconifiedByDefault(false);
|
searchView.setIconifiedByDefault(false);
|
||||||
searchView.setIconified(false);
|
searchView.setIconified(false);
|
||||||
|
if(!searchQuery.isEmpty()) {
|
||||||
|
searchView.setQuery(searchQuery,false);
|
||||||
|
}
|
||||||
searchView.setOnQueryTextListener(new SearchVideoQueryListener());
|
searchView.setOnQueryTextListener(new SearchVideoQueryListener());
|
||||||
suggestionListAdapter = new SuggestionListAdapter(this);
|
suggestionListAdapter = new SuggestionListAdapter(this);
|
||||||
searchView.setSuggestionsAdapter(suggestionListAdapter);
|
searchView.setSuggestionsAdapter(suggestionListAdapter);
|
||||||
|
@ -313,7 +316,7 @@ public class VideoItemListActivity extends AppCompatActivity
|
||||||
findViewById(R.id.videoitem_detail_container) == null) {
|
findViewById(R.id.videoitem_detail_container) == null) {
|
||||||
inflater.inflate(R.menu.videoitem_list, menu);
|
inflater.inflate(R.menu.videoitem_list, menu);
|
||||||
MenuItem searchItem = menu.findItem(R.id.action_search);
|
MenuItem searchItem = menu.findItem(R.id.action_search);
|
||||||
final SearchView searchView = (SearchView) searchItem.getActionView();
|
SearchView searchView = (SearchView) searchItem.getActionView();
|
||||||
searchView.setFocusable(false);
|
searchView.setFocusable(false);
|
||||||
searchView.setOnQueryTextListener(
|
searchView.setOnQueryTextListener(
|
||||||
new SearchVideoQueryListener());
|
new SearchVideoQueryListener());
|
||||||
|
|
Loading…
Reference in New Issue