diff --git a/app/build.gradle.kts b/app/build.gradle.kts index a831abd3a..951d77b5e 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -54,10 +54,11 @@ tasks.withType().configureEach { ) } } -val compose_version = "1.6.7" +val compose_version = libs.versions.compose.version.get() + dependencies { implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) - implementation("androidx.activity:activity-compose:1.9.0") + implementation("androidx.activity:activity-compose:1.9.2") implementation("androidx.appcompat:appcompat:1.7.0") implementation("androidx.compose.animation:animation-core:$compose_version") implementation("androidx.compose.animation:animation:$compose_version") @@ -75,7 +76,7 @@ dependencies { implementation("androidx.compose.ui:ui-tooling:$compose_version") implementation("androidx.compose.ui:ui:$compose_version") implementation("androidx.core:core-ktx:1.13.1") - implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.1") + implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.5") implementation("com.google.android.material:material:1.12.0") implementation("androidx.compose.ui:ui-viewbinding:$compose_version") implementation("androidx.compose.ui:ui-text:$compose_version") @@ -84,17 +85,17 @@ dependencies { implementation("androidx.constraintlayout:constraintlayout-compose:1.0.1") testImplementation("junit:junit:4.13.2") - androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") - androidTestImplementation("androidx.test:runner:1.5.2") + androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1") + androidTestImplementation("androidx.test:runner:1.6.2") androidTestImplementation("androidx.compose.ui:ui-test-junit4:$compose_version") androidTestImplementation("androidx.compose.ui:ui-test:$compose_version") - androidTestImplementation("androidx.test.espresso:espresso-intents:3.5.1") - androidTestImplementation("androidx.test.ext:junit:1.1.5") - androidTestImplementation("androidx.test:core:1.5.0") - androidTestImplementation("androidx.test:rules:1.5.0") - androidTestImplementation("androidx.test:runner:1.5.2") + androidTestImplementation("androidx.test.espresso:espresso-intents:3.6.1") + androidTestImplementation("androidx.test.ext:junit:1.2.1") + androidTestImplementation("androidx.test:core:1.6.1") + androidTestImplementation("androidx.test:rules:1.6.1") + androidTestImplementation("androidx.test:runner:1.6.2") androidTestImplementation("com.android.support.test.espresso:espresso-core:3.0.2") - androidTestImplementation("org.mockito:mockito-core:5.3.1") + androidTestImplementation("org.mockito:mockito-core:5.12.0") debugImplementation("androidx.compose.ui:ui-test-manifest:$compose_version") androidTestImplementation("com.adevinta.android:barista:4.3.0") { diff --git a/app/src/main/java/de/jensklingenberg/jetpackcomposeplayground/mysamples/github/foundation/basictextfield/BasicTextFieldDemo.kt b/app/src/main/java/de/jensklingenberg/jetpackcomposeplayground/mysamples/github/foundation/basictextfield/BasicTextFieldDemo.kt index 3a5b3869a..410a42632 100644 --- a/app/src/main/java/de/jensklingenberg/jetpackcomposeplayground/mysamples/github/foundation/basictextfield/BasicTextFieldDemo.kt +++ b/app/src/main/java/de/jensklingenberg/jetpackcomposeplayground/mysamples/github/foundation/basictextfield/BasicTextFieldDemo.kt @@ -1,11 +1,13 @@ package de.jensklingenberg.jetpackcomposeplayground.mysamples.github.foundation.basictextfield +import androidx.activity.compose.BackHandler import androidx.compose.foundation.layout.Column import androidx.compose.foundation.text.BasicTextField import androidx.compose.material.Text import androidx.compose.runtime.* import androidx.compose.ui.text.input.TextFieldValue +//# --8<-- [start:func] @Composable fun BasicTextFieldDemo() { var textState by remember { mutableStateOf(TextFieldValue("Hello World")) } @@ -15,4 +17,5 @@ fun BasicTextFieldDemo() { }) Text("The textfield has this text: " + textState.text) } -} \ No newline at end of file +} +//# --8<-- [end:func] \ No newline at end of file diff --git a/build.gradle b/build.gradle.kts similarity index 54% rename from build.gradle rename to build.gradle.kts index 145dab572..cba35096a 100644 --- a/build.gradle +++ b/build.gradle.kts @@ -1,25 +1,17 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. - buildscript { - ext { - compose_version = '1.6.7' - kotlin_version = "2.0.0" - } + repositories { google() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:8.0.2' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath("com.android.tools.build:gradle:8.6.0") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${libs.versions.kotlin.get()}") // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } -tasks.register('clean', Delete) { - delete rootProject.buildDir -} - diff --git a/docs/foundation/basictextfield.md b/docs/foundation/basictextfield.md index 2f82cd135..b1ed3a11d 100644 --- a/docs/foundation/basictextfield.md +++ b/docs/foundation/basictextfield.md @@ -11,16 +11,7 @@ BasicTextField can be used to insert text. See [TextField](../material/textfield

```kotlin -@Composable -fun BasicTextFieldDemo() { - var textState by remember { mutableStateOf(TextFieldValue("Hello World")) } - Column { - BasicTextField(value = textState, onValueChange = { - textState = it - }) - Text("The textfield has this text: " + textState.text) - } -} +--8<-- "foundation/basictextfield/BasicTextFieldDemo.kt:func" ``` ------------- diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 71c27a925..e6e7dc9b9 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,8 +1,6 @@ [versions] -kotlin = "2.0.0" -compose_version = "1.6.7" -[plugins] -org-jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } - +kotlin = "2.0.20" +compose_version = "1.7.0" -compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } +[plugins] +compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } \ No newline at end of file