Example usage for android.view KeyEvent KEYCODE_SEARCH

List of usage examples for android.view KeyEvent KEYCODE_SEARCH

Introduction

In this page you can find the example usage for android.view KeyEvent KEYCODE_SEARCH.

Prototype

int KEYCODE_SEARCH

To view the source code for android.view KeyEvent KEYCODE_SEARCH.

Click Source Link

Document

Key code constant: Search key.

Usage

From source file:com.haibison.android.anhuu.utils.ui.bookmark.BookmarkFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (BuildConfig.DEBUG)
        Log.d(CLASSNAME, "onCreateView()");
    if (getDialog() != null) {
        getDialog().setOnKeyListener(new DialogInterface.OnKeyListener() {

            @Override//from   w  w w . j  a  va  2 s. c om
            public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
                /*
                 * Don't let the Search key dismiss this dialog.
                 */
                return keyCode == KeyEvent.KEYCODE_SEARCH;
            }// onKey()
        });

        return null;
    }

    return initContentView(inflater, container);
}

From source file:com.teleca.jamendo.activity.HomeActivity.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    // support for search key
    // TODO remove hardcoded '1' value
    if (keyCode == KeyEvent.KEYCODE_SEARCH) {
        mHomeListView.setSelection(1);/* w ww.j  a va  2  s  . co  m*/
        PurpleEntry entry = (PurpleEntry) mHomeListView.getAdapter().getItem(1);
        entry.getListener().performAction();
    }
    return super.onKeyDown(keyCode, event);
}

From source file:com.bt.download.android.gui.activities.MainActivity.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_SEARCH) {
        if (!(getCurrentFragment() instanceof SearchFragment)) {
            controller.switchFragment(R.id.menu_main_search);
        }//ww  w.ja  va2  s . c  o  m
    } else if (keyCode == KeyEvent.KEYCODE_MENU) {
        toggleDrawer();
    } else {
        return super.onKeyDown(keyCode, event);
    }

    return true;
}

From source file:com.codeskraps.sbrowser.home.SBrowserActivity.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK) {

        if (webView.canGoBack())
            webView.goBack();//from ww w  . j  ava2 s  .c om
        else {
            if (webView != null) {
                webView.clearCache(true);
                webView.clearHistory();
            }

            sBrowserData.setSelected(false);
            sBrowserData.setSaveState(sBrowserData.getetxtHome());

            finish();
            overridePendingTransition(R.anim.fadein, R.anim.fadeout);
        }
        return true;

    } else if (keyCode == KeyEvent.KEYCODE_SEARCH) {
        doSearch();
    }
    return super.onKeyDown(keyCode, event);
}

From source file:group.pals.android.lib.ui.filechooser.utils.ui.bookmark.BookmarkFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (BuildConfig.DEBUG)
        Log.d(_ClassName, "onCreateView()");
    if (getDialog() != null) {
        getDialog().setOnKeyListener(new DialogInterface.OnKeyListener() {

            @Override//from  www .  j  av  a2 s. c  o m
            public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
                /*
                 * Don't let the Search key dismiss this dialog.
                 */
                return keyCode == KeyEvent.KEYCODE_SEARCH;
            }// onKey()
        });

        return null;
    }

    return initContentView(inflater, container);
}

From source file:com.frostwire.android.gui.activities.MainActivity.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_SEARCH) {
        if (!(getCurrentFragment() instanceof SearchFragment)) {
            controller.switchFragment(R.id.menu_main_search);
        }/*w  w w.j a  v a  2  s .  c o m*/
    } else if (keyCode == KeyEvent.KEYCODE_MENU) {
        toggleDrawer();
    } else {
        try {
            return super.onKeyDown(keyCode, event);
        } catch (NullPointerException npe) {
            return false;
        }
    }
    return true;
}

From source file:mp.paschalis.BookSearch.java

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_SEARCH) {
        linearLayoutSearchLayout.setVisibility(View.VISIBLE);
        isMakingSearch = true;//w  w w. jav a 2  s. c  o  m
        invalidateOptionsMenu();

        editTextSearchKeyword.setFocusable(true);
        editTextSearchKeyword.requestFocus();

        return true;
    } else {
        return super.onKeyUp(keyCode, event);
    }
}

From source file:net.olejon.mdapp.Icd10ChapterActivity.java

@Override
public boolean onKeyUp(int keyCode, @NonNull KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_SEARCH) {
        mToolbarSearchLayout.setVisibility(View.VISIBLE);
        mToolbarSearchEditText.requestFocus();

        mInputMethodManager.showSoftInput(mToolbarSearchEditText, 0);

        return true;
    }/*www .jav  a  2s  . c  om*/

    return super.onKeyUp(keyCode, event);
}

From source file:net.olejon.mdapp.DiseasesAndTreatmentsActivity.java

@Override
public boolean onKeyUp(int keyCode, @NonNull KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_SEARCH) {
        showSearchLanguageDialog();/*from   w ww  .j av  a2s  .c  om*/
        return true;
    }

    return super.onKeyUp(keyCode, event);
}

From source file:com.android.camera.ActivityBase.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    // Prevent software keyboard or voice search from showing up.
    if (keyCode == KeyEvent.KEYCODE_SEARCH || keyCode == KeyEvent.KEYCODE_MENU) {
        if (event.isLongPress())
            return true;
    }// w  w w .j  a  v a2  s  .c  o  m

    return super.onKeyDown(keyCode, event);
}