Merge pull request #401 from gavine99/fix-check-for-stt-available

fix bug in speech recogniser available check
This commit is contained in:
octoshrimpy
2025-04-02 09:01:29 -04:00
committed by GitHub
2 changed files with 8 additions and 4 deletions
@@ -275,6 +275,9 @@
<intent> <intent>
<action android:name="android.intent.action.TTS_SERVICE" /> <action android:name="android.intent.action.TTS_SERVICE" />
</intent> </intent>
<intent>
<action android:name="android.speech.RecognitionService" />
</intent>
</queries> </queries>
</manifest> </manifest>
@@ -566,11 +566,12 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
if (state.scheduling) if (state.scheduling)
scheduleAction.onNext(true) scheduleAction.onNext(true)
if (prefs.showStt.get()) { // if stt is available and preference is set to show stt button
if (isSpeechRecognitionAvailable() && prefs.showStt.get()) {
speechToTextFrame.isVisible = true speechToTextFrame.isVisible = true
var xPercent = prefs.showSttOffsetX.get() val xPercent = prefs.showSttOffsetX.get()
var yPercent = prefs.showSttOffsetY.get() val yPercent = prefs.showSttOffsetY.get()
// if the stt icon has a custom position, move it // if the stt icon has a custom position, move it
if ((xPercent != Float.MAX_VALUE) && (yPercent != Float.MAX_VALUE)) { if ((xPercent != Float.MAX_VALUE) && (yPercent != Float.MAX_VALUE)) {
@@ -676,7 +677,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
} }
override fun startSpeechRecognition() { override fun startSpeechRecognition() {
if (!isSpeechRecognitionAvailable()) { if (isSpeechRecognitionAvailable()) {
val intent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH).apply { val intent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH).apply {
putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM) putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM)
} }