Browse Source

Update example todoapp to Kotlin 1.4.30 and deps (#379)

pull/384/head
Arkadii Ivanov 4 years ago committed by GitHub
parent
commit
1d5fdbcc73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      examples/todoapp/android/build.gradle.kts
  2. 2
      examples/todoapp/android/src/main/java/example/todo/android/MainActivity.kt
  3. 14
      examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt
  4. 7
      examples/todoapp/common/compose-ui/src/commonMain/kotlin/example/todo/common/ui/TodoMainUi.kt

9
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")
}
}

2
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

14
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"

7
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,7 +68,8 @@ private fun TodoList(
Box {
val listState = rememberLazyListState()
LazyColumnFor(items = items, state = listState) {
LazyColumn(state = listState) {
items(items) {
Item(
item = it,
onItemClicked = onItemClicked,
@ -77,6 +79,7 @@ private fun TodoList(
Divider()
}
}
VerticalScrollbar(
modifier = Modifier.align(Alignment.CenterEnd).fillMaxHeight(),

Loading…
Cancel
Save