Commit fecd368b by patpat

调整音量键按键

parent f2ebd2b5
......@@ -29,6 +29,7 @@ import com.bgycc.smartcanteen.task.ButtonTask
import com.bgycc.smartcanteen.task.QRCodeTask
import com.bgycc.smartcanteen.util.StringUtil
import com.blankj.utilcode.util.LogUtils
import com.blankj.utilcode.util.ToastUtils
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
......@@ -123,15 +124,16 @@ class MainActivity : BaseActivity() {
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
Log.i(TAG, "keyCode: $keyCode")
// ToastUtils.showLong("keyCode: $keyCode")
when(keyCode) {
KeyEvent.KEYCODE_DPAD_UP -> {
KeyEvent.KEYCODE_PAGE_UP -> {
mAudioManager!!.adjustStreamVolume(
AudioManager.STREAM_SYSTEM,
AudioManager.ADJUST_RAISE,
AudioManager.FLAG_SHOW_UI
)
}
KeyEvent.KEYCODE_DPAD_DOWN -> {
KeyEvent.KEYCODE_PAGE_DOWN -> {
mAudioManager!!.adjustStreamVolume(
AudioManager.STREAM_SYSTEM,
AudioManager.ADJUST_LOWER,
......
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