Skip to content

Commit fe592f7

Browse files
feat(search): Prioritize app aliases for none fuzzy search
This commit enhances the fuzzy search logic to prioritize user-defined app aliases over the default app labels. The `FuzzyFinder.scoreApp` function now accepts a `Context` to access `Prefs` and retrieve any available alias for an app. If an alias is found, it is used for the search scoring; otherwise, the default `activityLabel` is used. This change ensures that search results more accurately reflect user-customized app names, improving the overall user experience of the app search functionality.
1 parent 31bb3b6 commit fe592f7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

app/src/main/java/com/github/codeworkscreativehub/mlauncher/ui/adapter/AppDrawerAdapter.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,11 @@ class AppDrawerAdapter(
217217
if (isTagSearch) FuzzyFinder.scoreString(app.tag, q, Constants.MAX_FILTER_STRENGTH)
218218
else FuzzyFinder.scoreApp(context, app, q, Constants.MAX_FILTER_STRENGTH)
219219
},
220-
labelProvider = { app -> if (isTagSearch) app.tag else app.activityLabel },
220+
labelProvider = { app ->
221+
if (isTagSearch) app.tag else prefs.getAppAlias(app.activityPackage)
222+
.takeIf { it.isNotBlank() }
223+
?: app.activityLabel
224+
},
221225
loggerTag = "appScore"
222226
)
223227

0 commit comments

Comments
 (0)