Example usage for android.app SearchManager SUGGEST_COLUMN_ICON_1

List of usage examples for android.app SearchManager SUGGEST_COLUMN_ICON_1

Introduction

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

Prototype

String SUGGEST_COLUMN_ICON_1

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

Click Source Link

Document

Column name for suggestions cursor.

Usage

From source file:com.aboveware.sms.contacts.ContactSuggestionsAdapter.java

/**
 * Cache columns./*from   w w w .j ava 2  s .  c  o  m*/
 */
@SuppressLint("InlinedApi")
@Override
public void changeCursor(Cursor c) {
    if (DBG)
        Log.d(LOG_TAG, "changeCursor(" + c + ")");

    if (mClosed) {
        Log.w(LOG_TAG, "Tried to change cursor after adapter was closed.");
        if (c != null)
            c.close();
        return;
    }

    try {
        super.changeCursor(c);

        if (c != null) {
            mText1Col = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_TEXT_1);
            mText2Col = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_TEXT_2);
            mText2UrlCol = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_TEXT_2_URL);
            c.getColumnIndex(SearchManager.SUGGEST_COLUMN_ICON_1);
            mIconName2Col = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_ICON_2);
            mFlagsCol = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_FLAGS);
        }
    } catch (Exception e) {
        Log.e(LOG_TAG, "error changing cursor and caching columns", e);
    }
}

From source file:android.support.v7.widget.SuggestionsAdapter.java

/**
 * Cache columns.//from  w w w . ja  va  2 s  . c  o m
 */
@Override
public void changeCursor(Cursor c) {
    if (DBG)
        Log.d(LOG_TAG, "changeCursor(" + c + ")");

    if (mClosed) {
        Log.w(LOG_TAG, "Tried to change cursor after adapter was closed.");
        if (c != null)
            c.close();
        return;
    }

    try {
        super.changeCursor(c);

        if (c != null) {
            mText1Col = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_TEXT_1);
            mText2Col = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_TEXT_2);
            mText2UrlCol = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_TEXT_2_URL);
            mIconName1Col = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_ICON_1);
            mIconName2Col = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_ICON_2);
            mFlagsCol = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_FLAGS);
        }
    } catch (Exception e) {
        Log.e(LOG_TAG, "error changing cursor and caching columns", e);
    }
}

From source file:de.sourcestream.movieDB.MainActivity.java

/**
 * Initialize the contents of the Activity's standard options menu.
 * This is only called once, the first time the options menu is displayed.
 *
 * @param menu the options menu in which we place our items.
 * @return You must return true for the menu to be displayed; if you return false it will not be shown.
 *///from  w w  w .  java 2  s.c  om
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.menu_main, menu);
    searchViewItem = menu.findItem(R.id.search);
    searchView = (SearchView) MenuItemCompat.getActionView(searchViewItem);

    searchView.setQueryHint(getResources().getString(R.string.search_hint));
    searchView.setOnQueryTextListener(searchViewOnQueryTextListener);
    searchView.setOnSuggestionListener(searchSuggestionListener);

    // Associate searchable configuration with the SearchView
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    SearchView searchViewItemC = (SearchView) menu.findItem(R.id.search).getActionView();
    searchViewItemC.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));

    String[] from = { SearchManager.SUGGEST_COLUMN_ICON_1, SearchManager.SUGGEST_COLUMN_TEXT_1,
            SearchManager.SUGGEST_COLUMN_TEXT_2 };
    int[] to = { R.id.posterPath, R.id.title, R.id.info };
    searchAdapter = new SimpleCursorAdapter(getApplicationContext(), R.layout.suggestionrow, null, from, to,
            0) {
        @Override
        public void changeCursor(Cursor cursor) {
            super.swapCursor(cursor);
        }
    };
    searchViewItemC.setSuggestionsAdapter(searchAdapter);

    MenuItemCompat.setOnActionExpandListener(searchViewItem, onSearchViewItemExpand);

    return true;
}