Skip to content

Commit

Permalink
dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
mmmateos committed Sep 21, 2023
1 parent 85b6ae1 commit e2323e4
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 23 deletions.
3 changes: 3 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ repositories {
dependencies {
implementation(project(":common"))
implementation("androidx.activity:activity-compose:1.5.0")
implementation("org.hisp.dhis:android-core:1.9.0-SNAPSHOT")
}

android {
Expand All @@ -26,8 +27,8 @@ android {
versionName = "1.0-SNAPSHOT"
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
buildTypes {
getByName("release") {
Expand Down
7 changes: 4 additions & 3 deletions android/src/main/java/com/example/android/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package com.example.android

import com.example.common.App
import android.os.Bundle
import androidx.activity.compose.setContent
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.material.MaterialTheme
import androidx.compose.material3.MaterialTheme
import com.example.common.App
import org.hisp.dhis.android.core.D2

class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
Expand All @@ -15,4 +16,4 @@ class MainActivity : AppCompatActivity() {
}
}
}
}
}
8 changes: 4 additions & 4 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ kotlin {
dependencies {
api(compose.runtime)
api(compose.foundation)
api(compose.material)
@OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
api(compose.material3)
api("org.hisp.dhis.mobile:designsystem:1.0-SNAPSHOT")
}
}
Expand All @@ -32,7 +33,6 @@ kotlin {
dependencies {
api("androidx.appcompat:appcompat:1.5.1")
api("androidx.core:core-ktx:1.9.0")
implementation("org.hisp.dhis:android-core:1.9.0-SNAPSHOT")
}
}
val androidTest by getting {
Expand All @@ -57,7 +57,7 @@ android {
targetSdkVersion(33)
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}
28 changes: 15 additions & 13 deletions common/src/commonMain/kotlin/com/example/common/App.kt
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
package com.example.common

import androidx.compose.material.Text
import androidx.compose.material.Button
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import com.example.common.model.AttendanceTei
import org.hisp.dhis.mobile.ui.designsystem.theme.DHIS2Theme

@Composable
fun App() {
var text by remember { mutableStateOf("Hello, World!") }
val platformName = getPlatformName()

Button(onClick = {
text = "Hello, ${platformName}"
}) {
Text(text)
DHIS2Theme {
LazyColumn {
items(8) {
AttendanceItem(
AttendanceTei(
firstName = "Manu",
lastName = "Muñoz",
attend = false,
),
)
}
}
}
}
35 changes: 35 additions & 0 deletions common/src/commonMain/kotlin/com/example/common/AttendanceItem.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.example.common

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.example.common.model.AttendanceTei
import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing
import org.hisp.dhis.mobile.ui.designsystem.theme.SurfaceColor
import org.hisp.dhis.mobile.ui.designsystem.theme.TextColor

@Composable
fun AttendanceItem(attendanceItem: AttendanceTei) {
Row {
Text(
attendanceItem.firstName.first().toString(),
style = MaterialTheme.typography.labelLarge,
color = TextColor.OnPrimary,
modifier = Modifier
.background(SurfaceColor.Primary, CircleShape)
.padding(Spacing.Spacing10),
)
Text(
attendanceItem.firstName + attendanceItem.lastName,
style = MaterialTheme.typography.titleLarge,
color = TextColor.OnSurface,
modifier = Modifier.padding(Spacing.Spacing10),
)
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.example.common.model

data class AttendanceTei(
val firstName: String,
val lastName: String,
val attend: Boolean
)
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ kotlin.native.enableDependencyPropagation=false
android.useAndroidX=true
kotlin.version=1.8.0
agp.version=7.3.0
compose.version=1.3.0
compose.version=1.5.1

0 comments on commit e2323e4

Please sign in to comment.