當前位置: 首頁>>代碼示例>>Java>>正文


Java Keyboard.KEYCODE_DONE屬性代碼示例

本文整理匯總了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);
    }
}
 
開發者ID:rollforbugs,項目名稱:lokey,代碼行數:25,代碼來源:IME.java

示例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;
      }
  }
 
開發者ID:zhaofengli,項目名稱:airboard,代碼行數:26,代碼來源:AirBoard.java

示例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;
    }
}
 
開發者ID:Medeuz,項目名稱:CustomAndroidKeyboard,代碼行數:25,代碼來源:SimpleIME.java

示例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);
    }
}
 
開發者ID:YehtutHl,項目名稱:myan,代碼行數:17,代碼來源:SmartMyan.java

示例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;
    }
}
 
開發者ID:GitPhoenix,項目名稱:KeyboardView,代碼行數:26,代碼來源:EditView.java

示例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);
    }
}
 
開發者ID:DoubleDotLabs,項目名稱:Butterboard,代碼行數:17,代碼來源:KeyboardService.java

示例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);
	}
}
 
開發者ID:makiftasova,項目名稱:random-keyboard,代碼行數:20,代碼來源:RandomIME.java

示例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);
	}
}
 
開發者ID:makiftasova,項目名稱:random-keyboard,代碼行數:17,代碼來源:RandomIME.java

示例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);
}
 
開發者ID:wanleung,項目名稱:ChangjieIME,代碼行數:23,代碼來源:ChangjieIME.java

示例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;
    }
}
 
開發者ID:Medeuz,項目名稱:CustomAndroidKeyboard,代碼行數:32,代碼來源:SimpleIME.java

示例11: onRelease

@Override
public void onRelease(int primaryCode) {
    switch (primaryCode) {
        case Keyboard.KEYCODE_DONE:// 完成-4
            hide(true);
            break;

        default:
            break;
    }
}
 
開發者ID:GitPhoenix,項目名稱:KeyboardView,代碼行數:11,代碼來源:EditView.java

示例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);
}
 
開發者ID:DoubleDotLabs,項目名稱:Butterboard,代碼行數:32,代碼來源:KeyboardService.java

示例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();
    }
 
開發者ID:PuffOpenSource,項目名稱:Puff-Android,代碼行數:71,代碼來源:IMEService.java

示例14: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == Keyboard.KEYCODE_DONE) {
        return true;
    }
    return super.onKeyDown(keyCode, event);
}
 
開發者ID:sanlinnaing,項目名稱:MUA-Keyboard,代碼行數:7,代碼來源:MyIME.java

示例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);
}
 
開發者ID:sanlinnaing,項目名稱:MUA-Keyboard,代碼行數:10,代碼來源:MyIME.java


注:本文中的android.inputmethodservice.Keyboard.KEYCODE_DONE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。