Skip to content

Commit 29e8ff5

Browse files
committed
setup
1 parent 1a372e2 commit 29e8ff5

File tree

4 files changed

+32
-23
lines changed

4 files changed

+32
-23
lines changed

app/build.gradle.kts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
plugins {
33
alias(libs.plugins.androidApplication)
44
alias(libs.plugins.kotlinAndroid)
5+
alias(libs.plugins.kotlinKapt)
6+
alias(libs.plugins.hilt)
57
}
68

79
android {
@@ -31,11 +33,11 @@ android {
3133
}
3234
}
3335
compileOptions {
34-
sourceCompatibility = JavaVersion.VERSION_1_8
35-
targetCompatibility = JavaVersion.VERSION_1_8
36+
sourceCompatibility = JavaVersion.VERSION_17
37+
targetCompatibility = JavaVersion.VERSION_17
3638
}
3739
kotlinOptions {
38-
jvmTarget = "1.8"
40+
jvmTarget = "17"
3941
}
4042
buildFeatures {
4143
compose = true
@@ -67,4 +69,13 @@ dependencies {
6769
androidTestImplementation(libs.ui.test.junit4)
6870
debugImplementation(libs.ui.tooling)
6971
debugImplementation(libs.ui.test.manifest)
72+
73+
implementation(libs.lifecycle.viewmodel)
74+
implementation(libs.hilt.android)
75+
implementation(libs.hilt.navigation)
76+
kapt(libs.hilt.android.compiler)
77+
implementation(libs.compose.ui.util)
78+
implementation(libs.navigation.compose)
79+
implementation(libs.compose.material)
80+
implementation(libs.hilt.navigation.compose)
7081
}

app/src/main/java/com/devsadeq/pizzaorderapp/MainActivity.kt

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ import androidx.activity.compose.setContent
66
import androidx.compose.foundation.layout.fillMaxSize
77
import androidx.compose.material3.MaterialTheme
88
import androidx.compose.material3.Surface
9-
import androidx.compose.material3.Text
10-
import androidx.compose.runtime.Composable
119
import androidx.compose.ui.Modifier
12-
import androidx.compose.ui.tooling.preview.Preview
10+
import com.devsadeq.pizzaorderapp.ui.screen.OrderScreen
1311
import com.devsadeq.pizzaorderapp.ui.theme.PizzaOrderAppTheme
1412

1513
class MainActivity : ComponentActivity() {
@@ -22,25 +20,9 @@ class MainActivity : ComponentActivity() {
2220
modifier = Modifier.fillMaxSize(),
2321
color = MaterialTheme.colorScheme.background
2422
) {
25-
Greeting("Android")
23+
OrderScreen()
2624
}
2725
}
2826
}
2927
}
30-
}
31-
32-
@Composable
33-
fun Greeting(name: String, modifier: Modifier = Modifier) {
34-
Text(
35-
text = "Hello $name!",
36-
modifier = modifier
37-
)
38-
}
39-
40-
@Preview(showBackground = true)
41-
@Composable
42-
fun GreetingPreview() {
43-
PizzaOrderAppTheme {
44-
Greeting("Android")
45-
}
4628
}

build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33
plugins {
44
alias(libs.plugins.androidApplication) apply false
55
alias(libs.plugins.kotlinAndroid) apply false
6+
alias(libs.plugins.kotlinKapt) apply false
7+
alias(libs.plugins.hilt) apply false
68
}
79
true // Needed to make the Suppress annotation work for the plugins block

gradle/libs.versions.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ espresso-core = "3.5.1"
88
lifecycle-runtime-ktx = "2.6.1"
99
activity-compose = "1.7.2"
1010
compose-bom = "2023.03.00"
11+
hilt = "2.46.1"
12+
hilt-navigation = "1.0.0"
13+
navigation-compose = "2.6.0"
14+
compose-material = "1.4.3"
1115

1216
[libraries]
1317
core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "core-ktx" }
@@ -24,10 +28,20 @@ ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview
2428
ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
2529
ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
2630
material3 = { group = "androidx.compose.material3", name = "material3" }
31+
lifecycle-viewmodel = { group = "androidx.lifecycle", name = "lifecycle-viewmodel" }
32+
hilt-android = { group = "com.google.dagger", name = "hilt-android", version.ref = "hilt" }
33+
hilt-android-compiler = { group = "com.google.dagger", name = "hilt-android-compiler", version.ref = "hilt" }
34+
hilt-navigation = { group = "androidx.hilt", name = "hilt-navigation", version.ref = "hilt-navigation" }
35+
compose-ui-util = { group = "androidx.compose.ui", name = "ui-util" }
36+
navigation-compose = { group = "androidx.navigation", name = "navigation-compose", version.ref = "navigation-compose" }
37+
compose-material = { group = "androidx.compose.material", name = "material", version.ref = "compose-material" }
38+
hilt-navigation-compose = { group = "androidx.hilt", name = "hilt-navigation-compose", version.ref = "hilt-navigation" }
2739

2840
[plugins]
2941
androidApplication = { id = "com.android.application", version.ref = "agp" }
3042
kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
43+
kotlinKapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" }
44+
hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }
3145

3246
[bundles]
3347

0 commit comments

Comments
 (0)