@Override public boolean onKeyDown(int keyCode, KeyEvent event) { boolean handled = super.onKeyDown(keyCode, event); // Eat the long press event so the keyboard doesn't come up. if (keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress()) { return true; } return handled; }
private void bindKeyEvents(){ this.webView.setOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_SEARCH) { if (event.getAction() == KeyEvent.ACTION_UP){ Log.d("testApp", "Release"); return true; } if (event.getAction() == KeyEvent.ACTION_DOWN && event.isLongPress()){ Log.d("testApp", "Long Press"); return true; } if (event.getAction() == KeyEvent.ACTION_DOWN){ event.startTracking(); Log.d("testApp", "Press"); return true; } } return true; } }); }
public boolean dispatchKeyEvent(KeyEvent event) { int action = event.getAction(); if (Util.isConfirmKey(event.getKeyCode())) { if (event.isLongPress()) { this.mEatDpadCenterKeyDown = true; Util.playErrorSound(getContext()); return true; } else if (action == 1) { if (this.mEatDpadCenterKeyDown) { this.mEatDpadCenterKeyDown = false; return true; } this.mClickDeviceId = event.getDeviceId(); } } return super.dispatchKeyEvent(event); }
public boolean dispatchKeyEvent(KeyEvent event) { int action = event.getAction(); if (Util.isConfirmKey(event.getKeyCode())) { if (event.isLongPress()) { this.mEatDpadCenterKeyDown = true; Util.playErrorSound(getContext()); return true; } else if (action == 1) { if (this.mEatDpadCenterKeyDown) { this.mEatDpadCenterKeyDown = false; return true; } this.mClickDeviceId = event.getDeviceId(); } } return super.dispatchKeyEvent(event); }
if (event.getAction() == KeyEvent.ACTION_DOWN && event.isLongPress()) { mMenuKeyIsLongPress = true; } else if (event.getAction() == KeyEvent.ACTION_UP) {
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { final int uniChar = event.getUnicodeChar(); final boolean handled = super.onKeyDown(keyCode, event); final boolean isKeyNotWhitespace = uniChar > 0 && !Character.isWhitespace(uniChar); if (!handled && acceptFilter() && isKeyNotWhitespace) { boolean gotKey = TextKeyListener.getInstance().onKeyDown(mWorkspace, mDefaultKeySsb, keyCode, event); if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) { // something usable has been typed - start a search // the typed text will be retrieved and cleared by // showSearchDialog() // If there are multiple keystrokes before the search dialog takes focus, // onSearchRequested() will be called for every keystroke, // but it is idempotent, so it's fine. return onSearchRequested(); } } // Eat the long press event so the keyboard doesn't come up. return keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress() || handled; }
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { final int uniChar = event.getUnicodeChar(); final boolean handled = super.onKeyDown(keyCode, event); final boolean isKeyNotWhitespace = uniChar > 0 && !Character.isWhitespace(uniChar); if (!handled && acceptFilter() && isKeyNotWhitespace) { boolean gotKey = TextKeyListener.getInstance().onKeyDown(mWorkspace, mDefaultKeySsb, keyCode, event); if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) { // something usable has been typed - start a search // the typed text will be retrieved and cleared by // showSearchDialog() // If there are multiple keystrokes before the search dialog takes focus, // onSearchRequested() will be called for every keystroke, // but it is idempotent, so it's fine. return onSearchRequested(); } } // Eat the long press event so the keyboard doesn't come up. if (keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress()) { return true; } return handled; }
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { final int uniChar = event.getUnicodeChar(); final boolean handled = super.onKeyDown(keyCode, event); final boolean isKeyNotWhitespace = uniChar > 0 && !Character.isWhitespace(uniChar); if (!handled && acceptFilter() && isKeyNotWhitespace) { boolean gotKey = TextKeyListener.getInstance().onKeyDown(mWorkspace, mDefaultKeySsb, keyCode, event); if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) { // something usable has been typed - start a search // the typed text will be retrieved and cleared by // showSearchDialog() // If there are multiple keystrokes before the search dialog takes focus, // onSearchRequested() will be called for every keystroke, // but it is idempotent, so it's fine. return onSearchRequested(); } } // Eat the long press event so the keyboard doesn't come up. if (keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress()) { return true; } return handled; }
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { final int uniChar = event.getUnicodeChar(); final boolean handled = super.onKeyDown(keyCode, event); final boolean isKeyNotWhitespace = uniChar > 0 && !Character.isWhitespace(uniChar); if (!handled && acceptFilter() && isKeyNotWhitespace) { boolean gotKey = TextKeyListener.getInstance().onKeyDown(mWorkspace, mDefaultKeySsb, keyCode, event); if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) { // something usable has been typed - start a search // the typed text will be retrieved and cleared by // showSearchDialog() // If there are multiple keystrokes before the search dialog takes focus, // onSearchRequested() will be called for every keystroke, // but it is idempotent, so it's fine. return onSearchRequested(); } } // Eat the long press event so the keyboard doesn't come up. if (keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress()) { return true; } return handled; }
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { final int uniChar = event.getUnicodeChar(); final boolean handled = super.onKeyDown(keyCode, event); final boolean isKeyNotWhitespace = uniChar > 0 && !Character.isWhitespace(uniChar); if (!handled && acceptFilter() && isKeyNotWhitespace) { boolean gotKey = TextKeyListener.getInstance().onKeyDown(mWorkspace, mDefaultKeySsb, keyCode, event); if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) { // something usable has been typed - start a search // the typed text will be retrieved and cleared by // showSearchDialog() // If there are multiple keystrokes before the search dialog takes focus, // onSearchRequested() will be called for every keystroke, // but it is idempotent, so it's fine. return onSearchRequested(); } } // Eat the long press event so the keyboard doesn't come up. if (keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress()) { return true; } return handled; }