-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
feat: Voice search implemented on skills listing #2202
feat: Voice search implemented on skills listing #2202
Conversation
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault()) | ||
|
||
if (intent.resolveActivity(packageManager) != null) { | ||
startActivityForResult(intent, 10)//Sends the detected query to search |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Declare 10
as constant.
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { | ||
super.onActivityResult(requestCode, resultCode, data) | ||
when (requestCode) { | ||
10 -> if (resultCode == Activity.RESULT_OK && data != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You declared it as constant, and still using directly.
@@ -92,4 +92,7 @@ object Constant { | |||
|
|||
//Visit Website Url | |||
const val SUSI_VISIT_WEBSITE = "https://chat.susi.ai/" | |||
|
|||
//Voice search request code | |||
const val VOICE_SEARCH_REQUEST_CODE = 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make it a local constant
The build is failing✨ Good work on this PR so far! ✨ Unfortunately, the Circle CI build is failing as of 64ddcda. Here's the output:
|
The build is failing✨ Good work on this PR so far! ✨ Unfortunately, the Circle CI build is failing as of 7a0f279. Here's the output:
|
@iamareebjamal please review it |
…into atm_skill_voice_search
@iamareebjamal please review it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reset lgtm
super.onActivityResult(requestCode, resultCode, data) | ||
when (requestCode) { | ||
VOICE_SEARCH_REQUEST_CODE -> if (resultCode == Activity.RESULT_OK && data != null) { | ||
val result = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When and if statements can be combined
@iamareebjamal @liveHarshit please review it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reset LGTM
|
||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { | ||
super.onActivityResult(requestCode, resultCode, data) | ||
if ((requestCode == VOICE_SEARCH_REQUEST_CODE) && (resultCode == Activity.RESULT_OK) && data != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove extra parentheses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do check now.
Fixes #2082
Changes:
Added voice search icon in action bar, clicking on which prompts voice search.
Screenshots for the change:
![ezgif com-video-to-gif](https://user-images.githubusercontent.com/43731599/57729034-da493d80-76b2-11e9-8cc8-24b66480b9b6.gif)