From b87c75d607956393ad3b07751eb59ccf41726863 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Wed, 11 Oct 2017 14:17:27 -0400 Subject: fix/misc (#81) * Remove jvmstatic, fixes #68 * Create HO logging * Remove double null boolean notation * Replace multi if else with when * Ignore case in setSpan, closes #82 --- .../src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'searchview/src') 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 75d9b27..29341af 100644 --- a/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt +++ b/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt @@ -34,8 +34,8 @@ class SearchItem(val key: String, ) { companion object { - @JvmStatic var foregroundColor: Int = 0xdd000000.toInt() - @JvmStatic var backgroundColor: Int = 0xfffafafa.toInt() + var foregroundColor: Int = 0xdd000000.toInt() + var backgroundColor: Int = 0xfffafafa.toInt() } var styledContent: SpannableStringBuilder? = null @@ -44,7 +44,7 @@ class SearchItem(val key: String, * Highlight the subText if it is present in the content */ fun withHighlights(subText: String) { - val index = content.indexOf(subText) + val index = content.indexOf(subText, ignoreCase = true) if (index == -1) return styledContent = SpannableStringBuilder(content) styledContent!!.setSpan(StyleSpan(Typeface.BOLD), index, index + subText.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE) @@ -60,7 +60,7 @@ class SearchItem(val key: String, holder.container.setRippleBackground(foregroundColor, backgroundColor) holder.title.text = styledContent ?: content - if (description?.isNotBlank() ?: false) holder.desc.visible().text = description + if (description?.isNotBlank() == true) holder.desc.visible().text = description } override fun unbindView(holder: ViewHolder) { -- cgit v1.2.3