Change Icon and IconPack entities again
- move `themed` column from Icon to IconPack
This commit is contained in:
parent
af858bfbbe
commit
ebba36c384
@ -2,7 +2,7 @@
|
||||
"formatVersion": 1,
|
||||
"database": {
|
||||
"version": 20,
|
||||
"identityHash": "c7974043c131f664d2e80126533340b4",
|
||||
"identityHash": "0e23c747bfe32759849ee85dcd5d23cb",
|
||||
"entities": [
|
||||
{
|
||||
"tableName": "forecasts",
|
||||
@ -222,7 +222,7 @@
|
||||
},
|
||||
{
|
||||
"tableName": "Icons",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`type` TEXT NOT NULL, `componentName` TEXT, `drawable` TEXT, `iconPack` TEXT NOT NULL, `themed` INTEGER NOT NULL, `name` TEXT, `id` INTEGER PRIMARY KEY AUTOINCREMENT)",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`type` TEXT NOT NULL, `componentName` TEXT, `drawable` TEXT, `iconPack` TEXT NOT NULL, `name` TEXT, `id` INTEGER PRIMARY KEY AUTOINCREMENT)",
|
||||
"fields": [
|
||||
{
|
||||
"fieldPath": "type",
|
||||
@ -248,12 +248,6 @@
|
||||
"affinity": "TEXT",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "themed",
|
||||
"columnName": "themed",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "name",
|
||||
"columnName": "name",
|
||||
@ -278,7 +272,7 @@
|
||||
},
|
||||
{
|
||||
"tableName": "IconPack",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`name` TEXT NOT NULL, `packageName` TEXT NOT NULL, `version` TEXT NOT NULL, `scale` REAL NOT NULL, PRIMARY KEY(`packageName`))",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`name` TEXT NOT NULL, `packageName` TEXT NOT NULL, `version` TEXT NOT NULL, `scale` REAL NOT NULL, `themed` INTEGER NOT NULL, PRIMARY KEY(`packageName`))",
|
||||
"fields": [
|
||||
{
|
||||
"fieldPath": "name",
|
||||
@ -303,6 +297,12 @@
|
||||
"columnName": "scale",
|
||||
"affinity": "REAL",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "themed",
|
||||
"columnName": "themed",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
@ -468,7 +468,7 @@
|
||||
"views": [],
|
||||
"setupQueries": [
|
||||
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
|
||||
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'c7974043c131f664d2e80126533340b4')"
|
||||
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '0e23c747bfe32759849ee85dcd5d23cb')"
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -10,7 +10,6 @@ data class IconEntity(
|
||||
val componentName: ComponentName?,
|
||||
val drawable: String?,
|
||||
val iconPack: String,
|
||||
val themed: Boolean,
|
||||
val name: String?,
|
||||
@PrimaryKey(autoGenerate = true) val id : Long? = null
|
||||
)
|
||||
@ -8,5 +8,6 @@ data class IconPackEntity(
|
||||
val name: String,
|
||||
@PrimaryKey val packageName: String,
|
||||
val version: String,
|
||||
var scale: Float = 1f
|
||||
var scale: Float = 1f,
|
||||
val themed: Boolean = false,
|
||||
)
|
||||
@ -12,11 +12,11 @@ class Migration_19_20: Migration(19, 20) {
|
||||
`componentName` TEXT,
|
||||
`drawable` TEXT,
|
||||
`iconPack` TEXT NOT NULL,
|
||||
`themed` INTEGER NOT NULL,
|
||||
`name` TEXT,
|
||||
`id` INTEGER PRIMARY KEY AUTOINCREMENT)
|
||||
""")
|
||||
database.execSQL("INSERT INTO `Icons` (`type`, `componentName`, `drawable`, `iconPack`, `themed`, `name`) SELECT `type`, `componentName`, `drawable`, `iconPack`, 0, null FROM `Icons_old`")
|
||||
database.execSQL("INSERT INTO `Icons` (`type`, `componentName`, `drawable`, `iconPack`, `themed`, `name`) SELECT `type`, `componentName`, `drawable`, `iconPack`, null FROM `Icons_old`")
|
||||
database.execSQL("DROP TABLE `Icons_old`")
|
||||
database.execSQL("ALTER TABLE `IconPacks` ADD COLUMN `themed` INTEGER NOT NULL DEFAULT 0")
|
||||
}
|
||||
}
|
||||
@ -3,24 +3,27 @@ package de.mm20.launcher2.icons
|
||||
import de.mm20.launcher2.database.entities.IconPackEntity
|
||||
|
||||
data class IconPack(
|
||||
val name: String,
|
||||
val packageName: String,
|
||||
val version: String,
|
||||
var scale: Float = 1f
|
||||
) {
|
||||
val name: String,
|
||||
val packageName: String,
|
||||
val version: String,
|
||||
var scale: Float = 1f,
|
||||
val themed: Boolean = false,
|
||||
) {
|
||||
constructor(entity: IconPackEntity) : this(
|
||||
name = entity.name,
|
||||
packageName = entity.packageName,
|
||||
version = entity.packageName,
|
||||
scale = entity.scale
|
||||
name = entity.name,
|
||||
packageName = entity.packageName,
|
||||
version = entity.packageName,
|
||||
scale = entity.scale,
|
||||
themed = entity.themed,
|
||||
)
|
||||
|
||||
fun toDatabaseEntity(): IconPackEntity {
|
||||
return IconPackEntity(
|
||||
name = name,
|
||||
scale = scale,
|
||||
version = version,
|
||||
packageName = packageName
|
||||
name = name,
|
||||
scale = scale,
|
||||
version = version,
|
||||
packageName = packageName,
|
||||
themed = themed,
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -8,7 +8,6 @@ data class IconPackIcon(
|
||||
val componentName: ComponentName?,
|
||||
val drawable: String?,
|
||||
val iconPack: String,
|
||||
val themed: Boolean = false,
|
||||
val name: String? = null,
|
||||
) {
|
||||
constructor(entity: IconEntity) : this(
|
||||
@ -16,7 +15,6 @@ data class IconPackIcon(
|
||||
componentName = entity.componentName,
|
||||
drawable = entity.drawable,
|
||||
iconPack = entity.iconPack,
|
||||
themed = entity.themed,
|
||||
name = entity.name,
|
||||
)
|
||||
|
||||
@ -26,7 +24,6 @@ data class IconPackIcon(
|
||||
componentName = componentName,
|
||||
drawable = drawable,
|
||||
iconPack = iconPack,
|
||||
themed = themed,
|
||||
name = name,
|
||||
)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user