Skip to content

Commit 159f30e

Browse files
fix: speech to text button on chat activity not working #2469
Add function restoreActivityState() in STTFragment.kt to make invisible views visible and perform other tasks
1 parent 49800b5 commit 159f30e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,4 +639,8 @@ class ChatActivity : AppCompatActivity(), IChatView {
639639
companion object {
640640
val ALARM = "ALARM"
641641
}
642+
643+
fun setChatSearchInputGone() {
644+
chatSearchInput.visibility = View.GONE
645+
}
642646
}

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ class STTFragment : Fragment() {
113113
val thisActivity = activity
114114
if (thisActivity is ChatActivity) thisActivity.setText(voiceResults[0])
115115
recognizer.destroy()
116+
activity?.supportFragmentManager?.popBackStackImmediate()
116117
restoreActivityState()
117118
}
118119

@@ -171,7 +172,7 @@ class STTFragment : Fragment() {
171172
activity?.searchChat?.show()
172173
activity?.voiceSearchChat?.show()
173174
activity?.btnSpeak?.isEnabled = true
174-
activity?.supportFragmentManager?.popBackStackImmediate()
175+
(activity as ChatActivity)?.setChatSearchInputGone()
175176
recognizer?.destroy()
176177
}
177178

@@ -190,6 +191,8 @@ class STTFragment : Fragment() {
190191

191192
override fun onDestroyView() {
192193
super.onDestroyView()
194+
restoreActivityState()
195+
activity?.supportFragmentManager?.popBackStack()
193196
mainHandler.removeCallbacks(runnable)
194197
subHandler.removeCallbacks(delayRunnable)
195198
}

0 commit comments

Comments
 (0)