Files
notas-online-android/app/src/main/java/com/labexposed/notas/ui/NoteSearch.kt
T
lgcosta a8c8a5a998 feat(ui): modernização visual Material 3 (v0.3.0)
- Edge-to-edge (enableEdgeToEdge) com Scaffold/insets em todas as telas
- Compose BOM 2024.12 -> 2025.06; tipografia e tema com dynamic color
- SyncBanner colorido removido -> SyncStatusRow compacto com chips M3
  acionáveis (sync agora / abrir config / erro em errorContainer)
- Lista: busca por título/conteúdo/tag (filterNotes testado),
  pull-to-refresh, animateItem, contentType, estado vazio com CTA
- Ícones no lugar de emoji (pasta, presença, exclusão, aviso)
- Editor: chip de presença acessível; imports limpos
- Teste unitário de busca (NoteSearchTest)
- versionCode 5 / versionName 0.3.0
2026-11-05 21:48:16 -03:00

21 lines
756 B
Kotlin

package com.labexposed.notas.ui
import com.labexposed.notas.data.local.NoteEntity
internal fun filterNotes(
notes: List<NoteEntity>,
query: String,
categoryId: String? = null,
tag: String? = null,
): List<NoteEntity> {
val normalizedQuery = query.trim()
return notes.filter { note ->
(categoryId == null || note.categories.split(",").contains(categoryId)) &&
(tag == null || note.tags.split(",").contains(tag)) &&
(normalizedQuery.isEmpty() ||
note.title.contains(normalizedQuery, ignoreCase = true) ||
note.content.contains(normalizedQuery, ignoreCase = true) ||
note.tags.split(",").any { it.contains(normalizedQuery, ignoreCase = true) })
}
}