Integrate hilt

This commit is contained in:
Nymos 2025-02-18 18:10:41 +03:00
parent 0bd96146c0
commit f6888eeb18
7 changed files with 18 additions and 32 deletions

View File

@ -8,12 +8,12 @@ plugins {
android { android {
namespace = "com.nto.presentation" namespace = "com.nto.presentation"
compileSdk = 34 compileSdk = 35
defaultConfig { defaultConfig {
applicationId = "com.nto.presentation" applicationId = "com.nto.presentation"
minSdk = 28 minSdk = 28
targetSdk = 34 targetSdk = 35
versionCode = 1 versionCode = 1
versionName = "1.0" versionName = "1.0"

View File

@ -7,11 +7,11 @@
android:label="@string/app_name" android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:name=".di.App"
android:theme="@style/Theme.Onomatopoeiafront"> android:theme="@style/Theme.Onomatopoeiafront">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:exported="true" android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.Onomatopoeiafront"> android:theme="@style/Theme.Onomatopoeiafront">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />

View File

@ -5,14 +5,13 @@ import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Scaffold import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview import com.nto.presentation.theme.OnomatopoeiafrontTheme
import com.nto.presentation.ui.theme.OnomatopoeiafrontTheme import dagger.hilt.android.AndroidEntryPoint
@AndroidEntryPoint
class MainActivity : ComponentActivity() { class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
@ -20,28 +19,9 @@ class MainActivity : ComponentActivity() {
setContent { setContent {
OnomatopoeiafrontTheme { OnomatopoeiafrontTheme {
Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding -> Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
Greeting(
name = "Android",
modifier = Modifier.padding(innerPadding)
)
} }
} }
} }
} }
} }
@Composable
fun Greeting(name: String, modifier: Modifier = Modifier) {
Text(
text = "Hello $name!",
modifier = modifier
)
}
@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
OnomatopoeiafrontTheme {
Greeting("Android")
}
}

View File

@ -0,0 +1,7 @@
package com.nto.presentation.di
import android.app.Application
import dagger.hilt.android.HiltAndroidApp
@HiltAndroidApp
class App: Application()

View File

@ -1,4 +1,4 @@
package com.nto.presentation.ui.theme package com.nto.presentation.theme
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color

View File

@ -1,6 +1,5 @@
package com.nto.presentation.ui.theme package com.nto.presentation.theme
import android.app.Activity
import android.os.Build import android.os.Build
import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme

View File

@ -1,4 +1,4 @@
package com.nto.presentation.ui.theme package com.nto.presentation.theme
import androidx.compose.material3.Typography import androidx.compose.material3.Typography
import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.TextStyle