Java Code Examples for android.view.MenuItem#setOnActionExpandListener()

The following examples show how to use android.view.MenuItem#setOnActionExpandListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java    From Aria2App with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.main, menu);
    getMenuInflater().inflate(R.menu.main_sorting, menu.findItem(R.id.main_sort).getSubMenu());

    SearchManager searchManager = (SearchManager) getSystemService(SEARCH_SERVICE);
    MenuItem searchItem = menu.findItem(R.id.main_search);
    searchItem.setOnActionExpandListener(this);
    searchView = (SearchView) searchItem.getActionView();

    if (searchManager != null && searchView != null) {
        searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
        searchView.setIconifiedByDefault(false);
        searchView.setOnCloseListener(this);
        searchView.setOnQueryTextListener(this);
    }

    return true;
}
 
Example 2
Source File: SearchActivity.java    From Aria2App with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.search, menu);
    SearchManager searchManager = (SearchManager) getSystemService(SEARCH_SERVICE);
    MenuItem searchItem = menu.findItem(R.id.search_search);
    searchItem.setOnActionExpandListener(this);

    searchView = (SearchView) searchItem.getActionView();
    if (searchManager != null) {
        searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
        searchView.setIconifiedByDefault(false);
        searchView.setOnCloseListener(this);
        searchView.setOnQueryTextListener(this);
    }

    return true;
}
 
Example 3
Source File: GamesFragment.java    From PretendYoureXyzzyAndroid with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onCreateOptionsMenu(@NonNull Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.games_fragment, menu);

    if (getContext() == null) return;
    SearchManager searchManager = (SearchManager) getContext().getSystemService(Context.SEARCH_SERVICE);
    MenuItem item = menu.findItem(R.id.gamesFragment_search);
    item.setOnActionExpandListener(this);

    if (searchManager != null && getActivity() != null) {
        searchView = (SearchView) item.getActionView();
        searchView.setSearchableInfo(searchManager.getSearchableInfo(getActivity().getComponentName()));
        searchView.setIconifiedByDefault(false);
        searchView.setOnCloseListener(this);
        searchView.setOnQueryTextListener(this);
    }
}
 
Example 4
Source File: NamesFragment.java    From PretendYoureXyzzyAndroid with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onCreateOptionsMenu(@NonNull Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.names_fragment, menu);

    if (getContext() == null) return;
    SearchManager searchManager = (SearchManager) getContext().getSystemService(Context.SEARCH_SERVICE);
    MenuItem item = menu.findItem(R.id.namesFragment_search);
    item.setOnActionExpandListener(this);

    if (searchManager != null && getActivity() != null) {
        searchView = (SearchView) item.getActionView();
        searchView.setSearchableInfo(searchManager.getSearchableInfo(getActivity().getComponentName()));
        searchView.setIconifiedByDefault(false);
        searchView.setOnCloseListener(this);
        searchView.setOnQueryTextListener(this);
    }
}
 
Example 5
Source File: MainActivity.java    From Contacts with MIT License 6 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
	if (!CorePrefs.isFirstLaunch())
	{
		getMenuInflater().inflate(R.menu.main, menu);

		MenuItem item = menu.findItem(R.id.action_search);
		mSearchView = (SearchView) item.getActionView();

		item.setOnActionExpandListener(mExpandListener);

		if (!CorePrefs.hasDonated())
		{
			menu.add(Menu.NONE, R.id.action_help_me, 99, R.string.action_help_me);
		}
	}

	return true;
}
 
Example 6
Source File: AbstractSearchableListItemActivity.java    From Pix-Art-Messenger with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
    getMenuInflater().inflate(R.menu.choose_contact, menu);
    final MenuItem menuSearchView = menu.findItem(R.id.action_search);
    final View mSearchView = menuSearchView.getActionView();
    mSearchEditText = mSearchView.findViewById(R.id.search_field);
    mSearchEditText.addTextChangedListener(mSearchTextWatcher);
    mSearchEditText.setHint(R.string.search_contacts);
    mSearchEditText.setOnEditorActionListener(this);
    menuSearchView.setOnActionExpandListener(mOnActionExpandListener);
    return true;
}
 
Example 7
Source File: MucUsersActivity.java    From Pix-Art-Messenger with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
    getMenuInflater().inflate(R.menu.muc_users_activity, menu);
    final MenuItem menuSearchView = menu.findItem(R.id.action_search);
    final View mSearchView = menuSearchView.getActionView();
    mSearchEditText = mSearchView.findViewById(R.id.search_field);
    mSearchEditText.addTextChangedListener(this);
    mSearchEditText.setHint(R.string.search_participants);
    menuSearchView.setOnActionExpandListener(this);
    return true;
}
 
Example 8
Source File: BooksAroundMeFragment.java    From barterli_android with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) {
    inflater.inflate(R.menu.menu_books_around_me, menu);
    final MenuItem menuItem = menu.findItem(R.id.action_search);
    menuItem.setOnActionExpandListener(this);
    mSearchView = (SearchView) MenuItemCompat.getActionView(menuItem);
    mSearchNetworkQueryHelper = new SearchViewNetworkQueryHelper(mSearchView, this);
    mSearchNetworkQueryHelper.setSuggestCountThreshold(3);
    mSearchNetworkQueryHelper.setSuggestWaitThreshold(400);
}
 
Example 9
Source File: AbstractSearchableListItemActivity.java    From Conversations with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
	getMenuInflater().inflate(R.menu.choose_contact, menu);
	final MenuItem menuSearchView = menu.findItem(R.id.action_search);
	final View mSearchView = menuSearchView.getActionView();
	mSearchEditText = mSearchView.findViewById(R.id.search_field);
	mSearchEditText.addTextChangedListener(mSearchTextWatcher);
	mSearchEditText.setHint(R.string.search_contacts);
	mSearchEditText.setOnEditorActionListener(this);
	menuSearchView.setOnActionExpandListener(mOnActionExpandListener);
	return true;
}
 
Example 10
Source File: MucUsersActivity.java    From Conversations with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
    getMenuInflater().inflate(R.menu.muc_users_activity, menu);
    final MenuItem menuSearchView = menu.findItem(R.id.action_search);
    final View mSearchView = menuSearchView.getActionView();
    mSearchEditText = mSearchView.findViewById(R.id.search_field);
    mSearchEditText.addTextChangedListener(this);
    mSearchEditText.setHint(R.string.search_participants);
    menuSearchView.setOnActionExpandListener(this);
    return true;
}
 
Example 11
Source File: ChooseCountryActivity.java    From Conversations with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
    getMenuInflater().inflate(R.menu.choose_country, menu);
    final MenuItem menuSearchView = menu.findItem(R.id.action_search);
    final View mSearchView = menuSearchView.getActionView();
    mSearchEditText = mSearchView.findViewById(R.id.search_field);
    mSearchEditText.addTextChangedListener(mSearchTextWatcher);
    mSearchEditText.setHint(R.string.search_countries);
    mSearchEditText.setOnEditorActionListener(mSearchDone);
    menuSearchView.setOnActionExpandListener(mOnActionExpandListener);
    return true;
}
 
Example 12
Source File: G.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
public static MenuItem a(MenuItem menuitem, I i)
{
    return menuitem.setOnActionExpandListener(new H(i));
}
 
Example 13
Source File: MenuItemCompatIcs.java    From CodenameOne with GNU General Public License v2.0 4 votes vote down vote up
public static MenuItem setOnActionExpandListener(MenuItem item,
        SupportActionExpandProxy listener) {
    return item.setOnActionExpandListener(new OnActionExpandListenerWrapper(listener));
}
 
Example 14
Source File: MenuItemCompatIcs.java    From adt-leanback-support with Apache License 2.0 4 votes vote down vote up
public static MenuItem setOnActionExpandListener(MenuItem item,
        SupportActionExpandProxy listener) {
    return item.setOnActionExpandListener(new OnActionExpandListenerWrapper(listener));
}
 
Example 15
Source File: MenuItemCompatIcs.java    From V.FlyoutTest with MIT License 4 votes vote down vote up
public static MenuItem setOnActionExpandListener(MenuItem item,
        SupportActionExpandProxy listener) {
    return item.setOnActionExpandListener(new OnActionExpandListenerWrapper(listener));
}
 
Example 16
Source File: MenuItemCompatIcs.java    From guideshow with MIT License 4 votes vote down vote up
public static MenuItem setOnActionExpandListener(MenuItem item,
        SupportActionExpandProxy listener) {
    return item.setOnActionExpandListener(new OnActionExpandListenerWrapper(listener));
}