Skip to content

Commit

Permalink
Fix: First start with filter when filterStrength is set to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
CreativeCodeCat committed Dec 4, 2024
1 parent 99c2d0c commit ff7ecb1
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,18 @@ class DrawFragment : Fragment(),
.toMutableList()
}
} else {
// If filter strength is less than 1, normalize app names for both cases
searchResults.filter { app ->
FuzzyFinder.normalizeString(app.appName, trimmedQuery)
}.toMutableList()
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 {
// If filter strength is less than 1, normalize app names for both cases
searchResults.filter { app ->
FuzzyFinder.normalizeString(app.appName, trimmedQuery)
}.toMutableList()
}
}


Expand Down

0 comments on commit ff7ecb1

Please sign in to comment.