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,
|
"formatVersion": 1,
|
||||||
"database": {
|
"database": {
|
||||||
"version": 20,
|
"version": 20,
|
||||||
"identityHash": "c7974043c131f664d2e80126533340b4",
|
"identityHash": "0e23c747bfe32759849ee85dcd5d23cb",
|
||||||
"entities": [
|
"entities": [
|
||||||
{
|
{
|
||||||
"tableName": "forecasts",
|
"tableName": "forecasts",
|
||||||
@ -222,7 +222,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"tableName": "Icons",
|
"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": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"fieldPath": "type",
|
"fieldPath": "type",
|
||||||
@ -248,12 +248,6 @@
|
|||||||
"affinity": "TEXT",
|
"affinity": "TEXT",
|
||||||
"notNull": true
|
"notNull": true
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"fieldPath": "themed",
|
|
||||||
"columnName": "themed",
|
|
||||||
"affinity": "INTEGER",
|
|
||||||
"notNull": true
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"fieldPath": "name",
|
"fieldPath": "name",
|
||||||
"columnName": "name",
|
"columnName": "name",
|
||||||
@ -278,7 +272,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"tableName": "IconPack",
|
"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": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"fieldPath": "name",
|
"fieldPath": "name",
|
||||||
@ -303,6 +297,12 @@
|
|||||||
"columnName": "scale",
|
"columnName": "scale",
|
||||||
"affinity": "REAL",
|
"affinity": "REAL",
|
||||||
"notNull": true
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "themed",
|
||||||
|
"columnName": "themed",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"primaryKey": {
|
"primaryKey": {
|
||||||
@ -468,7 +468,7 @@
|
|||||||
"views": [],
|
"views": [],
|
||||||
"setupQueries": [
|
"setupQueries": [
|
||||||
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
|
"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 componentName: ComponentName?,
|
||||||
val drawable: String?,
|
val drawable: String?,
|
||||||
val iconPack: String,
|
val iconPack: String,
|
||||||
val themed: Boolean,
|
|
||||||
val name: String?,
|
val name: String?,
|
||||||
@PrimaryKey(autoGenerate = true) val id : Long? = null
|
@PrimaryKey(autoGenerate = true) val id : Long? = null
|
||||||
)
|
)
|
||||||
@ -8,5 +8,6 @@ data class IconPackEntity(
|
|||||||
val name: String,
|
val name: String,
|
||||||
@PrimaryKey val packageName: String,
|
@PrimaryKey val packageName: String,
|
||||||
val version: 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,
|
`componentName` TEXT,
|
||||||
`drawable` TEXT,
|
`drawable` TEXT,
|
||||||
`iconPack` TEXT NOT NULL,
|
`iconPack` TEXT NOT NULL,
|
||||||
`themed` INTEGER NOT NULL,
|
|
||||||
`name` TEXT,
|
`name` TEXT,
|
||||||
`id` INTEGER PRIMARY KEY AUTOINCREMENT)
|
`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("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
|
import de.mm20.launcher2.database.entities.IconPackEntity
|
||||||
|
|
||||||
data class IconPack(
|
data class IconPack(
|
||||||
val name: String,
|
val name: String,
|
||||||
val packageName: String,
|
val packageName: String,
|
||||||
val version: String,
|
val version: String,
|
||||||
var scale: Float = 1f
|
var scale: Float = 1f,
|
||||||
) {
|
val themed: Boolean = false,
|
||||||
|
) {
|
||||||
constructor(entity: IconPackEntity) : this(
|
constructor(entity: IconPackEntity) : this(
|
||||||
name = entity.name,
|
name = entity.name,
|
||||||
packageName = entity.packageName,
|
packageName = entity.packageName,
|
||||||
version = entity.packageName,
|
version = entity.packageName,
|
||||||
scale = entity.scale
|
scale = entity.scale,
|
||||||
|
themed = entity.themed,
|
||||||
)
|
)
|
||||||
|
|
||||||
fun toDatabaseEntity(): IconPackEntity {
|
fun toDatabaseEntity(): IconPackEntity {
|
||||||
return IconPackEntity(
|
return IconPackEntity(
|
||||||
name = name,
|
name = name,
|
||||||
scale = scale,
|
scale = scale,
|
||||||
version = version,
|
version = version,
|
||||||
packageName = packageName
|
packageName = packageName,
|
||||||
|
themed = themed,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8,7 +8,6 @@ data class IconPackIcon(
|
|||||||
val componentName: ComponentName?,
|
val componentName: ComponentName?,
|
||||||
val drawable: String?,
|
val drawable: String?,
|
||||||
val iconPack: String,
|
val iconPack: String,
|
||||||
val themed: Boolean = false,
|
|
||||||
val name: String? = null,
|
val name: String? = null,
|
||||||
) {
|
) {
|
||||||
constructor(entity: IconEntity) : this(
|
constructor(entity: IconEntity) : this(
|
||||||
@ -16,7 +15,6 @@ data class IconPackIcon(
|
|||||||
componentName = entity.componentName,
|
componentName = entity.componentName,
|
||||||
drawable = entity.drawable,
|
drawable = entity.drawable,
|
||||||
iconPack = entity.iconPack,
|
iconPack = entity.iconPack,
|
||||||
themed = entity.themed,
|
|
||||||
name = entity.name,
|
name = entity.name,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -26,7 +24,6 @@ data class IconPackIcon(
|
|||||||
componentName = componentName,
|
componentName = componentName,
|
||||||
drawable = drawable,
|
drawable = drawable,
|
||||||
iconPack = iconPack,
|
iconPack = iconPack,
|
||||||
themed = themed,
|
|
||||||
name = name,
|
name = name,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user