diff options
Diffstat (limited to 'searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt')
-rw-r--r-- | searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt b/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt index 4175fd5..a3dc7f4 100644 --- a/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt +++ b/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt @@ -38,12 +38,13 @@ class SearchItem(val key: String, var backgroundColor: Int = 0xfffafafa.toInt() } - var styledContent: SpannableStringBuilder? = null + private var styledContent: SpannableStringBuilder? = null /** * Highlight the subText if it is present in the content */ - fun withHighlights(subText: String) { + internal fun withHighlights(subText: String?) { + subText ?: return val index = content.indexOf(subText, ignoreCase = true) if (index == -1) return styledContent = SpannableStringBuilder(content) |