Source:
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.notifications_settings, menu); mSearchMenuItem = menu.findItem(R.id.menu_notifications_settings_search); mSearchView = (SearchView) mSearchMenuItem.getActionView(); mSearchView.setQueryHint(getString(R.string.search_sites)); setSearchViewHintColor(); mBlogsCategory = (PreferenceCategory) findPreference( getString(R.string.pref_notification_blogs)); mFollowedBlogsCategory = (PreferenceCategory) findPreference( getString(R.string.pref_notification_blogs_followed)); mSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { configureBlogsSettings(mBlogsCategory, true); configureFollowedBlogsSettings(mFollowedBlogsCategory, true); return true; } @Override public boolean onQueryTextChange(String newText) { configureBlogsSettings(mBlogsCategory, !mSearchMenuItemCollapsed); configureFollowedBlogsSettings(mFollowedBlogsCategory, !mSearchMenuItemCollapsed); return true; } }); mSearchMenuItem.setOnActionExpandListener(new MenuItem.OnActionExpandListener() { @Override public boolean onMenuItemActionExpand(MenuItem item) { mSearchMenuItemCollapsed = false; configureBlogsSettings(mBlogsCategory, true); configureFollowedBlogsSettings(mFollowedBlogsCategory, true); return true; } @Override public boolean onMenuItemActionCollapse(MenuItem item) { mSearchMenuItemCollapsed = true; configureBlogsSettings(mBlogsCategory, false); configureFollowedBlogsSettings(mFollowedBlogsCategory, false); return true; } }); updateSearchMenuVisibility(); if (!TextUtils.isEmpty(mRestoredQuery)) { mSearchMenuItem.expandActionView(); mSearchView.setQuery(mRestoredQuery, true); } }

Target:
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.notifications_settings, menu); mSearchMenuItem = menu.findItem(R.id.menu_notifications_settings_search); mSearchView = (SearchView) mSearchMenuItem.getActionView(); mSearchView.setQueryHint(getString(R.string.search_sites)); setSearchViewHintColor(mSearchView, R.color.wordpress_blue_5); mBlogsCategory = (PreferenceCategory) findPreference( getString(R.string.pref_notification_blogs)); mFollowedBlogsCategory = (PreferenceCategory) findPreference( getString(R.string.pref_notification_blogs_followed)); mSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { configureBlogsSettings(mBlogsCategory, true); configureFollowedBlogsSettings(mFollowedBlogsCategory, true); return true; } @Override public boolean onQueryTextChange(String newText) { configureBlogsSettings(mBlogsCategory, !mSearchMenuItemCollapsed); configureFollowedBlogsSettings(mFollowedBlogsCategory, !mSearchMenuItemCollapsed); return true; } }); mSearchMenuItem.setOnActionExpandListener(new MenuItem.OnActionExpandListener() { @Override public boolean onMenuItemActionExpand(MenuItem item) { mSearchMenuItemCollapsed = false; configureBlogsSettings(mBlogsCategory, true); configureFollowedBlogsSettings(mFollowedBlogsCategory, true); return true; } @Override public boolean onMenuItemActionCollapse(MenuItem item) { mSearchMenuItemCollapsed = true; configureBlogsSettings(mBlogsCategory, false); configureFollowedBlogsSettings(mFollowedBlogsCategory, false); return true; } }); updateSearchMenuVisibility(); if (!TextUtils.isEmpty(mRestoredQuery)) { mSearchMenuItem.expandActionView(); mSearchView.setQuery(mRestoredQuery, true); } }