From 832ff673201d95722999b1f625cec72a48676901 Mon Sep 17 00:00:00 2001 From: MM20 <15646950+MM2-0@users.noreply.github.com> Date: Sat, 11 Mar 2023 12:40:32 +0100 Subject: [PATCH] Tweak usage weights alphas --- .../mm20/launcher2/favorites/FavoritesRepository.kt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/data/favorites/src/main/java/de/mm20/launcher2/favorites/FavoritesRepository.kt b/data/favorites/src/main/java/de/mm20/launcher2/favorites/FavoritesRepository.kt index 1ecdcfcc..ccbbe6c5 100644 --- a/data/favorites/src/main/java/de/mm20/launcher2/favorites/FavoritesRepository.kt +++ b/data/favorites/src/main/java/de/mm20/launcher2/favorites/FavoritesRepository.kt @@ -216,9 +216,9 @@ internal class FavoritesRepositoryImpl( withContext(Dispatchers.IO) { val weightFactor = when (dataStore.data.map { it.resultOrdering.weightFactor }.firstOrNull()) { - WeightFactor.Low -> 0.1 - WeightFactor.High -> 0.5 - else -> 0.2 + WeightFactor.Low -> WEIGHT_FACTOR_LOW + WeightFactor.High -> WEIGHT_FACTOR_HIGH + else -> WEIGHT_FACTOR_MEDIUM } val item = SavedSearchable(searchable.key, searchable, 0, 0, false, 0.0) item.toDatabaseEntity()?.let { @@ -433,4 +433,10 @@ internal class FavoritesRepositoryImpl( job.join() return removed } + + companion object { + private const val WEIGHT_FACTOR_LOW = 0.01 + private const val WEIGHT_FACTOR_MEDIUM = 0.05 + private const val WEIGHT_FACTOR_HIGH = 0.1 + } } \ No newline at end of file