Skip to content

Commit fdc9143

Browse files
committed
bumping and fixing android example
1 parent 20ce5c6 commit fdc9143

11 files changed

Lines changed: 45 additions & 51 deletions

File tree

examples/projects/android-example/app/build.gradle.kts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,20 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
33
plugins {
44
alias(libs.plugins.android.application)
55
alias(libs.plugins.kotlin.compose)
6+
alias(libs.plugins.ktlint.gradle)
67

78
// DataFrame Compiler plugin, matching the Kotlin version
89
alias(libs.plugins.dataframe)
910
}
1011

1112
android {
1213
namespace = "com.example.myapplication"
13-
compileSdk = 36
14+
compileSdk = 37
1415

1516
defaultConfig {
1617
applicationId = "com.example.myapplication"
17-
minSdk = 21
18-
targetSdk = 36
18+
minSdk = 23
19+
targetSdk = 37
1920
versionCode = 1
2021
versionName = "1.0"
2122

examples/projects/android-example/app/src/androidTest/java/com/example/myapplication/ExampleInstrumentedTest.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
package com.example.myapplication
22

3-
import androidx.test.platform.app.InstrumentationRegistry
43
import androidx.test.ext.junit.runners.AndroidJUnit4
5-
4+
import androidx.test.platform.app.InstrumentationRegistry
5+
import org.junit.Assert.assertEquals
66
import org.junit.Test
77
import org.junit.runner.RunWith
88

9-
import org.junit.Assert.*
10-
119
/**
1210
* Instrumented test, which will execute on an Android device.
1311
*
@@ -21,4 +19,4 @@ class ExampleInstrumentedTest {
2119
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
2220
assertEquals("com.example.myapplication", appContext.packageName)
2321
}
24-
}
22+
}

examples/projects/android-example/app/src/main/java/com/example/myapplication/MainActivity.kt

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@file:Suppress("ktlint:standard:function-naming")
2+
13
package com.example.myapplication
24

35
import android.os.Bundle
@@ -30,10 +32,7 @@ import org.jetbrains.kotlinx.dataframe.api.filter
3032
import org.jetbrains.kotlinx.dataframe.api.rows
3133

3234
@DataSchema
33-
data class Person(
34-
val age: Int,
35-
val name: String
36-
)
35+
data class Person(val age: Int, val name: String)
3736

3837
class MainActivity : ComponentActivity() {
3938
override fun onCreate(savedInstanceState: Bundle?) {
@@ -42,7 +41,7 @@ class MainActivity : ComponentActivity() {
4241

4342
val df = dataFrameOf(
4443
"name" to listOf("Andrei", "Nikita", "Jolan"),
45-
"age" to listOf(22, 16, 37)
44+
"age" to listOf(22, 16, 37),
4645
).cast<Person>()
4746

4847
setContent {
@@ -60,7 +59,7 @@ class MainActivity : ComponentActivity() {
6059
fun DefaultDataFrameScreenPreview() {
6160
val df = dataFrameOf(
6261
"name" to listOf("Andrei", "Nikita", "Jolan"),
63-
"age" to listOf(22, 16, 37)
62+
"age" to listOf(22, 16, 37),
6463
).cast<Person>()
6564
DataFrameScreen(df)
6665
}
@@ -71,19 +70,19 @@ fun DataFrameScreen(df: DataFrame<Person>) {
7170
Column(
7271
modifier = Modifier
7372
.fillMaxSize()
74-
.padding(top = 48.dp, start = 16.dp, end = 16.dp)
73+
.padding(top = 48.dp, start = 16.dp, end = 16.dp),
7574
) {
7675
Text(
7776
text = "Kotlin DataFrame on Android",
7877
style = MaterialTheme.typography.headlineSmall,
79-
modifier = Modifier.padding(bottom = 16.dp)
78+
modifier = Modifier.padding(bottom = 16.dp),
8079
)
8180

8281
Text(
8382
text = "df",
8483
modifier = Modifier
8584
.background(color = Color.LightGray)
86-
.padding(2.dp)
85+
.padding(2.dp),
8786
)
8887

8988
DataFrameTable(df)
@@ -92,7 +91,7 @@ fun DataFrameScreen(df: DataFrame<Person>) {
9291
text = "df.filter { age >= 20 }",
9392
modifier = Modifier
9493
.background(color = Color.LightGray)
95-
.padding(2.dp)
94+
.padding(2.dp),
9695
)
9796

9897
DataFrameTable(filtered)
@@ -104,7 +103,7 @@ fun DataFrameScreen(df: DataFrame<Person>) {
104103
fun DefaultDataFrameTablePreview() {
105104
val df = dataFrameOf(
106105
"name" to listOf("Andrei", "Nikita", "Jolan"),
107-
"age" to listOf(22, 16, 37)
106+
"age" to listOf(22, 16, 37),
108107
).cast<Person>()
109108
DataFrameTable(df)
110109
}
@@ -124,7 +123,7 @@ fun DataFrameTable(df: DataFrame<*>) {
124123
modifier = Modifier
125124
.weight(1f)
126125
.padding(4.dp),
127-
style = MaterialTheme.typography.labelLarge
126+
style = MaterialTheme.typography.labelLarge,
128127
)
129128
}
130129
}
@@ -139,7 +138,7 @@ fun DataFrameTable(df: DataFrame<*>) {
139138
text = cell.toString(),
140139
modifier = Modifier
141140
.weight(1f)
142-
.padding(4.dp)
141+
.padding(4.dp),
143142
)
144143
}
145144
}
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
package com.example.myapplication
22

3+
import org.junit.Assert.assertEquals
34
import org.junit.Test
45

5-
import org.junit.Assert.*
6-
76
/**
87
* Example local unit test, which will execute on the development machine (host).
98
*
@@ -14,4 +13,4 @@ class ExampleUnitTest {
1413
fun addition_isCorrect() {
1514
assertEquals(4, 2 + 2)
1615
}
17-
}
16+
}

examples/projects/android-example/gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[versions]
2-
agp = "9.0.0"
2+
agp = "9.2.1"
33
kotlin = "2.4.0"
44
dataframe = "1.0.0-Beta5"
55
ktlint-gradle = "14.2.0"

examples/projects/dev/android-example/app/build.gradle.kts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,20 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
33
plugins {
44
alias(libs.plugins.android.application)
55
alias(libs.plugins.kotlin.compose)
6+
alias(libs.plugins.ktlint.gradle)
67

78
// DataFrame Compiler plugin, matching the Kotlin version
89
alias(libs.plugins.dataframe)
910
}
1011

1112
android {
1213
namespace = "com.example.myapplication"
13-
compileSdk = 36
14+
compileSdk = 37
1415

1516
defaultConfig {
1617
applicationId = "com.example.myapplication"
17-
minSdk = 21
18-
targetSdk = 36
18+
minSdk = 23
19+
targetSdk = 37
1920
versionCode = 1
2021
versionName = "1.0"
2122

examples/projects/dev/android-example/app/src/androidTest/java/com/example/myapplication/ExampleInstrumentedTest.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
package com.example.myapplication
22

3-
import androidx.test.platform.app.InstrumentationRegistry
43
import androidx.test.ext.junit.runners.AndroidJUnit4
5-
4+
import androidx.test.platform.app.InstrumentationRegistry
5+
import org.junit.Assert.assertEquals
66
import org.junit.Test
77
import org.junit.runner.RunWith
88

9-
import org.junit.Assert.*
10-
119
/**
1210
* Instrumented test, which will execute on an Android device.
1311
*
@@ -21,4 +19,4 @@ class ExampleInstrumentedTest {
2119
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
2220
assertEquals("com.example.myapplication", appContext.packageName)
2321
}
24-
}
22+
}

examples/projects/dev/android-example/app/src/main/java/com/example/myapplication/MainActivity.kt

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@file:Suppress("ktlint:standard:function-naming")
2+
13
package com.example.myapplication
24

35
import android.os.Bundle
@@ -30,10 +32,7 @@ import org.jetbrains.kotlinx.dataframe.api.filter
3032
import org.jetbrains.kotlinx.dataframe.api.rows
3133

3234
@DataSchema
33-
data class Person(
34-
val age: Int,
35-
val name: String
36-
)
35+
data class Person(val age: Int, val name: String)
3736

3837
class MainActivity : ComponentActivity() {
3938
override fun onCreate(savedInstanceState: Bundle?) {
@@ -42,7 +41,7 @@ class MainActivity : ComponentActivity() {
4241

4342
val df = dataFrameOf(
4443
"name" to listOf("Andrei", "Nikita", "Jolan"),
45-
"age" to listOf(22, 16, 37)
44+
"age" to listOf(22, 16, 37),
4645
).cast<Person>()
4746

4847
setContent {
@@ -60,7 +59,7 @@ class MainActivity : ComponentActivity() {
6059
fun DefaultDataFrameScreenPreview() {
6160
val df = dataFrameOf(
6261
"name" to listOf("Andrei", "Nikita", "Jolan"),
63-
"age" to listOf(22, 16, 37)
62+
"age" to listOf(22, 16, 37),
6463
).cast<Person>()
6564
DataFrameScreen(df)
6665
}
@@ -71,19 +70,19 @@ fun DataFrameScreen(df: DataFrame<Person>) {
7170
Column(
7271
modifier = Modifier
7372
.fillMaxSize()
74-
.padding(top = 48.dp, start = 16.dp, end = 16.dp)
73+
.padding(top = 48.dp, start = 16.dp, end = 16.dp),
7574
) {
7675
Text(
7776
text = "Kotlin DataFrame on Android",
7877
style = MaterialTheme.typography.headlineSmall,
79-
modifier = Modifier.padding(bottom = 16.dp)
78+
modifier = Modifier.padding(bottom = 16.dp),
8079
)
8180

8281
Text(
8382
text = "df",
8483
modifier = Modifier
8584
.background(color = Color.LightGray)
86-
.padding(2.dp)
85+
.padding(2.dp),
8786
)
8887

8988
DataFrameTable(df)
@@ -92,7 +91,7 @@ fun DataFrameScreen(df: DataFrame<Person>) {
9291
text = "df.filter { age >= 20 }",
9392
modifier = Modifier
9493
.background(color = Color.LightGray)
95-
.padding(2.dp)
94+
.padding(2.dp),
9695
)
9796

9897
DataFrameTable(filtered)
@@ -104,7 +103,7 @@ fun DataFrameScreen(df: DataFrame<Person>) {
104103
fun DefaultDataFrameTablePreview() {
105104
val df = dataFrameOf(
106105
"name" to listOf("Andrei", "Nikita", "Jolan"),
107-
"age" to listOf(22, 16, 37)
106+
"age" to listOf(22, 16, 37),
108107
).cast<Person>()
109108
DataFrameTable(df)
110109
}
@@ -124,7 +123,7 @@ fun DataFrameTable(df: DataFrame<*>) {
124123
modifier = Modifier
125124
.weight(1f)
126125
.padding(4.dp),
127-
style = MaterialTheme.typography.labelLarge
126+
style = MaterialTheme.typography.labelLarge,
128127
)
129128
}
130129
}
@@ -139,7 +138,7 @@ fun DataFrameTable(df: DataFrame<*>) {
139138
text = cell.toString(),
140139
modifier = Modifier
141140
.weight(1f)
142-
.padding(4.dp)
141+
.padding(4.dp),
143142
)
144143
}
145144
}
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
package com.example.myapplication
22

3+
import org.junit.Assert.assertEquals
34
import org.junit.Test
45

5-
import org.junit.Assert.*
6-
76
/**
87
* Example local unit test, which will execute on the development machine (host).
98
*
@@ -14,4 +13,4 @@ class ExampleUnitTest {
1413
fun addition_isCorrect() {
1514
assertEquals(4, 2 + 2)
1615
}
17-
}
16+
}

examples/projects/dev/android-example/gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[versions]
2-
agp = "9.0.0"
2+
agp = "9.2.1"
33
kotlin = "2.4.0"
44
dataframe = "1.0.0-Beta5"
55
ktlint-gradle = "14.2.0"

0 commit comments

Comments
 (0)