均使用 SeekBar 进行拖拽测试
涉及到的权限包括:
arg1 为 SeekBar onProgressChanged 中progress
1.屏幕亮度调整
WindowManager.LayoutParams win = getWindow().getAttributes();
win.screenBrightness=(float)arg1/255;
getWindow().setAttributes(win);
2. 声音调整
1). 系统音量 AudioManager.STREAM_SYSTEM
2).通话音量 AudioManager.STREAM_VOICE_CALL
3).铃声音量 AudioManager.STREAM_RING
4).提示声音音量 AudioManager.STREAM_ALARM
5).多媒体音量 AudioManager.STREAM_MUSIC
AudioManager audio = (AudioManager) getSystemService(Service.AUDIO_SERVICE);
int current;
current = audio.getStreamVolume(AudioManager.STREAM_MUSIC); //获取当前值
if(arg1
audio.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_LOWER,AudioManager.FLAG_PLAY_SOUND | AudioManager.FLAG_SHOW_UI);
}
else{
audio.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE, AudioManager.FLAG_PLAY_SOUND | AudioManager.FLAG_SHOW_UI);
}