Skip to content

Commit 8accce4

Browse files
fix: speech to text button on chat activity not working #2469
1 parent 388d20b commit 8accce4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

app/src/main/java/org/fossasia/susi/ai/chat/STTfragment.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ class STTFragment : Fragment() {
112112
speechProgress.onResultOrOnError()
113113
val thisActivity = activity
114114
if (thisActivity is ChatActivity) thisActivity.setText(voiceResults[0])
115+
<<<<<<< HEAD
115116
recognizer.destroy()
116117
if ((activity as ChatActivity).recordingThread != null) {
117118
chatPresenter.startHotwordDetection()
@@ -121,6 +122,9 @@ class STTFragment : Fragment() {
121122
activity?.voiceSearchChat?.show()
122123
activity?.btnSpeak?.isEnabled = true
123124
activity?.supportFragmentManager?.popBackStackImmediate()
125+
=======
126+
restoreActivityState()
127+
>>>>>>> deda0fa7... fix: speech to text button on chat activity not working #2469
124128
}
125129

126130
override fun onReadyForSpeech(params: Bundle) {
@@ -169,6 +173,18 @@ class STTFragment : Fragment() {
169173
recognizer.setRecognitionListener(listener)
170174
recognizer.startListening(intent)
171175
}
176+
177+
private fun restoreActivityState() {
178+
recognizer?.destroy()
179+
if ((activity as ChatActivity).recordingThread != null) {
180+
chatPresenter.startHotwordDetection()
181+
}
182+
(activity as ChatActivity).fabsetting.show()
183+
activity?.searchChat?.show()
184+
activity?.voiceSearchChat?.show()
185+
activity?.btnSpeak?.isEnabled = true
186+
activity?.supportFragmentManager?.popBackStackImmediate()
187+
}
172188

173189
override fun onPause() {
174190
super.onPause()

0 commit comments

Comments
 (0)