File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed
app/src/main/java/org/fossasia/susi/ai/chat Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -113,14 +113,7 @@ class STTFragment : Fragment() {
113113 val thisActivity = activity
114114 if (thisActivity is ChatActivity ) thisActivity.setText(voiceResults[0 ])
115115 recognizer.destroy()
116- if ((activity as ChatActivity ).recordingThread != null ) {
117- chatPresenter.startHotwordDetection()
118- }
119- (activity as ChatActivity ).fabsetting.show()
120- activity?.searchChat?.show()
121- activity?.voiceSearchChat?.show()
122- activity?.btnSpeak?.isEnabled = true
123- activity?.supportFragmentManager?.popBackStackImmediate()
116+ restoreActivityState()
124117 }
125118
126119 override fun onReadyForSpeech (params : Bundle ) {
@@ -170,6 +163,18 @@ class STTFragment : Fragment() {
170163 recognizer.startListening(intent)
171164 }
172165
166+ private fun restoreActivityState () {
167+ if ((activity as ChatActivity ).recordingThread != null ) {
168+ chatPresenter.startHotwordDetection()
169+ }
170+ (activity as ChatActivity ).fabsetting.show()
171+ activity?.searchChat?.show()
172+ activity?.voiceSearchChat?.show()
173+ activity?.btnSpeak?.isEnabled = true
174+ activity?.supportFragmentManager?.popBackStackImmediate()
175+ recognizer?.destroy()
176+ }
177+
173178 override fun onPause () {
174179 super .onPause()
175180 if (thisActivity is ChatActivity ) {
You can’t perform that action at this time.
0 commit comments