当前位置: 首页>>代码示例>>Java>>正文


Java AudioManager.FX_KEYPRESS_DELETE属性代码示例

本文整理汇总了Java中android.media.AudioManager.FX_KEYPRESS_DELETE属性的典型用法代码示例。如果您正苦于以下问题:Java AudioManager.FX_KEYPRESS_DELETE属性的具体用法?Java AudioManager.FX_KEYPRESS_DELETE怎么用?Java AudioManager.FX_KEYPRESS_DELETE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.media.AudioManager的用法示例。


在下文中一共展示了AudioManager.FX_KEYPRESS_DELETE属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: playKeyClick

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 KEYCODE_ENTER:
                sound = AudioManager.FX_KEYPRESS_RETURN;
                break;
            case KEYCODE_SPACE:
                sound = AudioManager.FX_KEYPRESS_SPACEBAR;
                break;
        }
        mAudioManager.playSoundEffect(sound, FX_VOLUME);
    }
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:26,代码来源:KP2AKeyboard.java

示例2: performAudioFeedback

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);
}
 
开发者ID:rkkr,项目名称:simple-keyboard,代码行数:25,代码来源:AudioAndHapticFeedbackManager.java


注:本文中的android.media.AudioManager.FX_KEYPRESS_DELETE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。