Java Code Examples for android.media.AudioManager#FX_KEYPRESS_SPACEBAR

The following examples show how to use android.media.AudioManager#FX_KEYPRESS_SPACEBAR . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AudioAndHapticFeedbackManager.java    From openboard with GNU General Public License v3.0 6 votes vote down vote up
public void performAudioFeedback(final int code) {
    // if mAudioManager is null, we can't play a sound anyway, so return
    if (mAudioManager == null) {
        return;
    }
    if (!mSoundOn) {
        return;
    }
    final int sound;
    switch (code) {
    case Constants.CODE_DELETE:
        sound = AudioManager.FX_KEYPRESS_DELETE;
        break;
    case Constants.CODE_ENTER:
        sound = AudioManager.FX_KEYPRESS_RETURN;
        break;
    case Constants.CODE_SPACE:
        sound = AudioManager.FX_KEYPRESS_SPACEBAR;
        break;
    default:
        sound = AudioManager.FX_KEYPRESS_STANDARD;
        break;
    }
    mAudioManager.playSoundEffect(sound, mSettingsValues.mKeypressSoundVolume);
}
 
Example 2
Source File: AudioAndHapticFeedbackManager.java    From LokiBoard-Android-Keylogger with Apache License 2.0 6 votes vote down vote up
public void performAudioFeedback(final int code) {
    // if mAudioManager is null, we can't play a sound anyway, so return
    if (mAudioManager == null) {
        return;
    }
    if (!mSoundOn) {
        return;
    }
    final int sound;
    switch (code) {
    case Constants.CODE_DELETE:
        sound = AudioManager.FX_KEYPRESS_DELETE;
        break;
    case Constants.CODE_ENTER:
        sound = AudioManager.FX_KEYPRESS_RETURN;
        break;
    case Constants.CODE_SPACE:
        sound = AudioManager.FX_KEYPRESS_SPACEBAR;
        break;
    default:
        sound = AudioManager.FX_KEYPRESS_STANDARD;
        break;
    }
    mAudioManager.playSoundEffect(sound, mSettingsValues.mKeypressSoundVolume);
}
 
Example 3
Source File: AudioAndHapticFeedbackManager.java    From simple-keyboard with Apache License 2.0 6 votes vote down vote up
public void performAudioFeedback(final int code) {
    // if mAudioManager is null, we can't play a sound anyway, so return
    if (mAudioManager == null) {
        return;
    }
    if (!mSoundOn) {
        return;
    }
    final int sound;
    switch (code) {
    case Constants.CODE_DELETE:
        sound = AudioManager.FX_KEYPRESS_DELETE;
        break;
    case Constants.CODE_ENTER:
        sound = AudioManager.FX_KEYPRESS_RETURN;
        break;
    case Constants.CODE_SPACE:
        sound = AudioManager.FX_KEYPRESS_SPACEBAR;
        break;
    default:
        sound = AudioManager.FX_KEYPRESS_STANDARD;
        break;
    }
    mAudioManager.playSoundEffect(sound, mSettingsValues.mKeypressSoundVolume);
}
 
Example 4
Source File: AudioAndHapticFeedbackManager.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 6 votes vote down vote up
public void performAudioFeedback(final int code) {
    // if mAudioManager is null, we can't play a sound anyway, so return
    if (mAudioManager == null) {
        return;
    }
    if (!mSoundOn) {
        return;
    }
    final int sound;
    switch (code) {
    case Constants.CODE_DELETE:
        sound = AudioManager.FX_KEYPRESS_DELETE;
        break;
    case Constants.CODE_ENTER:
        sound = AudioManager.FX_KEYPRESS_RETURN;
        break;
    case Constants.CODE_SPACE:
        sound = AudioManager.FX_KEYPRESS_SPACEBAR;
        break;
    default:
        sound = AudioManager.FX_KEYPRESS_STANDARD;
        break;
    }
    mAudioManager.playSoundEffect(sound, mSettingsValues.mKeypressSoundVolume);
}
 
Example 5
Source File: LatinIME.java    From hackerskeyboard with Apache License 2.0 6 votes vote down vote up
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();
        }
    }
    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());
    }
}
 
Example 6
Source File: AudioAndHapticFeedbackManager.java    From Indic-Keyboard with Apache License 2.0 6 votes vote down vote up
public void performAudioFeedback(final int code) {
    // if mAudioManager is null, we can't play a sound anyway, so return
    if (mAudioManager == null) {
        return;
    }
    if (!mSoundOn) {
        return;
    }
    final int sound;
    switch (code) {
    case Constants.CODE_DELETE:
        sound = AudioManager.FX_KEYPRESS_DELETE;
        break;
    case Constants.CODE_ENTER:
        sound = AudioManager.FX_KEYPRESS_RETURN;
        break;
    case Constants.CODE_SPACE:
        sound = AudioManager.FX_KEYPRESS_SPACEBAR;
        break;
    default:
        sound = AudioManager.FX_KEYPRESS_STANDARD;
        break;
    }
    mAudioManager.playSoundEffect(sound, mSettingsValues.mKeypressSoundVolume);
}