Skip to content

Commit

Permalink
Fix filter not ignoring case
Browse files Browse the repository at this point in the history
  • Loading branch information
udenr committed Sep 13, 2024
1 parent d222064 commit bc42940
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,16 @@ class MainActivityViewModel(application: Application) : AndroidViewModel(applica
private fun Flow<List<Note>>.filterNotes(): Flow<List<Note>> {
return this.map {
it.filter { note ->
if (note.name.contains(filter.value)) {
if (note.name.contains(filter.value, ignoreCase = true)) {
return@filter true
}
when (note.type) {
DbContract.NoteEntry.TYPE_TEXT -> {
return@filter Html.fromHtml(note.content).toString().contains(filter.value)
return@filter Html.fromHtml(note.content).toString().contains(filter.value, ignoreCase = true)
}

DbContract.NoteEntry.TYPE_CHECKLIST -> {
return@filter ChecklistUtil.parse(note.content).joinToString(System.lineSeparator()).contains(filter.value)
return@filter ChecklistUtil.parse(note.content).joinToString(System.lineSeparator()).contains(filter.value, ignoreCase = true)
}

else -> return@filter false
Expand Down

0 comments on commit bc42940

Please sign in to comment.