Skip to content

Commit

Permalink
Merge Volume Control lib into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Codel1417 committed Feb 20, 2024
1 parent 6bfdc4f commit 79d1e6e
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions android/app/src/main/kotlin/com/codel1417/tail_app/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
package com.codel1417.tail_app

import dev.darttools.flutter_android_volume_keydown.FlutterAndroidVolumeKeydownActivity;
import android.view.KeyEvent
import android.view.KeyEvent.KEYCODE_VOLUME_DOWN
import android.view.KeyEvent.KEYCODE_VOLUME_UP
import dev.darttools.flutter_android_volume_keydown.FlutterAndroidVolumeKeydownPlugin.eventSink
import io.flutter.embedding.android.FlutterActivity

class MainActivity :
FlutterAndroidVolumeKeydownActivity() { //Hopefully this doesn't cause problems later

class MainActivity : FlutterActivity() {
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
if (keyCode == KEYCODE_VOLUME_DOWN && eventSink != null) {
eventSink.success(true)
return true
}
if (keyCode == KEYCODE_VOLUME_UP && eventSink != null) {
eventSink.success(false)
return true
}
return super.onKeyDown(keyCode, event)
}
}

0 comments on commit 79d1e6e

Please sign in to comment.