Use new material search icon with material theme

This commit is contained in:
Amin Bandali 2015-12-28 22:05:54 -05:00 committed by Adrian Ulrich
parent 4671261f1c
commit 15572f0ac0
6 changed files with 8 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 728 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 915 B

View File

@ -814,7 +814,14 @@ public class LibraryActivity
// Call super after adding the now-playing view as this should be the first item
super.onCreateOptionsMenu(menu);
mSearchMenuItem = menu.add(0, MENU_SEARCH, 0, R.string.search).setIcon(R.drawable.ic_menu_search);
// Check if we're running on Android 5.0 or higher
if (ThemeHelper.usesHoloTheme()) {
// Keep using the old icon
mSearchMenuItem = menu.add(0, MENU_SEARCH, 0, R.string.search).setIcon(R.drawable.ic_menu_search);
} else {
// Use the new material search icon
mSearchMenuItem = menu.add(0, MENU_SEARCH, 0, R.string.search).setIcon(R.drawable.ic_action_search);
}
mSearchMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW | MenuItem.SHOW_AS_ACTION_ALWAYS);
SearchView mSearchView = new SearchView(getActionBar().getThemedContext());
mSearchView.setOnQueryTextListener(this);