Skip to content

Commit d67f5de

Browse files
committed
fix: internal views references
1 parent 9249a2f commit d67f5de

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ dependencies {
3232
implementation dependency_android.design
3333
implementation dependency_android.constraint_layout
3434

35-
implementation dependency_android.voice
35+
implementation project(":voice")
3636

3737
androidTestImplementation dependency_android.junit
3838
androidTestImplementation dependency_android.test_rules

voice/src/main/kotlin/com/algolia/instantsearch/voice/ui/VoiceAndroidView.kt

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package com.algolia.instantsearch.voice.ui
22

3-
import androidx.constraintlayout.widget.ConstraintLayout
4-
import androidx.core.text.HtmlCompat
53
import android.view.View
64
import android.widget.ImageView
75
import android.widget.TextView
6+
import androidx.constraintlayout.widget.ConstraintLayout
7+
import androidx.core.text.HtmlCompat
88
import com.algolia.instantsearch.voice.R
99

1010
class 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

Comments
 (0)