Skip to content

Commit

Permalink
chore: Provide default isGamepadsInputDevice implementation in plugin…
Browse files Browse the repository at this point in the history
…. Removed from integration example in README.
  • Loading branch information
markvideon committed Jun 16, 2024
1 parent 7812811 commit d48e9a6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,6 @@ class MainActivity: FlutterActivity(), GamepadsCompatibleActivity {
return keyListener?.invoke(keyEvent) ?: false
}
override fun isGamepadsInputDevice(device: InputDevice): Boolean {
return device.sources and InputDevice.SOURCE_GAMEPAD == InputDevice.SOURCE_GAMEPAD
|| device.sources and InputDevice.SOURCE_JOYSTICK == InputDevice.SOURCE_JOYSTICK
}
override fun registerInputDeviceListener(
listener: InputManager.InputDeviceListener, handler: Handler?) {
val inputManager = getSystemService(INPUT_SERVICE) as InputManager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ import android.os.Handler
import android.view.InputDevice
import android.view.KeyEvent
import android.view.MotionEvent

interface GamepadsCompatibleActivity {
fun isGamepadsInputDevice(device: InputDevice): Boolean
fun isGamepadsInputDevice(device: InputDevice): Boolean {
return device.sources and InputDevice.SOURCE_GAMEPAD == InputDevice.SOURCE_GAMEPAD
|| device.sources and InputDevice.SOURCE_JOYSTICK == InputDevice.SOURCE_JOYSTICK
}

fun registerInputDeviceListener(listener: InputManager.InputDeviceListener, handler: Handler?)
fun registerKeyEventHandler(handler: (KeyEvent) -> Boolean)
fun registerMotionEventHandler(handler: (MotionEvent) -> Boolean)
Expand Down

0 comments on commit d48e9a6

Please sign in to comment.