Search in sources :

Example 81 with SearchManager

use of android.app.SearchManager in project ETSMobile-Android2 by ApplETS.

the class MapActivity method onCreateOptionsMenu.

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the options menu from XML
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.menu_map, menu);
    // Get the SearchView and set the searchable configuration
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    SearchView searchView = (SearchView) menu.findItem(R.id.menu_map_search).getActionView();
    // Assumes current activity is the searchable activity
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    // Do not iconify the widget;
    searchView.setIconifiedByDefault(false);
    return true;
}
Also used : SearchView(android.widget.SearchView) MenuInflater(android.view.MenuInflater) SearchManager(android.app.SearchManager)

Example 82 with SearchManager

use of android.app.SearchManager in project android_frameworks_base by DirtyUnicorns.

the class SearchManagerTest method testStopSearchIdempotent.

/**
     * Tests that stopSearch() can be called when the search UI is not visible and can be
     * called multiple times without startSearch() in between.
     */
public void testStopSearchIdempotent() throws Exception {
    SearchManager searchManager = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE);
    assertNotNull(searchManager);
    searchManager.stopSearch();
    searchManager.startSearch(null, false, SEARCHABLE_ACTIVITY, null, false);
    searchManager.stopSearch();
    searchManager.stopSearch();
}
Also used : ISearchManager(android.app.ISearchManager) SearchManager(android.app.SearchManager)

Example 83 with SearchManager

use of android.app.SearchManager in project android_frameworks_base by DirtyUnicorns.

the class SearchManagerTest method testStartSearchIdempotent.

/**
     * Tests that startSearch() can be called multiple times without stopSearch()
     * in between.
     */
public void testStartSearchIdempotent() throws Exception {
    SearchManager searchManager = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE);
    assertNotNull(searchManager);
    searchManager.startSearch(null, false, SEARCHABLE_ACTIVITY, null, false);
    searchManager.startSearch(null, false, SEARCHABLE_ACTIVITY, null, false);
    searchManager.stopSearch();
}
Also used : ISearchManager(android.app.ISearchManager) SearchManager(android.app.SearchManager)

Example 84 with SearchManager

use of android.app.SearchManager in project android_frameworks_base by DirtyUnicorns.

the class SearchManagerTest method testSearchManagerAvailable.

/**
     * The goal of this test is to confirm that we can obtain
     * a search manager at any time, and that for any given context,
     * it is a singleton.
     */
@LargeTest
public void testSearchManagerAvailable() {
    SearchManager searchManager1 = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE);
    assertNotNull(searchManager1);
    SearchManager searchManager2 = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE);
    assertNotNull(searchManager2);
    assertSame(searchManager1, searchManager2);
}
Also used : ISearchManager(android.app.ISearchManager) SearchManager(android.app.SearchManager) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 85 with SearchManager

use of android.app.SearchManager in project HumaneApp by Ganesh1010.

the class MapActivity method onCreateOptionsMenu.

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater mi = getMenuInflater();
    mi.inflate(R.menu.menu_map, menu);
    MenuItem searchViewItem = menu.findItem(R.id.action_search);
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    SearchView searchView = (SearchView) searchViewItem.getActionView();
    searchView.setQueryHint("Search for your Location...");
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    searchView.setSubmitButtonEnabled(true);
    // Do not iconify the widget; expand it by defaul
    searchView.setIconifiedByDefault(false);
    SearchView.OnQueryTextListener queryTextListener = new SearchView.OnQueryTextListener() {

        public boolean onQueryTextChange(String newText) {
            return true;
        }

        public boolean onQueryTextSubmit(String query) {
            onMapSearch(query);
            return true;
        }
    };
    searchView.setOnQueryTextListener(queryTextListener);
    return true;
}
Also used : SearchView(android.support.v7.widget.SearchView) MenuInflater(android.view.MenuInflater) SearchManager(android.app.SearchManager) MenuItem(android.view.MenuItem)

Aggregations

SearchManager (android.app.SearchManager)101 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 SearchView (android.support.v7.widget.SearchView)14 MenuItem (android.view.MenuItem)14 RecognizerIntent (android.speech.RecognizerIntent)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 MenuInflater (android.view.MenuInflater)6 AppWidgetHostView (android.appwidget.AppWidgetHostView)5 PackageManager (android.content.pm.PackageManager)5 ResolveInfo (android.content.pm.ResolveInfo)5