Example usage for android.media AudioManager FX_KEYPRESS_STANDARD

List of usage examples for android.media AudioManager FX_KEYPRESS_STANDARD

Introduction

In this page you can find the example usage for android.media AudioManager FX_KEYPRESS_STANDARD.

Prototype

int FX_KEYPRESS_STANDARD

To view the source code for android.media AudioManager FX_KEYPRESS_STANDARD.

Click Source Link

Document

IME standard keypress sound

Usage

From source file:org.distantshoresmedia.keyboard.LatinIME.java

private void playKeyClick(int primaryCode) {
    // if mAudioManager is null, we don't have the ringer state yet
    // mAudioManager will be set by updateRingerMode
    if (mAudioManager == null) {
        if (mKeyboardSwitcher.getInputView() != null) {
            updateRingerMode();//w  w w.  ja  v a 2  s.com
        }
    }
    if (mSoundOn && !mSilentMode) {
        // FIXME: Volume and enable should come from UI settings
        // FIXME: These should be triggered after auto-repeat logic
        int sound = AudioManager.FX_KEYPRESS_STANDARD;
        switch (primaryCode) {
        case Keyboard.KEYCODE_DELETE:
            sound = AudioManager.FX_KEYPRESS_DELETE;
            break;
        case ASCII_ENTER:
            sound = AudioManager.FX_KEYPRESS_RETURN;
            break;
        case ASCII_SPACE:
            sound = AudioManager.FX_KEYPRESS_SPACEBAR;
            break;
        }
        mAudioManager.playSoundEffect(sound, getKeyClickVolume());
    }
}