From 7acc7f8ce1952d180e36980da5b7e80b9661cf29 Mon Sep 17 00:00:00 2001 From: Sungyong An Date: Mon, 14 Aug 2023 22:24:11 +0900 Subject: [PATCH] Goodbye constraintlayout-compose --- feature/about/build.gradle.kts | 1 - feature/floor-map/build.gradle.kts | 1 - feature/sessions/build.gradle.kts | 1 - .../sessions/section/BookmarkSheet.kt | 59 ++++++++----------- feature/sponsors/build.gradle.kts | 1 - gradle/libs.versions.toml | 1 - 6 files changed, 24 insertions(+), 40 deletions(-) diff --git a/feature/about/build.gradle.kts b/feature/about/build.gradle.kts index 1cd7aa929..53b2075f9 100644 --- a/feature/about/build.gradle.kts +++ b/feature/about/build.gradle.kts @@ -17,7 +17,6 @@ dependencies { implementation(libs.composeUiToolingPreview) implementation(libs.androidxLifecycleLifecycleRuntimeKtx) implementation(libs.androidxActivityActivityCompose) - implementation(libs.composeConstraintLayout) implementation(libs.composeMaterialIcon) androidTestImplementation(libs.composeUiTestJunit4) debugImplementation(libs.composeUiTooling) diff --git a/feature/floor-map/build.gradle.kts b/feature/floor-map/build.gradle.kts index 04ece6bce..c3234c9a4 100644 --- a/feature/floor-map/build.gradle.kts +++ b/feature/floor-map/build.gradle.kts @@ -17,7 +17,6 @@ dependencies { implementation(libs.composeUiToolingPreview) implementation(libs.androidxLifecycleLifecycleRuntimeKtx) implementation(libs.androidxActivityActivityCompose) - implementation(libs.composeConstraintLayout) implementation(libs.composeMaterialIcon) androidTestImplementation(libs.composeUiTestJunit4) debugImplementation(libs.composeUiTooling) diff --git a/feature/sessions/build.gradle.kts b/feature/sessions/build.gradle.kts index f71c4fc69..4750904f9 100644 --- a/feature/sessions/build.gradle.kts +++ b/feature/sessions/build.gradle.kts @@ -17,7 +17,6 @@ dependencies { implementation(libs.composeUiToolingPreview) implementation(libs.androidxLifecycleLifecycleRuntimeKtx) implementation(libs.androidxActivityActivityCompose) - implementation(libs.composeConstraintLayout) implementation(libs.composeMaterialIcon) androidTestImplementation(libs.composeUiTestJunit4) debugImplementation(libs.composeUiTooling) diff --git a/feature/sessions/src/main/java/io/github/droidkaigi/confsched2023/sessions/section/BookmarkSheet.kt b/feature/sessions/src/main/java/io/github/droidkaigi/confsched2023/sessions/section/BookmarkSheet.kt index 3042365f4..45ee3da70 100644 --- a/feature/sessions/src/main/java/io/github/droidkaigi/confsched2023/sessions/section/BookmarkSheet.kt +++ b/feature/sessions/src/main/java/io/github/droidkaigi/confsched2023/sessions/section/BookmarkSheet.kt @@ -1,10 +1,12 @@ package io.github.droidkaigi.confsched2023.sessions.section import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.lazy.LazyListState @@ -21,7 +23,6 @@ import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import androidx.constraintlayout.compose.ConstraintLayout import io.github.droidkaigi.confsched2023.model.TimetableItem import io.github.droidkaigi.confsched2023.sessions.BookmarkScreenUiState import io.github.droidkaigi.confsched2023.sessions.BookmarkScreenUiState.Empty @@ -74,22 +75,18 @@ fun BookmarkSheet( @Composable private fun EmptyView() { - ConstraintLayout( + Column( modifier = Modifier.fillMaxSize(), + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.Center, ) { - val (emptyText, icon) = createRefs() Box( modifier = Modifier .size(84.dp) .background( color = Color(0xFFCEE9DB), shape = RoundedCornerShape(24.dp), - ) - .constrainAs(icon) { - start.linkTo(parent.start) - end.linkTo(parent.end) - bottom.linkTo(emptyText.top, margin = 24.dp) - }, + ), contentAlignment = Alignment.Center, ) { Icon( @@ -97,31 +94,23 @@ private fun EmptyView() { contentDescription = null, ) } - Column( - modifier = Modifier.constrainAs(emptyText) { - start.linkTo(parent.start) - end.linkTo(parent.end) - top.linkTo(parent.top) - bottom.linkTo(parent.bottom) - }, - horizontalAlignment = Alignment.CenterHorizontally, - ) { - Text( - text = BookmarkedItemNotFound.asString(), - fontSize = 16.sp, - fontWeight = FontWeight.Medium, - lineHeight = 24.sp, - color = Color(0xFF191C1A), - ) - Spacer(modifier = Modifier.size(8.dp)) - Text( - text = BookmarkedItemNotFoundSideNote.asString(), - fontSize = 14.sp, - lineHeight = 20.sp, - letterSpacing = 0.25.sp, - textAlign = TextAlign.Center, - color = Color(0xFF404944), - ) - } + Spacer(modifier = Modifier.height(24.dp)) + Text( + text = BookmarkedItemNotFound.asString(), + fontSize = 16.sp, + fontWeight = FontWeight.Medium, + lineHeight = 24.sp, + color = Color(0xFF191C1A), + ) + Spacer(modifier = Modifier.size(8.dp)) + Text( + text = BookmarkedItemNotFoundSideNote.asString(), + fontSize = 14.sp, + lineHeight = 20.sp, + letterSpacing = 0.25.sp, + textAlign = TextAlign.Center, + color = Color(0xFF404944), + ) + Spacer(modifier = Modifier.height(108.dp)) } } diff --git a/feature/sponsors/build.gradle.kts b/feature/sponsors/build.gradle.kts index fc7d1a9eb..e8f1ad774 100644 --- a/feature/sponsors/build.gradle.kts +++ b/feature/sponsors/build.gradle.kts @@ -17,7 +17,6 @@ dependencies { implementation(libs.composeUiToolingPreview) implementation(libs.androidxLifecycleLifecycleRuntimeKtx) implementation(libs.androidxActivityActivityCompose) - implementation(libs.composeConstraintLayout) implementation(libs.composeMaterialIcon) androidTestImplementation(libs.composeUiTestJunit4) debugImplementation(libs.composeUiTooling) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index fe3beca2c..8a037a9a9 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -74,7 +74,6 @@ composeUiTestManifest = { module = "androidx.compose.ui:ui-test-manifest", versi composeHiltNavigtation = { module = "androidx.hilt:hilt-navigation-compose", version.ref = "composeHiltNavigatiaon" } composeLintCheck = { module = "com.slack.lint.compose:compose-lint-checks", version = "1.2.0" } composeCoil = { module = "io.coil-kt:coil-compose", version = "2.4.0" } -composeConstraintLayout = { module = "androidx.constraintlayout:constraintlayout-compose", version = "1.0.1" } composeImageLoader = { module = "io.github.qdsfdhvh:image-loader", version = "1.6.4" } accompanistSystemUiController = { module = "com.google.accompanist:accompanist-systemuicontroller", version.ref = "accompanist" }