11package com.algolia.instantsearch.voice.ui
22
3- import androidx.constraintlayout.widget.ConstraintLayout
4- import androidx.core.text.HtmlCompat
53import android.view.View
64import android.widget.ImageView
75import android.widget.TextView
6+ import androidx.constraintlayout.widget.ConstraintLayout
7+ import androidx.core.text.HtmlCompat
88import com.algolia.instantsearch.voice.R
99
1010class VoiceAndroidView (
@@ -13,20 +13,16 @@ class VoiceAndroidView(
1313
1414 private val context = view.context
1515 private val voiceInput: ConstraintLayout get() = view.findViewById(R .id.voiceInput)
16- private val suggestionsView: TextView ? get() = view.findViewById(R .id.voiceInput)
1716 private val View .close: ImageView get() = findViewById(R .id.close)
1817 private val View .microphone: VoiceMicrophone get() = findViewById(R .id.microphone)
19- private val View .title: TextView get() = findViewById(R .id.microphone )
18+ private val View .title: TextView get() = findViewById(R .id.title )
2019 private val View .subtitle: TextView get() = findViewById(R .id.subtitle)
2120 private val View .suggestions: TextView ? get() = findViewById(R .id.suggestions)
2221 private val View .hint: TextView get() = findViewById(R .id.hint)
2322 private val View .ripple: RippleView get() = findViewById(R .id.ripple)
2423
2524 override val formatterSuggestion = { suggestion: String ->
26- context.getString(
27- R .string.format_voice_suggestion_html,
28- suggestion
29- )
25+ context.getString(R .string.format_voice_suggestion_html, suggestion)
3026 }
3127
3228 override fun setOnClickListenerClose (onClickListener : View .OnClickListener ) {
@@ -38,10 +34,10 @@ class VoiceAndroidView(
3834 }
3935
4036 override fun setSuggestions (suggestions : Array <out String >) {
41- suggestionsView ?.let {
37+ voiceInput.suggestions ?.let { textView ->
4238 val formattedSuggestions = suggestions.joinToString(" " ) { formatterSuggestion(it) }
4339 val html = HtmlCompat .fromHtml(formattedSuggestions, HtmlCompat .FROM_HTML_MODE_LEGACY )
44- it .text = html
40+ textView .text = html
4541 }
4642 }
4743
0 commit comments