Search in sources :

Example 21 with SearchManager

use of android.app.SearchManager in project platform_frameworks_base by android.

the class PhoneWindowManager method launchAssistLongPressAction.

private void launchAssistLongPressAction() {
    performHapticFeedbackLw(null, HapticFeedbackConstants.LONG_PRESS, false);
    sendCloseSystemWindows(SYSTEM_DIALOG_REASON_ASSIST);
    // launch the search activity
    Intent intent = new Intent(Intent.ACTION_SEARCH_LONG_PRESS);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    try {
        // TODO: This only stops the factory-installed search manager.
        // Need to formalize an API to handle others
        SearchManager searchManager = getSearchManager();
        if (searchManager != null) {
            searchManager.stopSearch();
        }
        startActivityAsUser(intent, UserHandle.CURRENT);
    } catch (ActivityNotFoundException e) {
        Slog.w(TAG, "No activity to handle assist long press action.", e);
    }
}
Also used : SearchManager(android.app.SearchManager) ActivityNotFoundException(android.content.ActivityNotFoundException) Intent(android.content.Intent) RecognizerIntent(android.speech.RecognizerIntent)

Example 22 with SearchManager

use of android.app.SearchManager in project Shuttle by timusus.

the class SearchActivity method onCreateOptionsMenu.

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.menu_search_activity, menu);
    MenuItem searchItem = menu.findItem(R.id.action_search);
    searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
    final SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    final SearchableInfo searchableInfo = searchManager.getSearchableInfo(getComponentName());
    if (searchView != null) {
        ThemeUtils.themeSearchView(this, searchView);
        searchView.setIconified(false);
        searchView.setSearchableInfo(searchableInfo);
        if (!TextUtils.isEmpty(filterString)) {
            searchView.setQuery(filterString, false);
        }
    }
    if (subscriptions == null || subscriptions.isUnsubscribed()) {
        subscriptions = new CompositeSubscription();
    }
    if (searchView != null) {
        subscriptions.add(getSearchViewSubscription());
    }
    return super.onCreateOptionsMenu(menu);
}
Also used : SearchManager(android.app.SearchManager) CompositeSubscription(rx.subscriptions.CompositeSubscription) SearchableInfo(android.app.SearchableInfo) MenuItem(android.view.MenuItem)

Example 23 with SearchManager

use of android.app.SearchManager in project glimmr by brk3.

the class BaseActivity method onCreateOptionsMenu.

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.main_menu, menu);
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    SearchView searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView();
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    return super.onCreateOptionsMenu(menu);
}
Also used : SearchView(android.widget.SearchView) SearchManager(android.app.SearchManager)

Example 24 with SearchManager

use of android.app.SearchManager in project FBReaderJ by geometer.

the class FBReader method onSearchRequested.

@Override
public boolean onSearchRequested() {
    final FBReaderApp.PopupPanel popup = myFBReaderApp.getActivePopup();
    myFBReaderApp.hideActivePopup();
    if (DeviceType.Instance().hasStandardSearchDialog()) {
        final SearchManager manager = (SearchManager) getSystemService(SEARCH_SERVICE);
        manager.setOnCancelListener(new SearchManager.OnCancelListener() {

            public void onCancel() {
                if (popup != null) {
                    myFBReaderApp.showPopup(popup.getId());
                }
                manager.setOnCancelListener(null);
            }
        });
        startSearch(myFBReaderApp.MiscOptions.TextSearchPattern.getValue(), true, null, false);
    } else {
        SearchDialogUtil.showDialog(this, FBReader.class, myFBReaderApp.MiscOptions.TextSearchPattern.getValue(), new DialogInterface.OnCancelListener() {

            @Override
            public void onCancel(DialogInterface di) {
                if (popup != null) {
                    myFBReaderApp.showPopup(popup.getId());
                }
            }
        });
    }
    return true;
}
Also used : SearchManager(android.app.SearchManager)

Example 25 with SearchManager

use of android.app.SearchManager in project Etar-Calendar by Etar-Group.

the class Utils method setUpSearchView.

/**
     * This sets up a search view to use Calendar's search suggestions provider
     * and to allow refining the search.
     *
     * @param view The {@link SearchView} to set up
     * @param act The activity using the view
     */
public static void setUpSearchView(SearchView view, Activity act) {
    SearchManager searchManager = (SearchManager) act.getSystemService(Context.SEARCH_SERVICE);
    view.setSearchableInfo(searchManager.getSearchableInfo(act.getComponentName()));
    view.setQueryRefinementEnabled(true);
}
Also used : SearchManager(android.app.SearchManager)

Aggregations

SearchManager (android.app.SearchManager)99 Intent (android.content.Intent)31 ISearchManager (android.app.ISearchManager)26 ActivityNotFoundException (android.content.ActivityNotFoundException)20 ComponentName (android.content.ComponentName)20 Bundle (android.os.Bundle)14 RecognizerIntent (android.speech.RecognizerIntent)12 SearchView (android.support.v7.widget.SearchView)12 MenuItem (android.view.MenuItem)12 UserHandle (android.os.UserHandle)10 View (android.view.View)9 ImageView (android.widget.ImageView)8 SearchView (android.widget.SearchView)8 TextView (android.widget.TextView)8 ActivityOptions (android.app.ActivityOptions)7 LargeTest (android.test.suitebuilder.annotation.LargeTest)6 AppWidgetHostView (android.appwidget.AppWidgetHostView)5 PackageManager (android.content.pm.PackageManager)5 ResolveInfo (android.content.pm.ResolveInfo)5 MenuInflater (android.view.MenuInflater)5