Implement displaying ingredient sections

This commit is contained in:
Kirill Kamakin
2022-12-04 19:25:36 +01:00
parent e2e76ea842
commit a18984bda0
8 changed files with 61 additions and 5 deletions

View File

@@ -2,7 +2,7 @@
"formatVersion": 1,
"database": {
"version": 7,
"identityHash": "2383ca8fe2fbd04ddaec6d7680de62ad",
"identityHash": "d2679aea13d3c18e58c537164f70e249",
"entities": [
{
"tableName": "recipe_summaries",
@@ -95,7 +95,7 @@
},
{
"tableName": "recipe_ingredient",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`local_id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `recipe_id` TEXT NOT NULL, `note` TEXT NOT NULL, `food` TEXT, `unit` TEXT, `quantity` REAL)",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`local_id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `recipe_id` TEXT NOT NULL, `note` TEXT NOT NULL, `food` TEXT, `unit` TEXT, `quantity` REAL, `title` TEXT)",
"fields": [
{
"fieldPath": "localId",
@@ -132,6 +132,12 @@
"columnName": "quantity",
"affinity": "REAL",
"notNull": false
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT",
"notNull": false
}
],
"primaryKey": {
@@ -179,7 +185,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, '2383ca8fe2fbd04ddaec6d7680de62ad')"
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'd2679aea13d3c18e58c537164f70e249')"
]
}
}

View File

@@ -12,6 +12,7 @@ data class RecipeIngredientEntity(
@ColumnInfo(name = "food") val food: String?,
@ColumnInfo(name = "unit") val unit: String?,
@ColumnInfo(name = "quantity") val quantity: Double?,
@ColumnInfo(name = "title") val title: String?,
) {
override fun equals(other: Any?): Boolean {
if (this === other) return true
@@ -24,6 +25,7 @@ data class RecipeIngredientEntity(
if (food != other.food) return false
if (unit != other.unit) return false
if (quantity != other.quantity) return false
if (title != other.title) return false
return true
}
@@ -33,7 +35,8 @@ data class RecipeIngredientEntity(
result = 31 * result + note.hashCode()
result = 31 * result + (food?.hashCode() ?: 0)
result = 31 * result + (unit?.hashCode() ?: 0)
result = 31 * result + quantity.hashCode()
result = 31 * result + (quantity?.hashCode() ?: 0)
result = 31 * result + (title?.hashCode() ?: 0)
return result
}
}