Update dependencies, migrate to compose 1.7.0

This commit is contained in:
Andres Gomez, Thomas (ITDV RL) 2024-09-06 12:33:24 +02:00
parent 1bac5e7d15
commit 8f3efc1dc1
12 changed files with 576 additions and 32 deletions

View file

@ -104,21 +104,21 @@ android {
dependencies {
implementation("androidx.core:core-ktx:1.13.1")
implementation("androidx.activity:activity-compose:1.9.1")
implementation("androidx.activity:activity-compose:1.9.2")
// Compose
implementation("androidx.compose.ui:ui:1.7.0-rc01")
implementation("androidx.compose.ui:ui-util:1.6.8")
implementation("androidx.compose.ui:ui-graphics:1.6.8")
implementation("androidx.compose.ui:ui-tooling-preview:1.6.8")
implementation("androidx.compose.material:material:1.6.8")
implementation("androidx.compose.material3:material3:1.2.1")
debugImplementation("androidx.compose.ui:ui-tooling:1.6.8")
implementation("androidx.compose.ui:ui:1.7.0")
implementation("androidx.compose.ui:ui-util:1.7.0")
implementation("androidx.compose.ui:ui-graphics:1.7.0")
implementation("androidx.compose.ui:ui-tooling-preview:1.7.0")
implementation("androidx.compose.material:material:1.7.0")
implementation("androidx.compose.material3:material3:1.3.0")
debugImplementation("androidx.compose.ui:ui-tooling:1.7.0")
implementation("androidx.constraintlayout:constraintlayout-compose:1.0.1")
// Navigation
implementation("androidx.navigation:navigation-compose:2.7.7")
implementation("androidx.navigation:navigation-compose:2.8.0")
// Accompanist
implementation("com.google.accompanist:accompanist-placeholder:0.34.0")

View file

@ -2,7 +2,7 @@
"formatVersion": 1,
"database": {
"version": 2,
"identityHash": "f1496aa4aa95e44822a7b0650065c53e",
"identityHash": "4aba1e072ec7b6ee3b0739823ddad274",
"entities": [
{
"tableName": "lexicon",
@ -399,7 +399,17 @@
"documentId"
]
},
"indices": [],
"indices": [
{
"name": "index_AdventureStory_documentId",
"unique": false,
"columnNames": [
"documentId"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_AdventureStory_documentId` ON `${TABLE_NAME}` (`documentId`)"
}
],
"foreignKeys": [
{
"table": "AdventureBooks",
@ -457,7 +467,26 @@
"documentId"
]
},
"indices": [],
"indices": [
{
"name": "index_AdventureLine_documentId",
"unique": false,
"columnNames": [
"documentId"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_AdventureLine_documentId` ON `${TABLE_NAME}` (`documentId`)"
},
{
"name": "index_AdventureLine_title",
"unique": false,
"columnNames": [
"title"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_AdventureLine_title` ON `${TABLE_NAME}` (`title`)"
}
],
"foreignKeys": [
{
"table": "AdventureStory",
@ -478,7 +507,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, 'f1496aa4aa95e44822a7b0650065c53e')"
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '4aba1e072ec7b6ee3b0739823ddad274')"
]
}
}

View file

@ -0,0 +1,513 @@
{
"formatVersion": 1,
"database": {
"version": 3,
"identityHash": "4aba1e072ec7b6ee3b0739823ddad274",
"entities": [
{
"tableName": "lexicon",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `name` TEXT NOT NULL, `category` TEXT, `diminutive` TEXT, `gender` TEXT, `race` TEXT, `status` TEXT, `location` TEXT, `portrait` TEXT, `description` TEXT, `history` TEXT, `tags` TEXT, `lastUpdated` INTEGER, `lastRead` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "category",
"columnName": "category",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "diminutive",
"columnName": "diminutive",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "gender",
"columnName": "gender",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "race",
"columnName": "race",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "location",
"columnName": "location",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "portrait",
"columnName": "portrait",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "history",
"columnName": "history",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "tags",
"columnName": "tags",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "lastUpdated",
"columnName": "lastUpdated",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "lastRead",
"columnName": "lastRead",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "quest",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `category` TEXT, `title` TEXT NOT NULL, `subTitle` TEXT, `completed` INTEGER NOT NULL, `questGiverId` TEXT, `questGiverName` TEXT, `locationId` TEXT, `locationName` TEXT, `groupReward` TEXT, `individualReward` TEXT, `description` TEXT NOT NULL, `illustrations` TEXT, `background` TEXT, `lastUpdated` INTEGER, `lastRead` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "category",
"columnName": "category",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "subTitle",
"columnName": "subTitle",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "completed",
"columnName": "completed",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "questGiverId",
"columnName": "questGiverId",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "questGiverName",
"columnName": "questGiverName",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "locationId",
"columnName": "locationId",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "locationName",
"columnName": "locationName",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "groupReward",
"columnName": "groupReward",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "individualReward",
"columnName": "individualReward",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "illustrations",
"columnName": "illustrations",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "background",
"columnName": "background",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "lastUpdated",
"columnName": "lastUpdated",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "lastRead",
"columnName": "lastRead",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "location",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `name` TEXT NOT NULL, `category` TEXT, `description` TEXT, `map` TEXT, `illustrations` TEXT, `lastUpdated` INTEGER, `lastRead` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "category",
"columnName": "category",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "map",
"columnName": "map",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "illustrations",
"columnName": "illustrations",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "lastUpdated",
"columnName": "lastUpdated",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "lastRead",
"columnName": "lastRead",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "world",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`parentId` TEXT NOT NULL, `childId` TEXT NOT NULL, `child` TEXT NOT NULL, `x` REAL, `y` REAL, PRIMARY KEY(`parentId`, `childId`))",
"fields": [
{
"fieldPath": "parentId",
"columnName": "parentId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "childId",
"columnName": "childId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "child",
"columnName": "child",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "x",
"columnName": "x",
"affinity": "REAL",
"notNull": false
},
{
"fieldPath": "y",
"columnName": "y",
"affinity": "REAL",
"notNull": false
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"parentId",
"childId"
]
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "AdventureBooks",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`documentId` TEXT NOT NULL, `title` TEXT NOT NULL, `icon` TEXT, PRIMARY KEY(`documentId`))",
"fields": [
{
"fieldPath": "documentId",
"columnName": "documentId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "icon",
"columnName": "icon",
"affinity": "TEXT",
"notNull": false
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"documentId"
]
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "AdventureStory",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`title` TEXT NOT NULL, `category` TEXT, `background` TEXT, `revision` INTEGER NOT NULL, `index` INTEGER NOT NULL, `documentId` TEXT NOT NULL, PRIMARY KEY(`title`, `documentId`), FOREIGN KEY(`documentId`) REFERENCES `AdventureBooks`(`documentId`) ON UPDATE NO ACTION ON DELETE CASCADE )",
"fields": [
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "category",
"columnName": "category",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "background",
"columnName": "background",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "revision",
"columnName": "revision",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "index",
"columnName": "index",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "documentId",
"columnName": "documentId",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"title",
"documentId"
]
},
"indices": [
{
"name": "index_AdventureStory_documentId",
"unique": false,
"columnNames": [
"documentId"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_AdventureStory_documentId` ON `${TABLE_NAME}` (`documentId`)"
}
],
"foreignKeys": [
{
"table": "AdventureBooks",
"onDelete": "CASCADE",
"onUpdate": "NO ACTION",
"columns": [
"documentId"
],
"referencedColumns": [
"documentId"
]
}
]
},
{
"tableName": "AdventureLine",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`index` INTEGER NOT NULL, `text` TEXT NOT NULL, `format` TEXT NOT NULL, `documentId` TEXT NOT NULL, `title` TEXT NOT NULL, PRIMARY KEY(`index`, `title`, `documentId`), FOREIGN KEY(`title`, `documentId`) REFERENCES `AdventureStory`(`title`, `documentId`) ON UPDATE NO ACTION ON DELETE CASCADE )",
"fields": [
{
"fieldPath": "index",
"columnName": "index",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "text",
"columnName": "text",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "format",
"columnName": "format",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "documentId",
"columnName": "documentId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "story",
"columnName": "title",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"index",
"title",
"documentId"
]
},
"indices": [
{
"name": "index_AdventureLine_documentId",
"unique": false,
"columnNames": [
"documentId"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_AdventureLine_documentId` ON `${TABLE_NAME}` (`documentId`)"
},
{
"name": "index_AdventureLine_title",
"unique": false,
"columnNames": [
"title"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_AdventureLine_title` ON `${TABLE_NAME}` (`title`)"
}
],
"foreignKeys": [
{
"table": "AdventureStory",
"onDelete": "CASCADE",
"onUpdate": "NO ACTION",
"columns": [
"title",
"documentId"
],
"referencedColumns": [
"title",
"documentId"
]
}
]
}
],
"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, '4aba1e072ec7b6ee3b0739823ddad274')"
]
}
}

View file

@ -5,6 +5,8 @@ import androidx.room.AutoMigration
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import androidx.room.migration.Migration
import androidx.sqlite.db.SupportSQLiteDatabase
import com.pixelized.rplexicon.data.database.adventure.AdventureBookDbo
import com.pixelized.rplexicon.data.database.adventure.AdventureDao
import com.pixelized.rplexicon.data.database.adventure.AdventureLineDbo
@ -33,10 +35,10 @@ import dagger.hilt.components.SingletonComponent
AdventureStoryDbo::class,
AdventureLineDbo::class,
],
version = 2,
version = 3,
exportSchema = true,
autoMigrations = [
AutoMigration(from = 1, to = 2)
AutoMigration(from = 1, to = 2),
]
)
abstract class CompanionDatabase : RoomDatabase() {
@ -56,6 +58,8 @@ class DatabaseModule {
): CompanionDatabase {
return synchronized(this) {
Room.databaseBuilder(context, CompanionDatabase::class.java, "companion_database")
.fallbackToDestructiveMigrationOnDowngrade()
.fallbackToDestructiveMigration()
.build()
}
}

View file

@ -59,7 +59,7 @@ data class AdventureStoryDbo(
val revision: Long,
@ColumnInfo(name = INDEX)
val index: Int,
@ColumnInfo(name = FK_DOCUMENT_ID)
@ColumnInfo(name = FK_DOCUMENT_ID, index = true)
val documentId: String,
) {
@Ignore
@ -107,9 +107,9 @@ data class AdventureLineDbo(
val text: String,
@ColumnInfo(name = FORMAT)
val format: String,
@ColumnInfo(name = FK_DOCUMENT_ID)
@ColumnInfo(name = FK_DOCUMENT_ID, index = true)
val documentId: String,
@ColumnInfo(name = FK_STORY_TITLE)
@ColumnInfo(name = FK_STORY_TITLE, index = true)
val story: String,
) {
@Ignore

View file

@ -13,10 +13,10 @@ import androidx.compose.foundation.pager.PageSize
import androidx.compose.foundation.pager.PagerState
import androidx.compose.foundation.pager.VerticalPager
import androidx.compose.foundation.pager.rememberPagerState
import androidx.compose.material.ripple.rememberRipple
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.ripple
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
@ -53,7 +53,7 @@ fun NumberPicker(
modifier = Modifier
.clickable(
interactionSource = remember { MutableInteractionSource() },
indication = rememberRipple(bounded = false),
indication = ripple(bounded = false),
onClick = { scope.launch { pager.animateScrollToPage(page = index) } },
)
.size(size = itemSize),

View file

@ -156,9 +156,7 @@ private fun AdventureListContent(
@Composable
@Preview(uiMode = Configuration.UI_MODE_NIGHT_NO)
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
private fun AdventureListPreview(
modifier: Modifier = Modifier,
) {
private fun AdventureListPreview() {
LexiconTheme {
Surface(
modifier = Modifier.fillMaxSize(),

View file

@ -8,10 +8,10 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material.ripple.rememberRipple
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.ripple
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Stable
import androidx.compose.runtime.remember
@ -45,7 +45,7 @@ fun LabelPoint(
modifier = Modifier
.clickable(
interactionSource = remember { MutableInteractionSource() },
indication = rememberRipple(bounded = false),
indication = ripple(bounded = false),
enabled = onClick != null, onClick = { onClick?.invoke() }
)
.then(other = modifier),

View file

@ -7,10 +7,10 @@ import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.material.ripple.rememberRipple
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.ripple
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Stable
import androidx.compose.runtime.remember
@ -45,7 +45,7 @@ fun ResourcePoint(
modifier = Modifier
.clickable(
interactionSource = remember { MutableInteractionSource() },
indication = rememberRipple(bounded = false),
indication = ripple(bounded = false),
onClick = { onClick?.invoke(resource) }
)
.then(other = modifier),

View file

@ -8,9 +8,9 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.material.Surface
import androidx.compose.material.minimumInteractiveComponentSize
import androidx.compose.material.ripple.rememberRipple
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.ripple
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
@ -31,7 +31,7 @@ fun CounterButton(
.minimumInteractiveComponentSize()
.clickable(
interactionSource = remember { MutableInteractionSource() },
indication = rememberRipple(bounded = false),
indication = ripple(bounded = false),
enabled = onClick != null,
onClick = { onClick?.invoke() },
)

View file

@ -7,11 +7,11 @@ import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Column
import androidx.compose.material.minimumInteractiveComponentSize
import androidx.compose.material.ripple.rememberRipple
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.ripple
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
@ -33,7 +33,7 @@ fun DiceButton(
.minimumInteractiveComponentSize()
.clickable(
interactionSource = remember { MutableInteractionSource() },
indication = rememberRipple(bounded = false),
indication = ripple(bounded = false),
onClick = onClick,
),
horizontalAlignment = Alignment.CenterHorizontally,

View file

@ -18,7 +18,7 @@ fun LazyGridItemScope.DraggableInventoryElement(
) {
Box(
modifier = Modifier
.animateItemPlacement()
.animateItem()
.graphicsLayer {
dragDropState.draggedItemElement?.let { element ->
this.alpha = when {