aboutsummaryrefslogtreecommitdiff
path: root/searchview/src/main/kotlin
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-10-11 14:17:27 -0400
committerGitHub <noreply@github.com>2017-10-11 14:17:27 -0400
commitb87c75d607956393ad3b07751eb59ccf41726863 (patch)
tree28d580e11e1befcc3895f46f52b03966f0f922ec /searchview/src/main/kotlin
parentff597a7ef456fcb37160fa7a46b45296098ca413 (diff)
downloadkau-b87c75d607956393ad3b07751eb59ccf41726863.tar.gz
kau-b87c75d607956393ad3b07751eb59ccf41726863.tar.bz2
kau-b87c75d607956393ad3b07751eb59ccf41726863.zip
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
Diffstat (limited to 'searchview/src/main/kotlin')
-rw-r--r--searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt8
1 files changed, 4 insertions, 4 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 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) {