From 1d5fdbcc73f3e0d6134e9dd7d8bd579afc7a69cd Mon Sep 17 00:00:00 2001 From: Arkadii Ivanov Date: Mon, 15 Feb 2021 06:35:22 +0000 Subject: [PATCH] Update example todoapp to Kotlin 1.4.30 and deps (#379) --- examples/todoapp/android/build.gradle.kts | 9 ++++++++ .../java/example/todo/android/MainActivity.kt | 2 +- .../buildSrc/buildSrc/src/main/kotlin/Deps.kt | 14 +++++++---- .../example/todo/common/ui/TodoMainUi.kt | 23 +++++++++++-------- 4 files changed, 32 insertions(+), 16 deletions(-) diff --git a/examples/todoapp/android/build.gradle.kts b/examples/todoapp/android/build.gradle.kts index 0a8a6224f7..e351cdb72c 100755 --- a/examples/todoapp/android/build.gradle.kts +++ b/examples/todoapp/android/build.gradle.kts @@ -39,4 +39,13 @@ dependencies { implementation(Deps.ArkIvanov.Decompose.decompose) implementation(Deps.ArkIvanov.Decompose.extensionsCompose) implementation(Deps.AndroidX.AppCompat.appCompat) + + implementation(Deps.AndroidX.Activity.activityCompose) { + // Workaround as per https://github.com/JetBrains/compose-jb/issues/354#issuecomment-777122304 + exclude(group = "androidx.compose.animation") + exclude(group = "androidx.compose.foundation") + exclude(group = "androidx.compose.material") + exclude(group = "androidx.compose.runtime") + exclude(group = "androidx.compose.ui") + } } diff --git a/examples/todoapp/android/src/main/java/example/todo/android/MainActivity.kt b/examples/todoapp/android/src/main/java/example/todo/android/MainActivity.kt index c3388c388d..08bdad60cb 100755 --- a/examples/todoapp/android/src/main/java/example/todo/android/MainActivity.kt +++ b/examples/todoapp/android/src/main/java/example/todo/android/MainActivity.kt @@ -1,10 +1,10 @@ package example.todo.android import android.os.Bundle +import androidx.activity.compose.setContent import androidx.appcompat.app.AppCompatActivity import androidx.compose.material.MaterialTheme import androidx.compose.material.Surface -import androidx.compose.ui.platform.setContent import com.arkivanov.decompose.ComponentContext import com.arkivanov.decompose.extensions.compose.jetbrains.rootComponent import com.arkivanov.mvikotlin.core.store.StoreFactory diff --git a/examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt b/examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt index 38c54d72db..5ea28c7503 100644 --- a/examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt +++ b/examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt @@ -3,7 +3,7 @@ object Deps { object JetBrains { object Kotlin { // __KOTLIN_COMPOSE_VERSION__ - private const val VERSION = "1.4.21-2" + private const val VERSION = "1.4.30" const val gradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$VERSION" const val testCommon = "org.jetbrains.kotlin:kotlin-test-common:$VERSION" const val testJunit = "org.jetbrains.kotlin:kotlin-test-junit:$VERSION" @@ -12,7 +12,7 @@ object Deps { object Compose { // __LATEST_COMPOSE_RELEASE_VERSION__ - private const val VERSION = "0.3.0-build146" + private const val VERSION = "0.3.0-build152" const val gradlePlugin = "org.jetbrains.compose:compose-gradle-plugin:$VERSION" } } @@ -29,11 +29,15 @@ object Deps { object AppCompat { const val appCompat = "androidx.appcompat:appcompat:1.1.0" } + + object Activity { + const val activityCompose = "androidx.activity:activity-compose:1.3.0-alpha02" + } } object ArkIvanov { object MVIKotlin { - private const val VERSION = "2.0.0" + private const val VERSION = "2.0.1" const val rx = "com.arkivanov.mvikotlin:rx:$VERSION" const val mvikotlin = "com.arkivanov.mvikotlin:mvikotlin:$VERSION" const val mvikotlinMain = "com.arkivanov.mvikotlin:mvikotlin-main:$VERSION" @@ -45,7 +49,7 @@ object Deps { } object Decompose { - private const val VERSION = "0.1.7" + private const val VERSION = "0.1.8" const val decompose = "com.arkivanov.decompose:decompose:$VERSION" const val decomposeIosX64 = "com.arkivanov.decompose:decompose-iosx64:$VERSION" const val decomposeIosArm64 = "com.arkivanov.decompose:decompose-iosarm64:$VERSION" @@ -55,7 +59,7 @@ object Deps { object Badoo { object Reaktive { - private const val VERSION = "1.1.19" + private const val VERSION = "1.1.20" const val reaktive = "com.badoo.reaktive:reaktive:$VERSION" const val reaktiveTesting = "com.badoo.reaktive:reaktive-testing:$VERSION" const val utils = "com.badoo.reaktive:utils:$VERSION" diff --git a/examples/todoapp/common/compose-ui/src/commonMain/kotlin/example/todo/common/ui/TodoMainUi.kt b/examples/todoapp/common/compose-ui/src/commonMain/kotlin/example/todo/common/ui/TodoMainUi.kt index 59a3c7b6a7..fc76d65684 100644 --- a/examples/todoapp/common/compose-ui/src/commonMain/kotlin/example/todo/common/ui/TodoMainUi.kt +++ b/examples/todoapp/common/compose-ui/src/commonMain/kotlin/example/todo/common/ui/TodoMainUi.kt @@ -8,7 +8,8 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width -import androidx.compose.foundation.lazy.LazyColumnFor +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.items import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.material.Checkbox import androidx.compose.material.Divider @@ -67,15 +68,17 @@ private fun TodoList( Box { val listState = rememberLazyListState() - LazyColumnFor(items = items, state = listState) { - Item( - item = it, - onItemClicked = onItemClicked, - onDoneChanged = onDoneChanged, - onDeleteItemClicked = onDeleteItemClicked - ) - - Divider() + LazyColumn(state = listState) { + items(items) { + Item( + item = it, + onItemClicked = onItemClicked, + onDoneChanged = onDoneChanged, + onDeleteItemClicked = onDeleteItemClicked + ) + + Divider() + } } VerticalScrollbar(