gazlaws-dev / codeboard

Codeboard App
Other
566 stars 116 forks source link

Adding Sound on keypress #24

Closed jeff-hykin closed 6 years ago

jeff-hykin commented 7 years ago

I have experience programming in general but non specific to Android development. I'm not certain these changes are bulletproof, But I wanted to make progress on adding keypress sound rather than just asking for the feature. I created the check box for keypress sound in settings, and by default sound is on. This is because I used the vibration setting as a template.

In the event that the code doesn't work, or is slow, or the sound plays continuously in a loop, I'd greatly appreciate help in getting it working properly. I'm not quite sure how to package everything up into one apk.

The keypress sound is the default android sound "Effect_Tick.ogg", and its the same sound for backspace, spacebar, regular keys which is not optimal, but it shouldn't be difficult to change after the sound itself is working. I didn't specifically make the sound call asynchronous, so pressing keys rapidly will probably cut off the sound from the previous key.

ayushman1024 commented 6 years ago

i love it

gazlaws-dev commented 6 years ago

This is great, thanks! I'll roll these changes out and see if I get any crashes, but for now it looks good

gazlaws-dev commented 6 years ago

Keyboard was crashing since we keep creating MediaPlayers but never release the memory. Fixed using this answer (https://stackoverflow.com/a/16097234)