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