本文整理匯總了Java中android.inputmethodservice.Keyboard.KEYCODE_DONE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Keyboard.KEYCODE_DONE屬性的具體用法?Java Keyboard.KEYCODE_DONE怎麽用?Java Keyboard.KEYCODE_DONE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.inputmethodservice.Keyboard
的用法示例。
在下文中一共展示了Keyboard.KEYCODE_DONE屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: playClick
private void playClick(int keyCode) {
AudioManager am = (AudioManager)getSystemService(AUDIO_SERVICE);
switch (keyCode) {
case 0x20:
am.playSoundEffect(AudioManager.FX_KEYPRESS_SPACEBAR);
break;
case Keyboard.KEYCODE_DONE:
case 0x0a:
am.playSoundEffect(AudioManager.FX_KEYPRESS_RETURN);
break;
case Keyboard.KEYCODE_DELETE:
am.playSoundEffect(AudioManager.FX_KEYPRESS_DELETE);
break;
case 0x38:
if (prefs.getBoolean("pref_eight_enable", false)) {
// Play random "eight" sound
MediaPlayer mPlayer = mediaEight[rand.nextInt(mediaEight.length)];
mPlayer.seekTo(0);
mPlayer.start();
}
break;
default:
am.playSoundEffect(AudioManager.FX_KEYPRESS_STANDARD);
}
}
示例2: onKey
@Override
public void onKey(int primaryCode, int[] keyCodes) {
InputConnection ic = getCurrentInputConnection() ;
playclick(primaryCode);
switch (primaryCode) {
case Keyboard.KEYCODE_DELETE:
ic.deleteSurroundingText(1, 0);
break;
case Keyboard.KEYCODE_SHIFT:
caps = !caps;
keyboard.setShifted(caps);
kv.invalidateAllKeys();
break;
case Keyboard.KEYCODE_DONE:
ic.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER));
break;
default:
char code = (char) primaryCode;
if(Character.isLetter(code) && caps) {
code = Character.toUpperCase(code);
}
ic.commitText(String.valueOf(code), 1);
break;
}
}
示例3: playClick
/**
* Play sound on key press
*
* @param keyCode of pressed key
*/
private void playClick(int keyCode) {
AudioManager am = (AudioManager) getSystemService(AUDIO_SERVICE);
switch (keyCode) {
case Constants.KeyCode.SPACE:
am.playSoundEffect(AudioManager.FX_KEYPRESS_SPACEBAR);
break;
case Keyboard.KEYCODE_DONE:
am.playSoundEffect(AudioManager.FX_KEYPRESS_RETURN);
break;
case Constants.KeyCode.RETURN:
am.playSoundEffect(AudioManager.FX_KEYPRESS_RETURN);
break;
case Keyboard.KEYCODE_DELETE:
am.playSoundEffect(AudioManager.FX_KEYPRESS_DELETE);
break;
default:
am.playSoundEffect(AudioManager.FX_KEYPRESS_STANDARD);
break;
}
}
示例4: playClick
private void playClick(int keyCode) {
AudioManager am = (AudioManager) getSystemService(AUDIO_SERVICE);
switch (keyCode) {
case 32:
am.playSoundEffect(AudioManager.FX_KEYPRESS_SPACEBAR);
break;
case Keyboard.KEYCODE_DONE:
case 10:
am.playSoundEffect(AudioManager.FX_KEYPRESS_RETURN);
break;
case Keyboard.KEYCODE_DELETE:
am.playSoundEffect(AudioManager.FX_KEYPRESS_DELETE);
break;
default:
am.playSoundEffect(AudioManager.FX_KEYPRESS_STANDARD);
}
}
示例5: onKey
@Override
public void onKey(int primaryCode, int[] ints) {
Editable editable = getText();
int start = getSelectionStart();
switch (primaryCode) {
case Keyboard.KEYCODE_MODE_CHANGE:// 英文鍵盤與數字鍵盤切換-2
shiftKeyboard();
break;
case Keyboard.KEYCODE_DELETE:// 回退-5
if (editable != null && editable.length() > 0 && start > 0) {
editable.delete(start - 1, start);
}
break;
case Keyboard.KEYCODE_SHIFT:// 英文大小寫切換-1
shiftEnglish();
keyboardView.setKeyboard(keyboardEnglish);
break;
case Keyboard.KEYCODE_DONE:// 完成-4
break;
default:
editable.insert(start, Character.toString((char) primaryCode));
break;
}
}
示例6: playType
private void playType(int keyCode) {
AudioManager audio = (AudioManager) getSystemService(AUDIO_SERVICE);
switch (keyCode) {
case 32:
audio.playSoundEffect(AudioManager.FX_KEYPRESS_SPACEBAR);
break;
case Keyboard.KEYCODE_DONE:
case 10:
audio.playSoundEffect(AudioManager.FX_KEYPRESS_RETURN);
break;
case Keyboard.KEYCODE_DELETE:
audio.playSoundEffect(AudioManager.FX_KEYPRESS_DELETE);
break;
default:
audio.playSoundEffect(AudioManager.FX_KEYPRESS_STANDARD);
}
}
示例7: onKey
@Override
public void onKey(int primaryCode, int[] keyCodes) {
InputConnection inputConnection = getCurrentInputConnection();
playClick(primaryCode);
switch (primaryCode) {
case Keyboard.KEYCODE_DELETE:
inputConnection.deleteSurroundingText(1, 0);
break;
case Keyboard.KEYCODE_DONE:
inputConnection.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER));
break;
case Keyboard.KEYCODE_CANCEL:
deleteWord(inputConnection);
break;
default:
String randomWord = randomWords.getRandomWord();
randomWord += " ";
inputConnection.commitText(randomWord, randomWord.length() + 1);
}
}
示例8: playClick
private void playClick(int keyCode) {
AudioManager am = (AudioManager) getSystemService(AUDIO_SERVICE);
switch (keyCode) {
case 32:
am.playSoundEffect(AudioManager.FX_KEYPRESS_SPACEBAR);
break;
case Keyboard.KEYCODE_DONE:
case 10:
am.playSoundEffect(AudioManager.FX_KEYPRESS_RETURN);
break;
case Keyboard.KEYCODE_DELETE:
am.playSoundEffect(AudioManager.FX_KEYPRESS_DELETE);
break;
default:
am.playSoundEffect(AudioManager.FX_KEYPRESS_STANDARD);
}
}
示例9: onKey
public void onKey(int primaryCode, int[] keyCodes) {
this.wordProcessor.getChinesePhraseDictLinkedHashMap("(");
if (imeSwitch.handleKey(primaryCode)) {
this.strokereset();
this.inputView.setKeyboard(imeSwitch.getCurrentKeyboard());
return;
}
if (primaryCode == Keyboard.KEYCODE_CANCEL) {
this.handleClose();
return;
}
if (primaryCode == Keyboard.KEYCODE_DELETE) {
this.handleBackspace();
return;
}
if (primaryCode == IMEKeyboard.KEYCODE_ENTER) {
this.handleEnter();
}
if (primaryCode == Keyboard.KEYCODE_DONE) {
return;
}
this.handleKey(primaryCode, keyCodes);
}
示例10: onKey
@Override
public void onKey(int primaryCode, int[] ints) {
Log.d(TAG, "onKey " + primaryCode);
InputConnection ic = getCurrentInputConnection();
playClick(primaryCode);
switch (primaryCode) {
case Keyboard.KEYCODE_DELETE:
ic.deleteSurroundingText(1, 0);
break;
case Keyboard.KEYCODE_SHIFT:
handleShift();
break;
case Keyboard.KEYCODE_DONE:
ic.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER));
break;
case Keyboard.KEYCODE_ALT:
handleSymbolsSwitch();
break;
case Keyboard.KEYCODE_MODE_CHANGE:
handleLanguageSwitch();
break;
default:
char code = (char) primaryCode;
if (Character.isLetter(code) && isCapsOn) {
code = Character.toUpperCase(code);
}
ic.commitText(String.valueOf(code), 1);
break;
}
}
示例11: onRelease
@Override
public void onRelease(int primaryCode) {
switch (primaryCode) {
case Keyboard.KEYCODE_DONE:// 完成-4
hide(true);
break;
default:
break;
}
}
示例12: onKey
@Override
public void onKey(int primaryCode, int[] keyCodes) {
InputConnection input = getCurrentInputConnection();
playType(primaryCode);
switch (primaryCode) {
case Keyboard.KEYCODE_DELETE:
input.deleteSurroundingText(1, 0);
break;
case Keyboard.KEYCODE_SHIFT:
long now = System.currentTimeMillis();
if (isCapsLock) isCapsLock = false;
else if (lastCapsTime + 800 > now)
isCapsLock = true;
keyboardView.setShifted(isCapsLock || !keyboardView.isShifted());
lastCapsTime = now;
break;
case Keyboard.KEYCODE_DONE:
input.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER));
break;
default:
char code = (char) primaryCode;
if (Character.isLetter(code) && keyboardView.isShifted()) {
code = Character.toUpperCase(code);
keyboardView.setShifted(isCapsLock);
}
input.commitText(String.valueOf(code), 1);
}
vibrator.vibrate(20);
}
示例13: onKey
@Override
public void onKey(int primaryCode, int[] keyCodes) {
InputConnection ic = getCurrentInputConnection();
switch(primaryCode){
case PuffKeyboardView.KEYCODE_EDIT :
Intent intent = new Intent(this, DialogAcctList.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | Intent.FLAG_ACTIVITY_CLEAR_TASK);
getApplicationContext().startActivity(intent);
stopSelf();
break;
case -11 :
ic.commitText(account, 1);
account = "";
break;
case -12:
ic.commitText(password, 1);
password = "";
break;
case -13:
ic.commitText(additional, 1);
additional = "";
break;
case Keyboard.KEYCODE_DONE:
ic.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER));
break;
case Keyboard.KEYCODE_DELETE:
ic.deleteSurroundingText(1, 0);
break;
case Keyboard.KEYCODE_MODE_CHANGE:
if(kv.getKeyboard() == symbolKeyboard || kv.getKeyboard() == symsftKeyboard) {
currentKeyboard = normalKeyboard;
} else {
currentKeyboard = symbolKeyboard;
}
kv.setKeyboard(currentKeyboard);
break;
case Keyboard.KEYCODE_SHIFT:
// if (kv.getKeyboard() == normalKeyboard) {
// caps = !caps;
// normalKeyboard.setShifted(caps);
// kv.invalidateAllKeys();
// }
if(currentKeyboard == shiftKeyboard) {
currentKeyboard = normalKeyboard;
} else {
currentKeyboard = shiftKeyboard;
}
kv.setKeyboard(currentKeyboard);
break;
case Keyboard.KEYCODE_ALT:
if (kv.getKeyboard() == symbolKeyboard) {
currentKeyboard = symsftKeyboard;
} else {
currentKeyboard = symbolKeyboard;
}
kv.setKeyboard(currentKeyboard);
break;
case -886 :
Toast.makeText(IMEService.this, "close", Toast.LENGTH_SHORT).show();
break ;
default:
char code = (char)primaryCode;
if (caps) {
code = Character.toUpperCase(code);
}
ic.commitText(String.valueOf(code),1);
break;
}
VibrateUtil.getStaticInstance(this).tick();
}
示例14: onKeyDown
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == Keyboard.KEYCODE_DONE) {
return true;
}
return super.onKeyDown(keyCode, event);
}
示例15: onKeyLongPress
@Override
public boolean onKeyLongPress(int keyCode, KeyEvent event) {
// TODO Auto-generated method stub
if (keyCode == Keyboard.KEYCODE_DONE) {
Log.d("onKeyLongPress", "Enter key is long press");
return true;
}
return super.onKeyLongPress(keyCode, event);
}