Add preferences for layout
This commit is contained in:
@@ -722,4 +722,14 @@
|
||||
<item quantity="one">%1$d item selected</item>
|
||||
<item quantity="other">%1$d items selected</item>
|
||||
</plurals>
|
||||
<string name="preference_layout_open_search">Search activation</string>
|
||||
<string name="open_search_pull_down">Swipe down</string>
|
||||
<string name="open_search_swipe_left">Swipe left</string>
|
||||
<string name="open_search_swipe_right">Swipe right</string>
|
||||
<string name="preference_layout_search_bar_position">Search bar position</string>
|
||||
<string name="search_bar_position_top">Top</string>
|
||||
<string name="search_bar_position_bottom">Bottom</string>
|
||||
<string name="preference_layout_search_results">Arrangement of search results</string>
|
||||
<string name="search_results_order_top_down">Top-down</string>
|
||||
<string name="search_results_order_bottom_up">Bottom-up</string>
|
||||
</resources>
|
||||
@@ -22,7 +22,7 @@ internal val Context.dataStore: LauncherDataStore by dataStore(
|
||||
}
|
||||
)
|
||||
|
||||
internal const val SchemaVersion = 11
|
||||
internal const val SchemaVersion = 12
|
||||
|
||||
internal fun getMigrations(context: Context): List<DataMigration<Settings>> {
|
||||
return listOf(
|
||||
@@ -37,5 +37,6 @@ internal fun getMigrations(context: Context): List<DataMigration<Settings>> {
|
||||
Migration_8_9(),
|
||||
Migration_9_10(),
|
||||
Migration_10_11(),
|
||||
Migration_11_12(),
|
||||
)
|
||||
}
|
||||
@@ -162,6 +162,12 @@ fun createFactorySettings(context: Context): Settings {
|
||||
Settings.WidgetSettings.newBuilder()
|
||||
.setEditButton(true)
|
||||
)
|
||||
.setLayout(
|
||||
Settings.LayoutSettings.newBuilder()
|
||||
.setBaseLayout(Settings.LayoutSettings.Layout.PullDown)
|
||||
.setBottomSearchBar(false)
|
||||
.setReverseSearchResults(false)
|
||||
)
|
||||
.build()
|
||||
}
|
||||
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package de.mm20.launcher2.preferences.migrations
|
||||
|
||||
import de.mm20.launcher2.preferences.Settings
|
||||
import de.mm20.launcher2.preferences.Settings.LayoutSettings
|
||||
|
||||
class Migration_11_12: VersionedMigration(11, 12) {
|
||||
override suspend fun applyMigrations(builder: Settings.Builder): Settings.Builder {
|
||||
val oldLayout = builder.appearance.layout
|
||||
when(oldLayout) {
|
||||
LayoutSettings.Layout.Pager -> {
|
||||
builder.setLayout(
|
||||
LayoutSettings.newBuilder()
|
||||
.setBaseLayout(LayoutSettings.Layout.Pager)
|
||||
.setBottomSearchBar(true)
|
||||
.setReverseSearchResults(true)
|
||||
)
|
||||
}
|
||||
LayoutSettings.Layout.PagerReversed -> {
|
||||
builder.setLayout(
|
||||
LayoutSettings.newBuilder()
|
||||
.setBaseLayout(LayoutSettings.Layout.PagerReversed)
|
||||
.setBottomSearchBar(true)
|
||||
.setReverseSearchResults(true)
|
||||
)
|
||||
}
|
||||
else -> {
|
||||
builder.setLayout(
|
||||
LayoutSettings.newBuilder()
|
||||
.setBaseLayout(LayoutSettings.Layout.PullDown)
|
||||
.setBottomSearchBar(false)
|
||||
.setReverseSearchResults(false)
|
||||
)
|
||||
}
|
||||
}
|
||||
return builder
|
||||
}
|
||||
}
|
||||
@@ -68,12 +68,10 @@ message Settings {
|
||||
CustomColors custom_colors = 8;
|
||||
bool dim_wallpaper = 7;
|
||||
|
||||
enum Layout {
|
||||
PullDown = 0;
|
||||
Pager = 1;
|
||||
PagerReversed = 2;
|
||||
}
|
||||
Layout layout = 9;
|
||||
/**
|
||||
* Deprecated, use layout instead
|
||||
*/
|
||||
LayoutSettings.Layout layout = 9 [deprecated = true];
|
||||
|
||||
enum Font {
|
||||
Outfit = 0;
|
||||
@@ -288,4 +286,17 @@ message Settings {
|
||||
bool edit_button = 1;
|
||||
}
|
||||
WidgetSettings widgets = 26;
|
||||
|
||||
message LayoutSettings {
|
||||
enum Layout {
|
||||
PullDown = 0;
|
||||
Pager = 1;
|
||||
PagerReversed = 2;
|
||||
}
|
||||
|
||||
Layout base_layout = 1;
|
||||
bool bottom_search_bar = 2;
|
||||
bool reverse_search_results = 3;
|
||||
}
|
||||
LayoutSettings layout = 27;
|
||||
}
|
||||
Reference in New Issue
Block a user