Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Speech to text button on chat activity not working #2469 #2486

Open
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

shubhamkumar1739
Copy link

@shubhamkumar1739 shubhamkumar1739 commented Feb 7, 2020

Fixes #2469 Speech to text button on chat activity not working

Changes: add functions to make view visible

Screenshots :
ezgif com-video-to-gif(3)

@ci-reporter
Copy link

ci-reporter bot commented Feb 7, 2020

The build is failing

✨ Good work on this PR so far! ✨ Unfortunately, the Circle CI build is failing as of 90334f2. Here's the output:

spotless check
> Task :spotlessCheck UP-TO-DATE

I'm sure you can fix it! If you need help, don't hesitate to ask a maintainer of the project!


Failed build for 90334f2
spotless check
> Task :spotlessCheck UP-TO-DATE
Failed build for 8accce4
lint check
> Task :app:preBuild UP-TO-DATE
Failed build for 8accce4
lint check
> Task :app:preBuild UP-TO-DATE
Failed build for a146cb5
spotless check
> Task :spotlessCheck UP-TO-DATE
Failed build for a146cb5
spotless check
> Task :spotlessCheck UP-TO-DATE

This comment was automagically generated by ci-reporter. If you see a problem, open an issue here.

@pallav12
Copy link
Contributor

@shubhamkumar1739 problem is bit bigger than just working of speech to text button. Notice the SearchTextView in issue gif also the icons on top are gone. Simple null check in onError of STTFragment of activity can fix the working of speech to text.

@shubhamkumar1739
Copy link
Author

Yes but I have also fixed the problem which caused the icons to disappear.

There was also another error that was occurring : you weren't able to chat with SUSI after you got stuck into this state. I have fixed that as well

@pallav12
Copy link
Contributor

Can you try adding a simple null check in onError rather then creating restoreActivityState()
Because it not only fix both the issues you mentioned but also fix another crash issue ie start STTFragment and close it instantaneously, do this three times and app will crash.
Change onError to

  if(activity!=null) {
                    Toast.makeText(activity?.applicationContext, "Could not recognize speech, try again.", Toast.LENGTH_SHORT).show()
                    speechProgress?.onResultOrOnError()
                    recognizer.destroy()
                    activity?.fabsetting?.show()
                    activity?.searchChat?.show()
                    activity?.voiceSearchChat?.show()
                    activity?.btnSpeak?.isEnabled = true
                    activity?.supportFragmentManager?.popBackStackImmediate()
                }

Just give it a try...

@shubhamkumar1739
Copy link
Author

Actually adding null check on onError didn't work. But i realised i had missed some implementations. So i pushed the changes again.

@shubhamkumar1739
Copy link
Author

Please look at it now. I dont think the app will crash now.

@pallav12
Copy link
Contributor

pallav12 commented Feb 15, 2020

It is...
Screenshot (12)

gif

@shubhamkumar1739
Copy link
Author

What I was saying that applying null check in onError didn't fix the "invisible view" issue. This crash issue isn't occurring on my device as well as other devices that I tested on. But I will apply the null check nonetheless :)

@pallav12
Copy link
Contributor

pallav12 commented Feb 15, 2020

No don't... Im not a mentor, it's just a suggestion... Btw my device is oppo a3s, it fixed the crash issue

@shubhamkumar1739
Copy link
Author

Since the problem is occurring frequently, it's better to fix it. You don't have to be a mentor to help. Thanks a lot.

    Add restoreActivityState() in STTFragment to make invisible views visible and perform other tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Speech to text button on chat activity not working
2 participants