Ignore extraneous spaces when filtering the folder list

Filter strings with e.g. a trailing space were split into the search term and the empty string. But the empty string can be found in every folder name, so all folders were displayed. This change drops all search terms that are the empty string.
This commit is contained in:
cketti 2021-08-06 14:41:38 +02:00
parent 3a6ca8dfd5
commit c43cb3868b

View file

@ -146,6 +146,7 @@ class ManageFoldersFragment : Fragment() {
val locale = Locale.getDefault()
val displayName = item.displayName.toLowerCase(locale)
return constraint.splitToSequence(" ")
.filter { it.isNotEmpty() }
.map { it.toLowerCase(locale) }
.any { it in displayName }
}