Make grid icon size customizable

This commit is contained in:
MM20
2022-04-09 16:58:21 +02:00
parent df9760ddd1
commit 0711d02dbf
14 changed files with 73 additions and 9 deletions
@@ -6,10 +6,7 @@ import androidx.datastore.core.DataStore
import androidx.datastore.core.handlers.ReplaceFileCorruptionHandler
import androidx.datastore.dataStore
import de.mm20.launcher2.crashreporter.CrashReporter
import de.mm20.launcher2.preferences.migrations.FactorySettingsMigration
import de.mm20.launcher2.preferences.migrations.Migration_1_2
import de.mm20.launcher2.preferences.migrations.Migration_2_3
import de.mm20.launcher2.preferences.migrations.Migration_3_4
import de.mm20.launcher2.preferences.migrations.*
typealias LauncherDataStore = DataStore<Settings>
@@ -22,6 +19,7 @@ internal val Context.dataStore: LauncherDataStore by dataStore(
Migration_1_2(),
Migration_2_3(),
Migration_3_4(),
Migration_4_5(),
)
},
corruptionHandler = ReplaceFileCorruptionHandler {
@@ -31,4 +29,4 @@ internal val Context.dataStore: LauncherDataStore by dataStore(
}
)
internal const val SchemaVersion = 4
internal const val SchemaVersion = 5
@@ -109,6 +109,7 @@ fun createFactorySettings(context: Context): Settings {
.setGrid(
Settings.GridSettings.newBuilder()
.setColumnCount(context.resources.getInteger(R.integer.config_columnCount))
.setIconSize(48)
.build()
)
.setSearchBar(
@@ -0,0 +1,13 @@
package de.mm20.launcher2.preferences.migrations
import de.mm20.launcher2.preferences.Settings
class Migration_4_5: VersionedMigration(4, 5) {
override suspend fun applyMigrations(builder: Settings.Builder): Settings.Builder {
return builder.setGrid(
builder.grid.toBuilder()
.setIconSize(48)
.build()
)
}
}
@@ -127,6 +127,7 @@ message Settings {
message GridSettings {
uint32 column_count = 1;
uint32 icon_size = 2;
}
GridSettings grid = 19;