Refactor icons

This commit is contained in:
MM20
2022-06-18 18:51:41 +02:00
parent 08e736f5d1
commit 6de89f3f79
54 changed files with 894 additions and 1489 deletions
@@ -19,12 +19,11 @@ internal val Context.dataStore: LauncherDataStore by dataStore(
},
corruptionHandler = ReplaceFileCorruptionHandler {
CrashReporter.logException(it)
Log.d("MM20", "corruptionHandler")
Settings.getDefaultInstance()
}
)
internal const val SchemaVersion = 6
internal const val SchemaVersion = 7
internal fun getMigrations(context: Context): List<DataMigration<Settings>> {
return listOf(
@@ -34,5 +33,6 @@ internal fun getMigrations(context: Context): List<DataMigration<Settings>> {
Migration_3_4(),
Migration_4_5(),
Migration_5_6(),
Migration_6_7(),
)
}
@@ -128,7 +128,7 @@ fun createFactorySettings(context: Context): Settings {
)
.setIcons(
Settings.IconSettings.newBuilder()
.setLegacyIconBg(Settings.IconSettings.LegacyIconBackground.Dynamic)
.setAdaptify(true)
.setShape(Settings.IconSettings.IconShape.PlatformDefault)
.setThemedIcons(false)
.setIconPack("")
@@ -0,0 +1,12 @@
package de.mm20.launcher2.preferences.migrations
import de.mm20.launcher2.preferences.Settings
class Migration_6_7 : VersionedMigration(6, 7) {
override suspend fun applyMigrations(builder: Settings.Builder): Settings.Builder {
return builder.setIcons(
builder.icons.toBuilder()
.setAdaptify(true)
)
}
}
+1 -6
View File
@@ -210,12 +210,7 @@ message Settings {
IconShape shape = 1;
bool themed_icons = 2;
string icon_pack = 3;
enum LegacyIconBackground {
Dynamic = 0;
None = 1;
White = 2;
}
LegacyIconBackground legacyIconBg = 4;
bool adaptify = 5;
}
IconSettings icons = 21;