本文整理汇总了Java中android.media.AudioManager.VIBRATE_SETTING_ONLY_SILENT属性的典型用法代码示例。如果您正苦于以下问题:Java AudioManager.VIBRATE_SETTING_ONLY_SILENT属性的具体用法?Java AudioManager.VIBRATE_SETTING_ONLY_SILENT怎么用?Java AudioManager.VIBRATE_SETTING_ONLY_SILENT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.media.AudioManager
的用法示例。
在下文中一共展示了AudioManager.VIBRATE_SETTING_ONLY_SILENT属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onItemClick
public void onItemClick(AdapterView<?> arg0, View arg1, int index, long arg3) {
AudioManager manager = (AudioManager) mActivity.getSystemService(Context.AUDIO_SERVICE);
if (manager != null) {
int ringerMode = AudioManager.RINGER_MODE_NORMAL;
int vibroMode = AudioManager.VIBRATE_SETTING_ON;
switch(index) {
case 0: // silent
ringerMode = AudioManager.RINGER_MODE_SILENT;
vibroMode = AudioManager.VIBRATE_SETTING_ONLY_SILENT;
break;
case 1: // vibro
ringerMode = AudioManager.RINGER_MODE_VIBRATE;
vibroMode = AudioManager.VIBRATE_SETTING_ON;
break;
case 2: // sound
ringerMode = AudioManager.RINGER_MODE_NORMAL;
vibroMode = AudioManager.VIBRATE_SETTING_OFF;
break;
case 3: // sound and vibro
ringerMode = AudioManager.RINGER_MODE_NORMAL;
vibroMode = AudioManager.VIBRATE_SETTING_ON;
break;
}
// update manager modes
// update
manager.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, vibroMode);
manager.setVibrateSetting(AudioManager.VIBRATE_TYPE_NOTIFICATION, vibroMode);
manager.setRingerMode(ringerMode);
validateState(manager);
}
mDialog.hide();
}