1
0
Fork 0

Fix bug where bluetooth keyboards don't work in sounder. Fixes #6

This commit is contained in:
Eoin Mcloughlin 2022-04-17 11:59:28 +01:00
parent 94218f6705
commit f149ad805a
3 changed files with 14 additions and 3 deletions

View file

@ -10,8 +10,8 @@ android {
applicationId "es.eoinrul.ecwt"
minSdkVersion 23
targetSdkVersion 29
versionCode 41
versionName "4.1"
versionCode 42
versionName "4.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

View file

@ -33,6 +33,15 @@ class SounderActivity : AppCompatActivity() {
onTextEntered("E"); // Display and sound something - this is arbitrary
}
// This will be called for connected USB/Bluetooth keyboards:
override fun onKeyUp(keyCode: Int, event: KeyEvent): Boolean {
val sequence = KeycodeToSoundSequence(keyCode)
mTextViewTest?.text = SequenceToString(sequence)
mSoundPlayer?.enqueue(sequence)
mKeyboardInput?.setText("") // Should be empty due to physical keyboard
return true;
}
override fun onResume() {
super.onResume()
initSoundPlayer()
@ -69,7 +78,8 @@ class SounderActivity : AppCompatActivity() {
private var mSoundPlayer : DitDahSoundStream? = null;
// Utility to watch our EditText and handle any user input:
// Utility to watch our EditText and handle any user input
// This only seems to get triggered if we're using the software keyboard
private val mInputHandler = object : TextWatcher {
override fun afterTextChanged(s: Editable?) {
if(s == null) {

View file

@ -0,0 +1 @@
Fixed a bug where Bluetooth/USB keyboards wouldn't work in sounder mode.