File tree Expand file tree Collapse file tree 4 files changed +9
-9
lines changed
app/src/main/kotlin/com/algolia/instantsearch/voice/demo
ui/src/main/kotlin/com/algolia/instantsearch/voice/ui
voice/src/main/kotlin/com/algolia/instantsearch/voice Expand file tree Collapse file tree 4 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import kotlinx.android.synthetic.main.main.*
1010import kotlinx.android.synthetic.main.main.view.*
1111
1212
13- class MainActivity : AppCompatActivity (), VoiceSpeechRecognizer.Result {
13+ class MainActivity : AppCompatActivity (), VoiceSpeechRecognizer.ResultsListener {
1414
1515 private enum class Tag {
1616 Permission ,
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ class VoiceInputDialogFragment : DialogFragment() {
4040 super .onViewCreated(view, savedInstanceState)
4141 val androidView = VoiceAndroidView (voiceInput)
4242 val presenter = VoicePresenter (androidView) { result ->
43- (activity as ? VoiceSpeechRecognizer .Result )?.onResults(result.toTypedArray())
43+ (activity as ? VoiceSpeechRecognizer .ResultsListener )?.onResults(result.toTypedArray())
4444 dismiss()
4545 }
4646
@@ -53,7 +53,7 @@ class VoiceInputDialogFragment : DialogFragment() {
5353 })
5454 suggestions?.let (androidView::setSuggestions)
5555 speechRecognizer.setRecognitionListener(presenter)
56- speechRecognizer.listener = presenter
56+ speechRecognizer.stateListener = presenter
5757 }
5858
5959
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ class VoicePresenter(
1010 private val ui : VoiceUI ,
1111 private val onResults : (results: ArrayList <String >) -> Unit
1212) : RecognitionListener,
13- VoiceSpeechRecognizer .Listener {
13+ VoiceSpeechRecognizer .StateListener {
1414
1515 override fun onResults (results : Bundle ) {
1616 onResults(results.resultsRecognition)
Original file line number Diff line number Diff line change @@ -13,12 +13,12 @@ class VoiceSpeechRecognizer(
1313 private val language : String? = null
1414) {
1515
16- interface Listener {
16+ interface StateListener {
1717
1818 fun isListening (isListening : Boolean )
1919 }
2020
21- interface Result {
21+ interface ResultsListener {
2222
2323 fun onResults (results : Array <out String >)
2424 }
@@ -34,19 +34,19 @@ class VoiceSpeechRecognizer(
3434 }
3535 }
3636
37- var listener : Listener ? = null
37+ var stateListener : StateListener ? = null
3838
3939 fun setRecognitionListener (recognitionListener : RecognitionListener ) {
4040 speechRecognizer.setRecognitionListener(recognitionListener)
4141 }
4242
4343 fun start () {
44- listener ?.isListening(true )
44+ stateListener ?.isListening(true )
4545 speechRecognizer.startListening(intent)
4646 }
4747
4848 fun stop () {
49- listener ?.isListening(false )
49+ stateListener ?.isListening(false )
5050 speechRecognizer.stopListening()
5151 }
5252
You can’t perform that action at this time.
0 commit comments