Search: introduce weighted reordering (#272)
* Database: backend for weights & timestamps - Migration 21->22 - SearchableLaunchTimestampEntity.kt - `weight`-column in SavedSearchableEntity - Queries for sorting by and adjusting weight - Queries for sorting by recent use * move weightfactor access to favoritesRepository * reorder calls in SearchVM * no more datahoarding * add settings screen for ordering * ui fix, animations * move ordering settings out of own screen * remove unused localization * weight factors * larger factor for WeightFactor.High * cleanup * sort favorites by weight * icons for favorite screen * I hate coming up with descriptive strings * add default weight factor to settings migration * Add default values for search result ordering preferences * Favorites settings: change order of preferences * Change strings * Replace favorites variability slider with list preference * migration initial weight * Change labels * Include searchable weight column in backup --------- Co-authored-by: MM20 <15646950+MM2-0@users.noreply.github.com>
This commit is contained in:
@@ -183,6 +183,11 @@ fun createFactorySettings(context: Context): Settings {
|
||||
.setSwipeLeft(Settings.GestureSettings.GestureAction.None)
|
||||
.setSwipeRight(Settings.GestureSettings.GestureAction.None)
|
||||
)
|
||||
.setResultOrdering(
|
||||
Settings.SearchResultOrderingSettings.newBuilder()
|
||||
.setOrdering(Settings.SearchResultOrderingSettings.Ordering.Weighted)
|
||||
.setWeightFactor(Settings.SearchResultOrderingSettings.WeightFactor.Default)
|
||||
)
|
||||
.build()
|
||||
}
|
||||
|
||||
|
||||
+6
@@ -1,6 +1,7 @@
|
||||
package de.mm20.launcher2.preferences.migrations
|
||||
|
||||
import de.mm20.launcher2.preferences.Settings
|
||||
import de.mm20.launcher2.preferences.Settings.SearchResultOrderingSettings.WeightFactor
|
||||
|
||||
class Migration_12_13: VersionedMigration(12, 13) {
|
||||
override suspend fun applyMigrations(builder: Settings.Builder): Settings.Builder {
|
||||
@@ -10,5 +11,10 @@ class Migration_12_13: VersionedMigration(12, 13) {
|
||||
.setDatePart(true)
|
||||
.build()
|
||||
)
|
||||
.setResultOrdering(
|
||||
builder.resultOrdering.toBuilder()
|
||||
.setWeightFactor(WeightFactor.Default)
|
||||
.build()
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -223,11 +223,6 @@ message Settings {
|
||||
}
|
||||
SearchBarColors color = 3;
|
||||
bool launch_on_enter = 4;
|
||||
enum SearchResultOrdering {
|
||||
Alphabetic = 0;
|
||||
Relevance = 1;
|
||||
}
|
||||
SearchResultOrdering search_result_ordering = 5;
|
||||
}
|
||||
SearchBarSettings search_bar = 20;
|
||||
|
||||
@@ -332,4 +327,20 @@ message Settings {
|
||||
string long_press_app = 10;
|
||||
}
|
||||
GestureSettings gestures = 28;
|
||||
|
||||
message SearchResultOrderingSettings {
|
||||
enum Ordering {
|
||||
Alphabetic = 0;
|
||||
LaunchCount = 1;
|
||||
Weighted = 2;
|
||||
}
|
||||
Ordering ordering = 1;
|
||||
enum WeightFactor {
|
||||
Low = 0;
|
||||
Default = 1;
|
||||
High = 2;
|
||||
}
|
||||
WeightFactor weight_factor = 2;
|
||||
}
|
||||
SearchResultOrderingSettings result_ordering = 29;
|
||||
}
|
||||
Reference in New Issue
Block a user