File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
voice/src/main/kotlin/com/algolia/instantsearch/voice/ui Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 11package com.algolia.instantsearch.voice.ui
22
3+ import android.os.Build
34import android.os.Bundle
4- import androidx.constraintlayout.widget.ConstraintLayout
5- import androidx.fragment.app.DialogFragment
65import android.view.LayoutInflater
76import android.view.View
87import android.view.ViewGroup
8+ import androidx.constraintlayout.widget.ConstraintLayout
9+ import androidx.fragment.app.DialogFragment
910import com.algolia.instantsearch.voice.R
1011import com.algolia.instantsearch.voice.VoiceSpeechRecognizer
1112
@@ -73,7 +74,12 @@ class VoiceInputDialogFragment : DialogFragment() {
7374 androidView.setOnClickListenerClose { dismiss() }
7475 androidView.setOnClickMicrophoneListener {
7576 when (androidView.getMicrophoneState()) {
76- VoiceMicrophone .State .Activated -> speechRecognizer.stop()
77+ VoiceMicrophone .State .Activated -> {
78+ // Disabling stop listening button for Android > 8.
79+ // `SpeechRecognizer.stopListening()` is not behaving as expected.
80+ // @see: https://issuetracker.google.com/issues/158198432
81+ if (Build .VERSION .SDK_INT <= Build .VERSION_CODES .P ) speechRecognizer.stop()
82+ }
7783 VoiceMicrophone .State .Deactivated -> speechRecognizer.start()
7884 }
7985 }
You can’t perform that action at this time.
0 commit comments