Fix: First start with filter when filterStrength is set to 0

This commit is contained in:
HeCodes2Much
2024-12-04 12:56:02 +00:00
parent 99c2d0c510
commit ff7ecb1491

View File

@@ -305,12 +305,20 @@ class DrawFragment : Fragment(),
.keys .keys
.toMutableList() .toMutableList()
} }
} else {
if (preferenceHelper.searchFromStart) {
// Filter apps that start with the search query and score higher than the filter strength
searchResults.filter { app ->
FuzzyFinder.normalizeString(app.appName, trimmedQuery) ||
app.appName.startsWith(trimmedQuery, ignoreCase = true)
}.toMutableList()
} else { } else {
// If filter strength is less than 1, normalize app names for both cases // If filter strength is less than 1, normalize app names for both cases
searchResults.filter { app -> searchResults.filter { app ->
FuzzyFinder.normalizeString(app.appName, trimmedQuery) FuzzyFinder.normalizeString(app.appName, trimmedQuery)
}.toMutableList() }.toMutableList()
} }
}
val numberOfItemsLeft = finalResults.size val numberOfItemsLeft = finalResults.size