List of usage examples for android.view KeyEvent KEYCODE_DPAD_DOWN
int KEYCODE_DPAD_DOWN
To view the source code for android.view KeyEvent KEYCODE_DPAD_DOWN.
Click Source Link
From source file:Main.java
/** * Checks whether the given event is any of DPAD down or NUMPAD down. * @param event Event to be checked./*from w ww . jav a 2 s .c om*/ * @return Whether the event should be processed as a navigation down. */ public static boolean isGoDown(KeyEvent event) { return isActionDown(event) && (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_DOWN || (!event.isNumLockOn() && event.getKeyCode() == KeyEvent.KEYCODE_NUMPAD_2)); }
From source file:Main.java
public static String getChar(int keyCode) { switch (keyCode) { case KeyEvent.KEYCODE_0: return "0"; case KeyEvent.KEYCODE_1: return "1"; case KeyEvent.KEYCODE_2: return "2"; case KeyEvent.KEYCODE_3: return "3"; case KeyEvent.KEYCODE_4: return "4"; case KeyEvent.KEYCODE_5: return "5"; case KeyEvent.KEYCODE_6: return "6"; case KeyEvent.KEYCODE_7: return "7"; case KeyEvent.KEYCODE_8: return "8"; case KeyEvent.KEYCODE_9: return "9"; case KeyEvent.KEYCODE_A: return "a"; case KeyEvent.KEYCODE_B: return "b"; case KeyEvent.KEYCODE_C: return "c"; case KeyEvent.KEYCODE_D: return "d"; case KeyEvent.KEYCODE_E: return "e"; case KeyEvent.KEYCODE_F: return "f"; case KeyEvent.KEYCODE_G: return "g"; case KeyEvent.KEYCODE_H: return "h"; case KeyEvent.KEYCODE_I: return "i"; case KeyEvent.KEYCODE_J: return "j"; case KeyEvent.KEYCODE_K: return "k"; case KeyEvent.KEYCODE_L: return "l"; case KeyEvent.KEYCODE_M: return "m"; case KeyEvent.KEYCODE_N: return "n"; case KeyEvent.KEYCODE_O: return "o"; case KeyEvent.KEYCODE_P: return "p"; case KeyEvent.KEYCODE_Q: return "q"; case KeyEvent.KEYCODE_R: return "r"; case KeyEvent.KEYCODE_S: return "s"; case KeyEvent.KEYCODE_T: return "t"; case KeyEvent.KEYCODE_U: return "u"; case KeyEvent.KEYCODE_V: return "v"; case KeyEvent.KEYCODE_W: return "w"; case KeyEvent.KEYCODE_X: return "x"; case KeyEvent.KEYCODE_Y: return "y"; case KeyEvent.KEYCODE_Z: return "z"; case KeyEvent.KEYCODE_DEL: return "{BKSP}"; case KeyEvent.KEYCODE_ENTER: case KeyEvent.KEYCODE_DPAD_CENTER: return "{ENTER}"; case KeyEvent.KEYCODE_SPACE: return " "; case KeyEvent.KEYCODE_DPAD_DOWN: return "{DOWN}"; case KeyEvent.KEYCODE_DPAD_UP: return "{UP}"; case KeyEvent.KEYCODE_DPAD_LEFT: return "{LEFT}"; case KeyEvent.KEYCODE_DPAD_RIGHT: return "{RIGHT}"; }//from w w w . java2 s . c o m return null; }
From source file:Main.java
public static String getKeyNameByCode(int code) { switch (code) { case KeyEvent.KEYCODE_0: return "<0>"; case KeyEvent.KEYCODE_1: return "<1>"; case KeyEvent.KEYCODE_2: return "<2>"; case KeyEvent.KEYCODE_3: return "<3>"; case KeyEvent.KEYCODE_4: return "<4>"; case KeyEvent.KEYCODE_5: return "<5>"; case KeyEvent.KEYCODE_6: return "<6>"; case KeyEvent.KEYCODE_7: return "<7>"; case KeyEvent.KEYCODE_8: return "<8>"; case KeyEvent.KEYCODE_9: return "<9>"; case KeyEvent.KEYCODE_A: return "<A>"; case KeyEvent.KEYCODE_B: return "<B>"; case KeyEvent.KEYCODE_C: return "<C>"; case KeyEvent.KEYCODE_D: return "<D>"; case KeyEvent.KEYCODE_E: return "<E>"; case KeyEvent.KEYCODE_F: return "<F>"; case KeyEvent.KEYCODE_G: return "<G>"; case KeyEvent.KEYCODE_H: return "<H>"; case KeyEvent.KEYCODE_I: return "<I>"; case KeyEvent.KEYCODE_J: return "<J>"; case KeyEvent.KEYCODE_K: return "<K>"; case KeyEvent.KEYCODE_L: return "<L>"; case KeyEvent.KEYCODE_M: return "<M>"; case KeyEvent.KEYCODE_N: return "<N>"; case KeyEvent.KEYCODE_O: return "<O>"; case KeyEvent.KEYCODE_P: return "<P>"; case KeyEvent.KEYCODE_Q: return "<Q>"; case KeyEvent.KEYCODE_R: return "<R>"; case KeyEvent.KEYCODE_S: return "<S>"; case KeyEvent.KEYCODE_T: return "<T>"; case KeyEvent.KEYCODE_U: return "<U>"; case KeyEvent.KEYCODE_V: return "<V>"; case KeyEvent.KEYCODE_W: return "<W>"; case KeyEvent.KEYCODE_X: return "<X>"; case KeyEvent.KEYCODE_Y: return "<Y>"; case KeyEvent.KEYCODE_Z: return "<Z>"; case KeyEvent.KEYCODE_APOSTROPHE: return "<'>"; case KeyEvent.KEYCODE_AT: return "<@>"; case KeyEvent.KEYCODE_BACK: return "<Back>"; case KeyEvent.KEYCODE_BACKSLASH: return "<\\>"; case KeyEvent.KEYCODE_CALL: return "<Call>"; case KeyEvent.KEYCODE_CAMERA: return "<Camera>"; case KeyEvent.KEYCODE_CLEAR: return "<Clear>"; case KeyEvent.KEYCODE_COMMA: return "<,>"; case KeyEvent.KEYCODE_DEL: return "<Del>"; case KeyEvent.KEYCODE_DPAD_CENTER: return "<PadCenter>"; case KeyEvent.KEYCODE_DPAD_DOWN: return "<PadDown>"; case KeyEvent.KEYCODE_DPAD_LEFT: return "<PadLeft>"; case KeyEvent.KEYCODE_DPAD_RIGHT: return "<PadRight>"; case KeyEvent.KEYCODE_DPAD_UP: return "<PadUp>"; case KeyEvent.KEYCODE_ENDCALL: return "<EndCall>"; case KeyEvent.KEYCODE_ENTER: return "<Enter>"; case KeyEvent.KEYCODE_ENVELOPE: return "<Envelope>"; case KeyEvent.KEYCODE_EQUALS: return "<=>"; case KeyEvent.KEYCODE_EXPLORER: return "<Explorer>"; case KeyEvent.KEYCODE_FOCUS: return "<??? 0>"; case KeyEvent.KEYCODE_GRAVE: return "<??? 1>"; case KeyEvent.KEYCODE_HEADSETHOOK: return "<??? 2>"; case KeyEvent.KEYCODE_HOME: return "<Home>"; case KeyEvent.KEYCODE_LEFT_BRACKET: return "<(>"; case KeyEvent.KEYCODE_MENU: return "<Menu>"; case KeyEvent.KEYCODE_MINUS: return "<->"; case KeyEvent.KEYCODE_NOTIFICATION: return "<??? 3>"; case KeyEvent.KEYCODE_NUM: return "<Num>"; case KeyEvent.KEYCODE_PERIOD: return "<??? 4>"; case KeyEvent.KEYCODE_PLUS: return "<+>"; case KeyEvent.KEYCODE_POUND: return "<??? 5>"; case KeyEvent.KEYCODE_POWER: return "<Power>"; case KeyEvent.KEYCODE_RIGHT_BRACKET: return "<)>"; case KeyEvent.KEYCODE_SEMICOLON: return "<;>"; case KeyEvent.KEYCODE_SLASH: return "</>"; case KeyEvent.KEYCODE_SOFT_LEFT: return "<??? 6>"; case KeyEvent.KEYCODE_SOFT_RIGHT: return "<??? 7>"; case KeyEvent.KEYCODE_SPACE: return "<Space>"; case KeyEvent.KEYCODE_STAR: return "<*>"; case KeyEvent.KEYCODE_SYM: return "<Sym>"; case KeyEvent.KEYCODE_TAB: return "<Tab>"; case KeyEvent.KEYCODE_VOLUME_DOWN: return "<VolumeDown>"; case KeyEvent.KEYCODE_VOLUME_UP: return "<VolumeUp>"; case KeyEvent.KEYCODE_UNKNOWN: default:// www. j a v a 2 s . c o m return "<Unknown>"; } }
From source file:com.oda.calculator.EventListener.java
public boolean onKey(View view, int keyCode, KeyEvent keyEvent) { int action = keyEvent.getAction(); if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT || keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) { boolean eat = mHandler.eatHorizontalMove(keyCode == KeyEvent.KEYCODE_DPAD_LEFT); return eat; }/*from w ww . ja v a2s . co m*/ //Work-around for spurious key event from IME, bug #1639445 if (action == KeyEvent.ACTION_MULTIPLE && keyCode == KeyEvent.KEYCODE_UNKNOWN) { return true; // eat it } //Calculator.log("KEY " + keyCode + "; " + action); if (keyEvent.getUnicodeChar() == '=') { if (action == KeyEvent.ACTION_UP) { mHandler.onEnter(); } return true; } if (keyCode != KeyEvent.KEYCODE_DPAD_CENTER && keyCode != KeyEvent.KEYCODE_DPAD_UP && keyCode != KeyEvent.KEYCODE_DPAD_DOWN && keyCode != KeyEvent.KEYCODE_ENTER) { if (keyEvent.isPrintingKey() && action == KeyEvent.ACTION_UP) { // Tell the handler that text was updated. mHandler.onTextChanged(); } return false; } /* We should act on KeyEvent.ACTION_DOWN, but strangely sometimes the DOWN event isn't received, only the UP. So the workaround is to act on UP... http://b/issue?id=1022478 */ if (action == KeyEvent.ACTION_UP) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: case KeyEvent.KEYCODE_DPAD_CENTER: mHandler.onEnter(); break; case KeyEvent.KEYCODE_DPAD_UP: mHandler.onUp(); break; case KeyEvent.KEYCODE_DPAD_DOWN: mHandler.onDown(); break; } } return true; }
From source file:com.aman.stockcalculator.EventListener.java
@Override public boolean onKey(View view, int keyCode, KeyEvent keyEvent) { int action = keyEvent.getAction(); if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT || keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) { boolean eat = mHandler.eatHorizontalMove(keyCode == KeyEvent.KEYCODE_DPAD_LEFT); return eat; }/* w ww . j a va2s.c om*/ //Work-around for spurious key event from IME, bug #1639445 if (action == KeyEvent.ACTION_MULTIPLE && keyCode == KeyEvent.KEYCODE_UNKNOWN) { return true; // eat it } //Calculator.log("KEY " + keyCode + "; " + action); if (keyEvent.getUnicodeChar() == '=') { if (action == KeyEvent.ACTION_UP) { mHandler.onEnter(); } return true; } if (keyCode != KeyEvent.KEYCODE_DPAD_CENTER && keyCode != KeyEvent.KEYCODE_DPAD_UP && keyCode != KeyEvent.KEYCODE_DPAD_DOWN && keyCode != KeyEvent.KEYCODE_ENTER) { if (keyEvent.isPrintingKey() && action == KeyEvent.ACTION_UP) { // Tell the handler that text was updated. mHandler.onTextChanged(); } return false; } /* We should act on KeyEvent.ACTION_DOWN, but strangely sometimes the DOWN event isn't received, only the UP. So the workaround is to act on UP... http://b/issue?id=1022478 */ if (action == KeyEvent.ACTION_UP) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: case KeyEvent.KEYCODE_DPAD_CENTER: mHandler.onEnter(); break; case KeyEvent.KEYCODE_DPAD_UP: mHandler.onUp(); break; case KeyEvent.KEYCODE_DPAD_DOWN: mHandler.onDown(); break; } } return true; }
From source file:tinkercoder.stockcalculator.calculator.EventListener.java
@Override public boolean onKey(View view, int keyCode, KeyEvent keyEvent) { int action = keyEvent.getAction(); if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT || keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) { boolean eat = mHandler.eatHorizontalMove(keyCode == KeyEvent.KEYCODE_DPAD_LEFT); return eat; }//from w ww .j a v a 2 s . c o m //Work-around for spurious key event from IME, bug #1639445 if (action == KeyEvent.ACTION_MULTIPLE && keyCode == KeyEvent.KEYCODE_UNKNOWN) { return true; // eat it } //Calculator.log("KEY " + keyCode + "; " + action); if (keyEvent.getUnicodeChar() == '=') { if (action == KeyEvent.ACTION_UP) { mHandler.onEnter(); } return true; } if (keyCode != KeyEvent.KEYCODE_DPAD_CENTER && keyCode != KeyEvent.KEYCODE_DPAD_UP && keyCode != KeyEvent.KEYCODE_DPAD_DOWN && keyCode != KeyEvent.KEYCODE_ENTER) { return false; } /* We should act on KeyEvent.ACTION_DOWN, but strangely sometimes the DOWN event isn't received, only the UP. So the workaround is to act on UP... http://b/issue?id=1022478 */ if (action == KeyEvent.ACTION_UP) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: case KeyEvent.KEYCODE_DPAD_CENTER: mHandler.onEnter(); break; case KeyEvent.KEYCODE_DPAD_UP: mHandler.onUp(); break; case KeyEvent.KEYCODE_DPAD_DOWN: mHandler.onDown(); break; } } return true; }
From source file:com.mstar.tv.tvplayer.philips.option.OptionFirstFragment.java
@Override public void onStart() { super.onStart(); listView = getListView();//from w ww. j a v a2 s.co m if (getFragmentManager().findFragmentById(R.id.first_fragment) != null) { listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); } listView.setDivider(null); listView.setDividerHeight(5); listView.setSelector(android.R.color.transparent); listView.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { settingAdapter.setSelectViewPosition(position); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); listView.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View view, int keyCode, KeyEvent keyEvent) { // TODO Auto-generated method stub if (OptionKarrays.isFromLauncher) { if (!isWifiOpen() && keyEvent.getAction() == KeyEvent.ACTION_DOWN) {//wifi has not open if (listView.getSelectedItemPosition() == 1 && keyCode == KeyEvent.KEYCODE_DPAD_DOWN) {//??? listView.setSelection(3); return true; } else if (listView.getSelectedItemPosition() == 3 && keyCode == KeyEvent.KEYCODE_DPAD_UP) { listView.setSelection(1); return true; } } } return false; } }); }
From source file:com.cybrosys.basic.EventListener.java
@Override public boolean onKey(View vwView, int keyCode, KeyEvent keyEvent) { int action = keyEvent.getAction(); if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT || keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) { boolean eat = mHandler.eatHorizontalMove(keyCode == KeyEvent.KEYCODE_DPAD_LEFT); return eat; }//from w w w .ja v a 2 s .com if (action == KeyEvent.ACTION_MULTIPLE && keyCode == KeyEvent.KEYCODE_UNKNOWN) { return true; } if (keyEvent.getUnicodeChar() == '=') { if (action == KeyEvent.ACTION_UP) { mHandler.onEnter(); } return true; } if (keyCode != KeyEvent.KEYCODE_DPAD_CENTER && keyCode != KeyEvent.KEYCODE_DPAD_UP && keyCode != KeyEvent.KEYCODE_DPAD_DOWN && keyCode != KeyEvent.KEYCODE_ENTER) { return false; } if (action == KeyEvent.ACTION_UP) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: case KeyEvent.KEYCODE_DPAD_CENTER: mHandler.onEnter(); break; case KeyEvent.KEYCODE_DPAD_UP: mHandler.onUp(); break; case KeyEvent.KEYCODE_DPAD_DOWN: mHandler.onDown(); break; } } return true; }
From source file:com.mstar.tv.tvplayer.philips.setting.SettingMainFragment.java
@Override public void onStart() { super.onStart(); listView = getListView();/*from w ww . j a v a 2 s .c om*/ if (getFragmentManager().findFragmentById(R.id.first_fragment) != null) { listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); } listView.setDivider(null); listView.setDividerHeight(5); listView.setSelector(android.R.color.transparent); listView.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { mCallback.onMainSelectedData(position); if (parent.isFocused()) settingAdapter.setSelectViewPosition(position); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); listView.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { settingAdapter.setSelectViewPosition(listView.getSelectedItemPosition()); } else { settingAdapter.setSelectViewPosition(-1); } } }); listView.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (K_TvCommonManager.getInstance().K_getCurrentTvInputSource() != K_Constants.INPUT_SOURCE_ATV && K_TvCommonManager.getInstance() .K_getCurrentTvInputSource() != K_Constants.INPUT_SOURCE_DTV || SettingKarrays.isTopActivity(mContext, "com.android.mslauncher.LauncherActivity")) { if (listView.getSelectedItemPosition() == listView.getLastVisiblePosition() - 1 && keyCode == KeyEvent.KEYCODE_DPAD_DOWN) { listView.setSelection(listView.getLastVisiblePosition() - 1); return true; } } return false; } }); }
From source file:com.mstar.tv.tvplayer.philips.setting.SettingFirstFragment.java
@Override public void onStart() { super.onStart(); listView = getListView();/* w w w . j a v a 2 s . c om*/ if (getFragmentManager().findFragmentById(R.id.first_fragment) != null) { listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); } listView.setDivider(null); listView.setDividerHeight(5); listView.setSelector(android.R.color.transparent); listView.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (parent.isFocused()) settingAdapter.setSelectViewPosition(position); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); listView.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { settingAdapter.setSelectViewPosition(getSelectedItemPosition()); } else { settingAdapter.setSelectViewPosition(-1); } } }); listView.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View view, int keyCode, KeyEvent keyEvent) { if (TvSettingMenuActivity.firstSelectPositon == SettingKarrays.SETTING_PHOTO) { if (K_TvCommonManager.getInstance().K_getCurrentTvInputSource() == K_Constants.INPUT_SOURCE_VGA && keyEvent.getAction() == KeyEvent.ACTION_DOWN) { if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN) { if (listView.getSelectedItemPosition() == 2) { listView.setSelection(5); return true; } } else if (keyCode == KeyEvent.KEYCODE_DPAD_UP) { if (listView.getSelectedItemPosition() == 5) { listView.setSelection(2); return true; } else if (listView.getSelectedItemPosition() == 1) { //listView.setSelection(1); return true; } } } } else if (TvSettingMenuActivity.firstSelectPositon == SettingKarrays.SETTING_TV) { if (!(mTvCommonManager.getCurrentTvInputSource() == TvCommonManager.INPUT_SOURCE_HDMI || mTvCommonManager.getCurrentTvInputSource() == TvCommonManager.INPUT_SOURCE_HDMI2 || mTvCommonManager.getCurrentTvInputSource() == TvCommonManager.INPUT_SOURCE_HDMI3)) {//EDID?? if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN && keyEvent.getAction() == KeyEvent.ACTION_DOWN) { if (listView.getSelectedItemPosition() == 4) { listView.setSelection(6); return true; } } else if (keyCode == KeyEvent.KEYCODE_DPAD_UP && keyEvent.getAction() == KeyEvent.ACTION_DOWN) { if (listView.getSelectedItemPosition() == 6) { listView.setSelection(4); return true; } } } } return false; } }); }