Commit f3e363a8 by pye52

适配天波机器的按键调节音量(目前发现无法弹出音量调节框)

parent 7431b771
...@@ -415,16 +415,18 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe ...@@ -415,16 +415,18 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
LogUtils.i(TAG, "按键KeyCode: " + keyCode); LogUtils.i(TAG, "按键KeyCode: " + keyCode);
switch (keyCode) { switch (keyCode) {
case KeyEvent.KEYCODE_PAGE_UP: case KeyEvent.KEYCODE_PAGE_UP:
case KeyEvent.KEYCODE_NUMPAD_ADD:
audioManager.adjustStreamVolume( audioManager.adjustStreamVolume(
AudioManager.STREAM_SYSTEM, AudioManager.STREAM_SYSTEM,
AudioManager.ADJUST_RAISE, AudioManager.ADJUST_RAISE,
AudioManager.FLAG_SHOW_UI); AudioManager.FLAG_PLAY_SOUND | AudioManager.FLAG_SHOW_UI);
break; break;
case KeyEvent.KEYCODE_PAGE_DOWN: case KeyEvent.KEYCODE_PAGE_DOWN:
case KeyEvent.KEYCODE_NUMPAD_SUBTRACT:
audioManager.adjustStreamVolume( audioManager.adjustStreamVolume(
AudioManager.STREAM_SYSTEM, AudioManager.STREAM_SYSTEM,
AudioManager.ADJUST_LOWER, AudioManager.ADJUST_LOWER,
AudioManager.FLAG_SHOW_UI); AudioManager.FLAG_PLAY_SOUND | AudioManager.FLAG_SHOW_UI);
break; break;
} }
return super.onKeyDown(keyCode, event); return super.onKeyDown(keyCode, event);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment