From 3842b9df4b3b82ece5ddf46e817c95c82f4e4eb0 Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 20 Oct 2014 15:19:40 +0200 Subject: [PATCH] Workaround for missing action view Refs #2037 --- CHANGELOG.md | 2 + src/biz/bokhorst/xprivacy/ActivityMain.java | 46 +++++++++++---------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d03177d2e..3902e8e3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,8 @@ See for more information about XPrivacy 3 [this FAQ](https://github.com/M66B/XPr **Next release** +* Workaround for missing action view ([issue](/../../issues/2037)) + [Open issues](https://github.com/M66B/XPrivacy/issues?state=open) **Version 3.4.4 TEST** diff --git a/src/biz/bokhorst/xprivacy/ActivityMain.java b/src/biz/bokhorst/xprivacy/ActivityMain.java index ee7eeaaa4..c95f9b9e2 100644 --- a/src/biz/bokhorst/xprivacy/ActivityMain.java +++ b/src/biz/bokhorst/xprivacy/ActivityMain.java @@ -485,29 +485,31 @@ public boolean onCreateOptionsMenu(Menu menu) { // Searchable SearchView searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView(); - searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { - @Override - public boolean onQueryTextChange(String newText) { - searchQuery = newText; - applyFilter(); - return true; - } + if (searchView != null) { + searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { + @Override + public boolean onQueryTextChange(String newText) { + searchQuery = newText; + applyFilter(); + return true; + } - @Override - public boolean onQueryTextSubmit(String query) { - searchQuery = query; - applyFilter(); - return true; - } - }); - searchView.setOnCloseListener(new SearchView.OnCloseListener() { - @Override - public boolean onClose() { - searchQuery = ""; - applyFilter(); - return true; - } - }); + @Override + public boolean onQueryTextSubmit(String query) { + searchQuery = query; + applyFilter(); + return true; + } + }); + searchView.setOnCloseListener(new SearchView.OnCloseListener() { + @Override + public boolean onClose() { + searchQuery = ""; + applyFilter(); + return true; + } + }); + } return true; } else