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

The following examples show how to use android.view.MenuItem#setOnActionExpandListener() . These examples are extracted from open source projects. 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
@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
@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
@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
@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 Project: Contacts   File: MainActivity.java    License: 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
@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
@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
@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
@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
@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
@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 Project: MiBandDecompiled   File: G.java    License: 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
public static MenuItem setOnActionExpandListener(MenuItem item,
        SupportActionExpandProxy listener) {
    return item.setOnActionExpandListener(new OnActionExpandListenerWrapper(listener));
}
 
Example 14
public static MenuItem setOnActionExpandListener(MenuItem item,
        SupportActionExpandProxy listener) {
    return item.setOnActionExpandListener(new OnActionExpandListenerWrapper(listener));
}
 
Example 15
Source Project: V.FlyoutTest   File: MenuItemCompatIcs.java    License: 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 Project: guideshow   File: MenuItemCompatIcs.java    License: MIT License 4 votes vote down vote up
public static MenuItem setOnActionExpandListener(MenuItem item,
        SupportActionExpandProxy listener) {
    return item.setOnActionExpandListener(new OnActionExpandListenerWrapper(listener));
}