Skip to content

Commit 4900f1a

Browse files
committed
refact: replace deprecated html api
1 parent e179d6b commit 4900f1a

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

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

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

3-
import android.os.Build
43
import android.support.constraint.ConstraintLayout
5-
import android.text.Html
4+
import android.support.v4.text.HtmlCompat
65
import android.view.View
76
import android.widget.ImageView
87
import android.widget.TextView
@@ -41,11 +40,7 @@ class VoiceAndroidView(
4140
override fun setSuggestions(suggestions: Array<out String>) {
4241
suggestionsView?.let {
4342
val formattedSuggestions = suggestions.joinToString("") { formatterSuggestion(it) }
44-
val html = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
45-
Html.fromHtml(formattedSuggestions, Html.FROM_HTML_MODE_LEGACY)
46-
} else {
47-
Html.fromHtml(formattedSuggestions)
48-
}
43+
val html = HtmlCompat.fromHtml(formattedSuggestions, HtmlCompat.FROM_HTML_MODE_LEGACY)
4944
it.text = html
5045
}
5146
}

0 commit comments

Comments
 (0)