Collapse search view
This commit is contained in:
parent
8a3e4f8765
commit
0333b2cecf
|
@ -195,6 +195,21 @@ public class FeedItemlistFragment extends ListFragment {
|
|||
final SearchView sv = (SearchView) MenuItemCompat.getActionView(searchItem);
|
||||
MenuItemUtils.adjustTextColor(getActivity(), sv);
|
||||
sv.setQueryHint(getString(R.string.search_hint));
|
||||
searchItem.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
|
||||
@Override
|
||||
public boolean onMenuItemActionExpand(MenuItem item) {
|
||||
menu.findItem(R.id.filter_items).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
|
||||
menu.findItem(R.id.episode_actions).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
|
||||
menu.findItem(R.id.refresh_item).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMenuItemActionCollapse(MenuItem item) {
|
||||
getActivity().invalidateOptionsMenu();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
sv.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
||||
@Override
|
||||
public boolean onQueryTextSubmit(String s) {
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
<item
|
||||
android:id="@+id/action_search"
|
||||
android:icon="?attr/action_search"
|
||||
custom:showAsAction="always"
|
||||
custom:showAsAction="always|collapseActionView"
|
||||
custom:actionViewClass="android.support.v7.widget.SearchView"
|
||||
android:title="@string/search_label"/>
|
||||
|
||||
|
|
Loading…
Reference in New Issue