Example usage for android.app SearchManager stopSearch

List of usage examples for android.app SearchManager stopSearch

Introduction

In this page you can find the example usage for android.app SearchManager stopSearch.

Prototype

public void stopSearch() 

Source Link

Document

Terminate search UI.

Usage

From source file:com.cognizant.trumobi.PersonaLauncher.java

@Override
protected void onResume() {
    PersonaLog.d("PersonaLauncher", "onResume of PersonaLauncher");
    super.onResume();
    if (shouldRestart())
        return;/*  www.ja v  a 2 s. co m*/
    //Badge
    updateBadgeCounts();
    // ADW: Use custom settings to set the rotation
    /*
     * this.setRequestedOrientation(
     * PersonaAlmostNexusSettingsHelper.getDesktopRotation(this)?
     * ActivityInfo.SCREEN_ORIENTATION_USER
     * :ActivityInfo.SCREEN_ORIENTATION_NOSENSOR );
     */
    // ADW: Use custom settings to change number of columns (and rows for
    // SlidingGrid) depending on phone rotation
    int orientation = getResources().getConfiguration().orientation;
    if (orientation == Configuration.ORIENTATION_PORTRAIT) {
        mAllAppsGrid.setNumColumns(PersonaAlmostNexusSettingsHelper.getColumnsPortrait(PersonaLauncher.this));
        mAllAppsGrid.setNumRows(PersonaAlmostNexusSettingsHelper.getRowsPortrait(PersonaLauncher.this));
        mAllAppsGrid.setPageHorizontalMargin(
                PersonaAlmostNexusSettingsHelper.getPageHorizontalMargin(PersonaLauncher.this));

    } else {
        mAllAppsGrid.setNumColumns(PersonaAlmostNexusSettingsHelper.getColumnsLandscape(PersonaLauncher.this));
        mAllAppsGrid.setNumRows(PersonaAlmostNexusSettingsHelper.getRowsLandscape(PersonaLauncher.this));
    }
    // mWorkspace.setWallpaper(false);
    if (mRestoring) {
        startLoaders();
    }

    // If this was a new intent (i.e., the mIsNewIntent flag got set to true
    // by
    // onNewIntent), then close the search dialog if needed, because it
    // probably
    // came from the user pressing 'home' (rather than, for example,
    // pressing 'back').
    if (mIsNewIntent) {
        // Post to a handler so that this happens after the search dialog
        // tries to open
        // itself again.
        mWorkspace.post(new Runnable() {
            public void run() {
                // ADW: changed from using ISearchManager to use
                // SearchManager (thanks to PersonaLauncher+ source code)
                SearchManager searchManagerService = (SearchManager) PersonaLauncher.this
                        .getSystemService(Context.SEARCH_SERVICE);
                try {
                    searchManagerService.stopSearch();
                } catch (Exception e) {
                    PersonaLog.e(LOG_TAG, "error stopping search", e);
                }
            }
        });
    }

    mIsNewIntent = false;
}