Change search result order for all other categories

This commit is contained in:
MM20
2024-10-13 20:32:15 +02:00
parent bf6e963545
commit 774777f79c
8 changed files with 179 additions and 165 deletions
@@ -264,14 +264,6 @@ internal class AppRepositoryImpl(
}
}
private fun matches(label: String, query: String): Boolean {
val normalizedLabel = label.normalize()
val normalizedQuery = query.normalize()
if (normalizedLabel.contains(normalizedQuery)) return true
val fuzzyScore = FuzzyScore(Locale.getDefault())
return fuzzyScore.fuzzyScore(normalizedLabel, normalizedQuery) >= query.length * 1.5
}
private fun getActivityByComponentName(componentName: ComponentName?): LauncherApp? {
componentName ?: return null
val intent = Intent().setComponent(componentName)
@@ -41,7 +41,7 @@ internal data class LauncherApp(
override val isSuspended: Boolean = false,
internal val userSerialNumber: Long,
override val labelOverride: String? = null,
override val score: ResultScore = ResultScore.Zero,
override val score: ResultScore = ResultScore.Unspecified,
) : Application {
override val componentName: ComponentName
@@ -50,7 +50,7 @@ internal data class LauncherApp(
override val label: String = launcherActivityInfo.label.toString()
constructor(context: Context, launcherActivityInfo: LauncherActivityInfo, score: ResultScore = ResultScore.Zero) : this(
constructor(context: Context, launcherActivityInfo: LauncherActivityInfo, score: ResultScore = ResultScore.Unspecified) : this(
launcherActivityInfo,
versionName = getPackageVersionName(context, launcherActivityInfo.applicationInfo.packageName),
isSuspended = launcherActivityInfo.applicationInfo.flags and ApplicationInfo.FLAG_SUSPENDED != 0,