From eb66cc5db85719d6e2f60a24f2016cf07f9d0516 Mon Sep 17 00:00:00 2001 From: madiyar Date: Mon, 7 Mar 2016 12:58:48 +0600 Subject: [PATCH 1/2] Restoring search query after orientation change --- .../java/org/schabi/newpipe/VideoItemListActivity.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/VideoItemListActivity.java b/app/src/main/java/org/schabi/newpipe/VideoItemListActivity.java index 0d879149d..86c292da5 100644 --- a/app/src/main/java/org/schabi/newpipe/VideoItemListActivity.java +++ b/app/src/main/java/org/schabi/newpipe/VideoItemListActivity.java @@ -313,14 +313,17 @@ public class VideoItemListActivity extends AppCompatActivity findViewById(R.id.videoitem_detail_container) == null) { inflater.inflate(R.menu.videoitem_list, menu); MenuItem searchItem = menu.findItem(R.id.action_search); - SearchView searchView = (SearchView) searchItem.getActionView(); + final SearchView searchView = (SearchView) searchItem.getActionView(); searchView.setFocusable(false); searchView.setOnQueryTextListener( new SearchVideoQueryListener()); suggestionListAdapter = new SuggestionListAdapter(this); searchView.setSuggestionsAdapter(suggestionListAdapter); searchView.setOnSuggestionListener(new SearchSuggestionListener(searchView)); - + if(!searchQuery.isEmpty()) { + searchView.setQuery(searchQuery,false); + searchView.setIconifiedByDefault(false); + } } else if (videoFragment != null){ videoFragment.onCreateOptionsMenu(menu, inflater); } else { From b2d935dd6d8fda9806bc8ef8ab8307d2dc7641d0 Mon Sep 17 00:00:00 2001 From: madiyar Date: Mon, 7 Mar 2016 13:05:05 +0600 Subject: [PATCH 2/2] Restoring search query after orientation change in two pane mode --- .../main/java/org/schabi/newpipe/VideoItemListActivity.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/schabi/newpipe/VideoItemListActivity.java b/app/src/main/java/org/schabi/newpipe/VideoItemListActivity.java index 86c292da5..392cd80db 100644 --- a/app/src/main/java/org/schabi/newpipe/VideoItemListActivity.java +++ b/app/src/main/java/org/schabi/newpipe/VideoItemListActivity.java @@ -244,6 +244,9 @@ public class VideoItemListActivity extends AppCompatActivity // the support version on SearchView, so it needs to be set programmatically. searchView.setIconifiedByDefault(false); searchView.setIconified(false); + if(!searchQuery.isEmpty()) { + searchView.setQuery(searchQuery,false); + } searchView.setOnQueryTextListener(new SearchVideoQueryListener()); suggestionListAdapter = new SuggestionListAdapter(this); searchView.setSuggestionsAdapter(suggestionListAdapter); @@ -313,7 +316,7 @@ public class VideoItemListActivity extends AppCompatActivity findViewById(R.id.videoitem_detail_container) == null) { inflater.inflate(R.menu.videoitem_list, menu); MenuItem searchItem = menu.findItem(R.id.action_search); - final SearchView searchView = (SearchView) searchItem.getActionView(); + SearchView searchView = (SearchView) searchItem.getActionView(); searchView.setFocusable(false); searchView.setOnQueryTextListener( new SearchVideoQueryListener());