Example usage for android.app SearchManager QUERY

List of usage examples for android.app SearchManager QUERY

Introduction

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

Prototype

String QUERY

To view the source code for android.app SearchManager QUERY.

Click Source Link

Document

Intent extra data key: Use this key with android.content.Intent#getStringExtra content.Intent.getStringExtra() to obtain the query string from Intent.ACTION_SEARCH.

Usage

From source file:com.ksharkapps.musicnow.ui.activities.ShortcutActivity.java

/**
 * {@inheritDoc}//from ww  w .  j a  va 2 s. com
 */
@Override
protected void onCreate(final Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    // Fade it in
    overridePendingTransition(R.anim.swipeback_stack_right_in, R.anim.swipeback_stack_to_back);
    // Bind Apollo's service
    mToken = MusicUtils.bindToService(this, this);

    // Intiialize the intent
    mIntent = getIntent();
    // Get the voice search query
    mVoiceQuery = Capitalize.capitalize(mIntent.getStringExtra(SearchManager.QUERY));

}

From source file:fi.villel.foosquare.SearchActivity.java

private void handleIntent(Intent intent) {
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        String query = intent.getStringExtra(SearchManager.QUERY);
        mPresenter.startSearch(query, true);
    }//w w w.  j  av  a 2 s.c o m
}

From source file:org.barbon.mangaget.fragments.MangaSearchResults.java

public void performSearch(Intent intent) {
    Scraper scraper = Scraper.getInstance(getActivity());
    String query = intent.getStringExtra(SearchManager.QUERY);
    Bundle extra = intent.getBundleExtra(SearchManager.APP_DATA);
    Scraper.SearchCriteria criteria = new Scraper.SearchCriteria();

    criteria.title = query;//www .  j ava 2 s.c o m
    if (extra != null)
        criteria.includeTags = extra.getStringArrayList("include_tags");

    setListAdapter(new SearchAdapter(getActivity(), scraper, criteria));
}

From source file:com.klinker.android.twitter.ui.search.SearchPager.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    overridePendingTransition(R.anim.slide_in_left, R.anim.activity_zoom_exit);

    try {/*ww w . ja  va 2  s.  com*/
        ViewConfiguration config = ViewConfiguration.get(this);
        Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
        if (menuKeyField != null) {
            menuKeyField.setAccessible(true);
            menuKeyField.setBoolean(config, false);
        }
    } catch (Exception ex) {
        // Ignore
    }

    context = this;
    sharedPrefs = context.getSharedPreferences("com.klinker.android.twitter_world_preferences",
            Context.MODE_WORLD_READABLE + Context.MODE_WORLD_WRITEABLE);
    settings = AppSettings.getInstance(this);

    try {
        searchQuery = getIntent().getStringExtra(SearchManager.QUERY);
    } catch (Exception e) {
        searchQuery = "";
    }

    if (searchQuery == null) {
        searchQuery = "";
    }

    handleIntent(getIntent());

    if (Build.VERSION.SDK_INT > 18 && settings.uiExtras
            && (getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE
                    || getResources().getBoolean(R.bool.isTablet))) {
        translucent = true;
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);

        try {
            int immersive = android.provider.Settings.System.getInt(getContentResolver(), "immersive_mode");

            if (immersive == 1) {
                translucent = false;
            }
        } catch (Exception e) {
        }
    } else {
        translucent = false;
    }

    Utils.setUpTheme(context, settings);
    setContentView(R.layout.search_pager);

    actionBar = getActionBar();
    actionBar.setTitle(getResources().getString(R.string.search));
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setIcon(new ColorDrawable(getResources().getColor(android.R.color.transparent)));

    View statusBar = findViewById(R.id.activity_status_bar);

    mViewPager = (ViewPager) findViewById(R.id.pager);

    if (translucent) {
        statusBar.setVisibility(View.VISIBLE);

        int statusBarHeight = Utils.getStatusBarHeight(context);

        LinearLayout.LayoutParams statusParams = (LinearLayout.LayoutParams) statusBar.getLayoutParams();
        statusParams.height = statusBarHeight;
        statusBar.setLayoutParams(statusParams);
    } else {
        mViewPager.setPadding(0, 0, 0, 0);
    }

    mSectionsPagerAdapter = new SearchPagerAdapter(getFragmentManager(), context, onlyStatus, onlyProfile,
            searchQuery, translucent);

    mViewPager.setAdapter(mSectionsPagerAdapter);

    mViewPager.setOffscreenPageLimit(3);

    if (settings.addonTheme) {
        PagerTitleStrip strip = (PagerTitleStrip) findViewById(R.id.pager_title_strip);
        strip.setBackgroundColor(settings.pagerTitleInt);
    }

    mViewPager.setCurrentItem(1);

    Utils.setActionBar(context, true);

    if (onlyProfile) {
        mViewPager.setCurrentItem(2);
    }
}

From source file:com.tundem.alternativefindr.AlternativefindrActivity.java

public void handleIntent(Intent intent, boolean onCreate) {
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        mSearchTerm = intent.getStringExtra(SearchManager.QUERY);
        startFragment = 0;/*from  w  ww. j a va  2 s .com*/

        if (!onCreate) {
            //mPager.setCurrentItem(startFragment);
            mIndicator.setCurrentItem(startFragment);
            updateCurrentListView();
        }
    } else if (Intent.ACTION_SEARCH_LONG_PRESS.equals(intent.getAction())) {
        onSearchRequested();
    }
}

From source file:mroza.forms.ChooseProgramActivity.java

@Override
public void onResume() {
    super.onResume();

    boolean bundleQueryExists = false;
    if ((savedState != null) && (savedState.containsKey("SEARCH_FILTER")))
        bundleQueryExists = true;/*from w  w  w.  j a va  2 s  .  co  m*/

    Intent intent = getIntent();
    Term selectedTerm = getSelectedTerm();
    //if called by search event perform search
    if (Intent.ACTION_SEARCH.equals(intent.getAction()) || bundleQueryExists) {
        clearFilters(true);//remove filter values - cannot use filter and search simultaneously

        if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
            searchQuery = intent.getStringExtra(SearchManager.QUERY);
        } else {
            searchQuery = savedState.getString("SEARCH_FILTER");
            savedState.remove("SEARCH_FILTER");
        }

        List<ChildTable> queriedChildTables = ChildTablesRepository.getChildTablesByTermSelectedBySearch(
                ChooseProgramActivity.this, searchQuery, selectedTerm, child);
        handleListViewBehavior(queriedChildTables, selectedTerm);
        enableShowAllButton(true);
        intent.setAction(null); //clear search action
        return;
    }

    //if returning from child table view show all childTableList and clear filters
    List<ChildTable> childTables = ChildTablesRepository.getChildTableByTerm(ChooseProgramActivity.this,
            selectedTerm, child);
    handleListViewBehavior(childTables, selectedTerm);

    clearFilters(true);
    clearSearchField();
    enableShowAllButton(false);

}

From source file:com.fitforbusiness.contact.ContactsListActivity.java

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override/*ww  w.  j av a  2 s. c om*/
protected void onCreate(Bundle savedInstanceState) {
    /* if (BuildConfig.DEBUG) {
    Utils.enableStrictMode();
     }*/
    super.onCreate(savedInstanceState);
    try {
        if (Utils.hasHoneycomb()) {
            getActionBar().setDisplayHomeAsUpEnabled(true);
            getActionBar().setHomeButtonEnabled(true);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    DisplayMetrics metrics = getResources().getDisplayMetrics();
    int screenWidth = (int) (metrics.widthPixels * 0.80);
    int screenHeight = (int) (metrics.heightPixels * 0.80);
    //  getWindow().setBackgroundDrawable(getResources().getDrawable(R.drawable.transparent_background));
    // getWindow().setBackgroundDrawable(null);
    //  getWindow().setLayout(screenWidth, screenHeight);

    setContentView(R.layout.activity_contact_holder);

    // Set main content view. On smaller screen devices this is a single pane view with one
    // fragment. One larger screen devices this is a two pane view with two fragments.

    // Check if two pane bool is set based on resource directories
    isTwoPaneLayout = false;// getResources().getBoolean(R.bool.has_two_panes);

    // Check if this activity instance has been triggered as a result of a search query. This
    // will only happen on pre-HC OS versions as from HC onward search is carried out using
    // an ActionBar SearchView which carries out the search in-line without loading a new
    // Activity.
    if (Intent.ACTION_SEARCH.equals(getIntent().getAction())) {

        // Fetch query from intent and notify the fragment that it should display search
        // results instead of all contacts.
        String searchQuery = getIntent().getStringExtra(SearchManager.QUERY);
        ContactsListFragment mContactsListFragment = (ContactsListFragment) getSupportFragmentManager()
                .findFragmentById(R.id.contact_list);

        // This flag notes that the Activity is doing a search, and so the result will be
        // search results rather than all contacts. This prevents the Activity and Fragment
        // from trying to a search on search results.
        isSearchResultView = false;
        mContactsListFragment.setSearchQuery(searchQuery);

        // Set special title for search results
        String title = getString(R.string.contacts_list_search_results_title, searchQuery);
        setTitle(title);
    }

    if (isTwoPaneLayout) {
        // If two pane layout, locate the contact detail fragment
        mContactDetailFragment = (ContactDetailFragment) getSupportFragmentManager()
                .findFragmentById(R.id.contact_detail);
    }
}

From source file:com.thatkawaiiguy.meleehandbook.activity.SearchResultsActivity.java

private void handleIntent(Intent intent) {
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        query = intent.getStringExtra(SearchManager.QUERY).replaceAll("\\s+$", "").toLowerCase();
        queries.clear();//ww w .jav a  2s . co  m
        titleTermNum = 0;
        titleNum = 0;
        termNum = 0;
        showResults();
    }
}

From source file:org.wheelmap.android.fragment.POIsMapsforgeWorkerFragment.java

public void executeSearch(Bundle extras) {
    if (!extras.containsKey(SearchManager.QUERY) && !extras.containsKey(SyncService.EXTRA_CATEGORY)
            && !extras.containsKey(SyncService.EXTRA_NODETYPE)
            && !extras.containsKey(SyncService.EXTRA_WHEELCHAIR_STATE))
        return;/*  w ww.j a  v  a  2 s  .  c o m*/

    final Intent intent = new Intent(Intent.ACTION_SYNC, null, getActivity(), SyncService.class);

    intent.putExtras(extras);
    if (!extras.containsKey(SyncService.EXTRA_WHAT)) {
        int what;
        if (extras.containsKey(SyncService.EXTRA_CATEGORY) || extras.containsKey(SyncService.EXTRA_NODETYPE))
            what = SyncService.WHAT_RETRIEVE_NODES;
        else
            what = SyncService.WHAT_SEARCH_NODES_IN_BOX;

        intent.putExtra(SyncService.EXTRA_WHAT, what);
    }

    intent.putExtra(SyncService.EXTRA_STATUS_RECEIVER, mReceiver);
    getActivity().startService(intent);
    setSearchMode(true);
    updateSearchStatus();
}