Skip to content

Commit ff7ecb1

Browse files
Fix: First start with filter when filterStrength is set to 0
1 parent 99c2d0c commit ff7ecb1

File tree

1 file changed

+12
-4
lines changed
  • app/src/main/java/com/github/droidworksstudio/launcher/ui/drawer

1 file changed

+12
-4
lines changed

app/src/main/java/com/github/droidworksstudio/launcher/ui/drawer/DrawFragment.kt

+12-4
Original file line numberDiff line numberDiff line change
@@ -306,10 +306,18 @@ class DrawFragment : Fragment(),
306306
.toMutableList()
307307
}
308308
} else {
309-
// If filter strength is less than 1, normalize app names for both cases
310-
searchResults.filter { app ->
311-
FuzzyFinder.normalizeString(app.appName, trimmedQuery)
312-
}.toMutableList()
309+
if (preferenceHelper.searchFromStart) {
310+
// Filter apps that start with the search query and score higher than the filter strength
311+
searchResults.filter { app ->
312+
FuzzyFinder.normalizeString(app.appName, trimmedQuery) ||
313+
app.appName.startsWith(trimmedQuery, ignoreCase = true)
314+
}.toMutableList()
315+
} else {
316+
// If filter strength is less than 1, normalize app names for both cases
317+
searchResults.filter { app ->
318+
FuzzyFinder.normalizeString(app.appName, trimmedQuery)
319+
}.toMutableList()
320+
}
313321
}
314322

315323

0 commit comments

Comments
 (0)