From 33a3e360a4cc422fa534f9092ea1ebd3c08f0a21 Mon Sep 17 00:00:00 2001 From: AnirudhPudari Date: Sun, 16 Apr 2023 13:34:35 +0530 Subject: [PATCH] Deprecated FlowLayouts from accompanist --- app-nia-catalog/build.gradle.kts | 1 - .../samples/apps/niacatalog/ui/Catalog.kt | 20 ++++++++++--------- feature/foryou/build.gradle.kts | 1 - gradle/libs.versions.toml | 1 - 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/app-nia-catalog/build.gradle.kts b/app-nia-catalog/build.gradle.kts index bf0695fd3..42ffd7039 100644 --- a/app-nia-catalog/build.gradle.kts +++ b/app-nia-catalog/build.gradle.kts @@ -67,6 +67,5 @@ android { dependencies { implementation(project(":core:designsystem")) implementation(project(":core:ui")) - implementation(libs.accompanist.flowlayout) implementation(libs.androidx.activity.compose) } diff --git a/app-nia-catalog/src/main/java/com/google/samples/apps/niacatalog/ui/Catalog.kt b/app-nia-catalog/src/main/java/com/google/samples/apps/niacatalog/ui/Catalog.kt index a18600f33..54e4264fa 100644 --- a/app-nia-catalog/src/main/java/com/google/samples/apps/niacatalog/ui/Catalog.kt +++ b/app-nia-catalog/src/main/java/com/google/samples/apps/niacatalog/ui/Catalog.kt @@ -17,6 +17,8 @@ package com.google.samples.apps.niacatalog.ui import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.ExperimentalLayoutApi +import androidx.compose.foundation.layout.FlowRow import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.add import androidx.compose.foundation.layout.asPaddingValues @@ -36,7 +38,6 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.res.painterResource import androidx.compose.ui.unit.dp -import com.google.accompanist.flowlayout.FlowRow import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaButton import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaFilterChip import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaIconToggleButton @@ -54,6 +55,7 @@ import com.google.samples.apps.nowinandroid.core.designsystem.theme.NiaTheme /** * Now in Android component catalog. */ +@OptIn(ExperimentalLayoutApi::class) @Composable fun NiaCatalog() { NiaTheme { @@ -75,7 +77,7 @@ fun NiaCatalog() { } item { Text("Buttons", Modifier.padding(top = 16.dp)) } item { - FlowRow(mainAxisSpacing = 16.dp) { + FlowRow(horizontalArrangement = Arrangement.spacedBy(16.dp)) { NiaButton(onClick = {}) { Text(text = "Enabled") } @@ -89,7 +91,7 @@ fun NiaCatalog() { } item { Text("Disabled buttons", Modifier.padding(top = 16.dp)) } item { - FlowRow(mainAxisSpacing = 16.dp) { + FlowRow(horizontalArrangement = Arrangement.spacedBy(16.dp)) { NiaButton( onClick = {}, enabled = false, @@ -112,7 +114,7 @@ fun NiaCatalog() { } item { Text("Buttons with leading icons", Modifier.padding(top = 16.dp)) } item { - FlowRow(mainAxisSpacing = 16.dp) { + FlowRow(horizontalArrangement = Arrangement.spacedBy(16.dp)) { NiaButton( onClick = {}, text = { Text(text = "Enabled") }, @@ -138,7 +140,7 @@ fun NiaCatalog() { } item { Text("Disabled buttons with leading icons", Modifier.padding(top = 16.dp)) } item { - FlowRow(mainAxisSpacing = 16.dp) { + FlowRow(horizontalArrangement = Arrangement.spacedBy(16.dp)) { NiaButton( onClick = {}, enabled = false, @@ -168,7 +170,7 @@ fun NiaCatalog() { item { Text("Dropdown menus", Modifier.padding(top = 16.dp)) } item { Text("Chips", Modifier.padding(top = 16.dp)) } item { - FlowRow(mainAxisSpacing = 16.dp) { + FlowRow(horizontalArrangement = Arrangement.spacedBy(16.dp)) { var firstChecked by remember { mutableStateOf(false) } NiaFilterChip( selected = firstChecked, @@ -197,7 +199,7 @@ fun NiaCatalog() { } item { Text("Icon buttons", Modifier.padding(top = 16.dp)) } item { - FlowRow(mainAxisSpacing = 16.dp) { + FlowRow(horizontalArrangement = Arrangement.spacedBy(16.dp)) { var firstChecked by remember { mutableStateOf(false) } NiaIconToggleButton( checked = firstChecked, @@ -270,7 +272,7 @@ fun NiaCatalog() { } item { Text("View toggle", Modifier.padding(top = 16.dp)) } item { - FlowRow(mainAxisSpacing = 16.dp) { + FlowRow(horizontalArrangement = Arrangement.spacedBy(16.dp)) { var firstExpanded by remember { mutableStateOf(false) } NiaViewToggleButton( expanded = firstExpanded, @@ -296,7 +298,7 @@ fun NiaCatalog() { } item { Text("Tags", Modifier.padding(top = 16.dp)) } item { - FlowRow(mainAxisSpacing = 16.dp) { + FlowRow(horizontalArrangement = Arrangement.spacedBy(16.dp)) { NiaTopicTag( followed = true, onClick = {}, diff --git a/feature/foryou/build.gradle.kts b/feature/foryou/build.gradle.kts index ad50e531b..8c6747dd1 100644 --- a/feature/foryou/build.gradle.kts +++ b/feature/foryou/build.gradle.kts @@ -27,7 +27,6 @@ android { } dependencies { - implementation(libs.accompanist.flowlayout) implementation(libs.kotlinx.datetime) implementation(libs.androidx.activity.compose) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c3648e5b6..3b0c61b74 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -53,7 +53,6 @@ secrets = "2.0.1" turbine = "0.12.1" [libraries] -accompanist-flowlayout = { group = "com.google.accompanist", name = "accompanist-flowlayout", version.ref = "accompanist" } accompanist-systemuicontroller = { group = "com.google.accompanist", name = "accompanist-systemuicontroller", version.ref = "accompanist" } accompanist-testharness = { group = "com.google.accompanist", name = "accompanist-testharness", version.ref = "accompanist" } android-desugarJdkLibs = { group = "com.android.tools", name = "desugar_jdk_libs", version.ref = "androidDesugarJdkLibs" }