From ff7ecb149186645d1990da863afee80b596428f0 Mon Sep 17 00:00:00 2001 From: HeCodes2Much Date: Wed, 4 Dec 2024 12:56:02 +0000 Subject: [PATCH] Fix: First start with filter when filterStrength is set to 0 --- .../launcher/ui/drawer/DrawFragment.kt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/github/droidworksstudio/launcher/ui/drawer/DrawFragment.kt b/app/src/main/java/com/github/droidworksstudio/launcher/ui/drawer/DrawFragment.kt index 2b41e7d3..0ab5d761 100644 --- a/app/src/main/java/com/github/droidworksstudio/launcher/ui/drawer/DrawFragment.kt +++ b/app/src/main/java/com/github/droidworksstudio/launcher/ui/drawer/DrawFragment.kt @@ -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() + } }