From 4422228230b1fcfd9e47a261f60159c3691201a7 Mon Sep 17 00:00:00 2001 From: HeCodes2Much Date: Thu, 21 Mar 2024 16:33:38 +0000 Subject: [PATCH] Quick Fix (No PR Needed) --- .../main/java/com/github/hecodes2much/fuzzywuzzy/finder.kt | 4 ++-- .../com/github/hecodes2much/mlauncher/ui/AppDrawerAdapter.kt | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/github/hecodes2much/fuzzywuzzy/finder.kt b/app/src/main/java/com/github/hecodes2much/fuzzywuzzy/finder.kt index 1ec0da5d8..f78e9539a 100644 --- a/app/src/main/java/com/github/hecodes2much/fuzzywuzzy/finder.kt +++ b/app/src/main/java/com/github/hecodes2much/fuzzywuzzy/finder.kt @@ -3,7 +3,7 @@ package com.github.hecodes2much.fuzzywuzzy import com.github.hecodes2much.mlauncher.data.AppModel import java.util.* -fun scoreApp(app: AppModel, searchChars: String): Int { +fun scoreApp(app: AppModel, searchChars: String, topScore: Int): Int { val appChars = app.appAlias.ifEmpty { app.appLabel } val fuzzyScore = calculateFuzzyScore( @@ -11,7 +11,7 @@ fun scoreApp(app: AppModel, searchChars: String): Int { normalizeString(searchChars) ) - return (fuzzyScore * 99).toInt() + return (fuzzyScore * topScore).toInt() } fun normalizeString(input: String): String { diff --git a/app/src/main/java/com/github/hecodes2much/mlauncher/ui/AppDrawerAdapter.kt b/app/src/main/java/com/github/hecodes2much/mlauncher/ui/AppDrawerAdapter.kt index a661fac7f..9dac9ff4f 100644 --- a/app/src/main/java/com/github/hecodes2much/mlauncher/ui/AppDrawerAdapter.kt +++ b/app/src/main/java/com/github/hecodes2much/mlauncher/ui/AppDrawerAdapter.kt @@ -17,6 +17,7 @@ import androidx.recyclerview.widget.RecyclerView import com.github.hecodes2much.fuzzywuzzy.scoreApp import com.github.hecodes2much.mlauncher.R import com.github.hecodes2much.mlauncher.data.AppModel +import com.github.hecodes2much.mlauncher.data.Constants import com.github.hecodes2much.mlauncher.data.Constants.AppDrawerFlag import com.github.hecodes2much.mlauncher.data.Prefs import com.github.hecodes2much.mlauncher.databinding.AdapterAppDrawerBinding @@ -90,7 +91,7 @@ class AppDrawerAdapter( val scoredApps = mutableMapOf() for (app in appsList) { - scoredApps[app] = scoreApp(app, searchChars) + scoredApps[app] = scoreApp(app, searchChars, Constants.FILTER_STRENGTH_MAX) } val filteredApps = if (searchChars.isNotEmpty()) {