-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
committed
Nov 14, 2024
1 parent
076509d
commit fa85799
Showing
11 changed files
with
124 additions
and
236 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
33 changes: 1 addition & 32 deletions
33
package/general/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,6 @@ | ||
package com.example.example | ||
|
||
import android.hardware.input.InputManager | ||
import android.os.Handler | ||
import android.view.InputDevice | ||
import android.view.KeyEvent | ||
import android.view.MotionEvent | ||
import io.flutter.embedding.android.FlutterActivity | ||
import org.flame_engine.gamepads_android.GamepadsCompatibleActivity | ||
import io.flutter.embedding.android.FlutterFragmentActivity | ||
|
||
class MainActivity: FlutterFragmentActivity(), GamepadsCompatibleActivity { | ||
var keyListener: ((KeyEvent) -> Boolean)? = null | ||
var motionListener: ((MotionEvent) -> Boolean)? = null | ||
|
||
override fun dispatchGenericMotionEvent(motionEvent: MotionEvent): Boolean { | ||
return motionListener?.invoke(motionEvent) ?: false | ||
} | ||
|
||
override fun dispatchKeyEvent(keyEvent: KeyEvent): Boolean { | ||
return keyListener?.invoke(keyEvent) ?: false | ||
} | ||
|
||
override fun registerInputDeviceListener( | ||
listener: InputManager.InputDeviceListener, handler: Handler?) { | ||
val inputManager = getSystemService(INPUT_SERVICE) as InputManager | ||
inputManager.registerInputDeviceListener(listener, null) | ||
} | ||
|
||
override fun registerKeyEventHandler(handler: (KeyEvent) -> Boolean) { | ||
keyListener = handler | ||
} | ||
|
||
override fun registerMotionEventHandler(handler: (MotionEvent) -> Boolean) { | ||
motionListener = handler | ||
} | ||
class MainActivity: FlutterFragmentActivity() { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
# | ||
|
||
list(APPEND FLUTTER_PLUGIN_LIST | ||
gamepads_linux | ||
media_kit_video | ||
sim_card_info | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.