Conversation
-Integrate SpeechRecognizer(callback) in JetPackCompose (using flows)
…nto feature/bt/speech_recognition
mobile/src/main/java/ch/epfl/sdp/mobile/ui/speech_recognition/SpeechRecognizer.kt
Outdated
Show resolved
Hide resolved
I try on my phone, it seems not working, maybe I miss something ?
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great start ! Imho it would be interesting to see how much of the permission logic could be extracted to a dedicated state / ViewModel, which will help us test the feature more efficiently.
Also, I'd be interested in knowing if there's a way for the app to continuously listen for voice recognition results (maybe using the partial results like in https://gist.github.com/alexandrepiveteau/b35785ea527f6c5cb46abe47fc2c5ab9 ?).
mobile/src/main/java/ch/epfl/sdp/mobile/ui/speech_recognition/SpeechRecognitionScreen.kt
Outdated
Show resolved
Hide resolved
mobile/src/main/java/ch/epfl/sdp/mobile/ui/speech_recognition/SpeechRecognitionScreen.kt
Outdated
Show resolved
Hide resolved
mobile/src/main/java/ch/epfl/sdp/mobile/ui/speech_recognition/SpeechRecognitionScreen.kt
Outdated
Show resolved
Hide resolved
mobile/src/main/java/ch/epfl/sdp/mobile/ui/speech_recognition/SpeechRecognitionScreen.kt
Outdated
Show resolved
Hide resolved
@alexandrepiveteau Yes there is a way to setup a |
- Delete unused class - Rename dependency in toml - Add comment about route - Refactor to MaxResultsCount - use rememberCoroutineScope
@KurohanaJuri, it was working fine on my phone. Would you try with this new version of the code ? Let me know if it's buggy or no results show up. |
I also noticed something odd with the recognizer : One have to start talking right away or just a few (2 or 3) seconds after clicking the button, otherwise, the recognizer don't halt and one has to deactivate and reactivate the mic again. |
mobile/src/main/java/ch/epfl/sdp/mobile/ui/speech_recognition/SpeechRecognitionScreen.kt
Outdated
Show resolved
Hide resolved
mobile/src/main/java/ch/epfl/sdp/mobile/ui/speech_recognition/SpeechRecognitionScreen.kt
Outdated
Show resolved
Hide resolved
…nto feature/bt/speech_recognition
…nto feature/bt/speech_recognition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor things, the rest looks good to me!
...le/src/androidTest/java/ch/epfl/sdp/mobile/test/state/StatefulSpeechRecognitionScreenTest.kt
Outdated
Show resolved
Hide resolved
mobile/src/main/java/ch/epfl/sdp/mobile/ui/speech_recognition/SpeechRecognitionScreen.kt
Outdated
Show resolved
Hide resolved
Code Climate has analyzed commit 2246da6 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 79.3% (80% is the threshold). This pull request will bring the total coverage in the repository to 96.2% (-0.5% change). View more on Code Climate. |
(now included in #301) |
This PR is more of a proof of concept for android speech recognition library with JetPack Compose.
Some key features
Ask for persmission if not already granted by the user to use the mic
Instanciate SpeechRecognizer (as Intent) and listen for results (event based/callback) when user hit mic icon.
Use cancellableCourotine to execute start listening with SpeechRecognizer.