Fixed speech-to-text search
This commit is contained in:
parent
d3597d123d
commit
b0b552a060
1 changed files with 11 additions and 0 deletions
|
@ -14,6 +14,7 @@
|
||||||
*/
|
*/
|
||||||
package code.name.monkey.retromusic.fragments.search
|
package code.name.monkey.retromusic.fragments.search
|
||||||
|
|
||||||
|
import android.app.Activity.RESULT_OK
|
||||||
import android.content.ActivityNotFoundException
|
import android.content.ActivityNotFoundException
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.res.ColorStateList
|
import android.content.res.ColorStateList
|
||||||
|
@ -221,6 +222,16 @@ class SearchFragment : AbsMainActivityFragment(R.layout.fragment_search), TextWa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data)
|
||||||
|
if (resultCode == RESULT_OK) {
|
||||||
|
val spokenText: String? =
|
||||||
|
data?.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS)
|
||||||
|
.let { text -> text?.get(0) }
|
||||||
|
binding.searchView.setText(spokenText)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onDestroyView() {
|
override fun onDestroyView() {
|
||||||
hideKeyboard(view)
|
hideKeyboard(view)
|
||||||
super.onDestroyView()
|
super.onDestroyView()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue