Build the dependency tree. Initialize some basic composable to test Hilt.
This commit is contained in:
parent
70045251b2
commit
1afd3bc02b
12 changed files with 120 additions and 84 deletions
|
|
@ -3,6 +3,7 @@
|
|||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<application
|
||||
android:name=".MainApplication"
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
|
|
|
|||
|
|
@ -6,41 +6,27 @@ import androidx.activity.compose.setContent
|
|||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.pixelized.lexique.ui.theme.LexiqueTheme
|
||||
import com.pixelized.lexique.ui.screens.lexicon.LexiconScreen
|
||||
import com.pixelized.lexique.ui.theme.LexiconTheme
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
|
||||
@AndroidEntryPoint
|
||||
class MainActivity : ComponentActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
setContent {
|
||||
LexiqueTheme {
|
||||
LexiconTheme {
|
||||
// A surface container using the 'background' color from the theme
|
||||
Surface(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
color = MaterialTheme.colorScheme.background
|
||||
) {
|
||||
Greeting("Android")
|
||||
LexiconScreen()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun Greeting(name: String, modifier: Modifier = Modifier) {
|
||||
Text(
|
||||
text = "Hello $name!",
|
||||
modifier = modifier
|
||||
)
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
fun GreetingPreview() {
|
||||
LexiqueTheme {
|
||||
Greeting("Android")
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package com.pixelized.lexique
|
||||
|
||||
import android.app.Application
|
||||
import dagger.hilt.android.HiltAndroidApp
|
||||
|
||||
@HiltAndroidApp
|
||||
class MainApplication : Application()
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.pixelized.lexique.ui.screens.detail
|
||||
|
||||
import android.content.res.Configuration.UI_MODE_NIGHT_NO
|
||||
import android.content.res.Configuration.UI_MODE_NIGHT_YES
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import com.pixelized.lexique.ui.screens.lexicon.LexiconScreen
|
||||
import com.pixelized.lexique.ui.theme.LexiconTheme
|
||||
|
||||
@Composable
|
||||
fun CharacterDetailScreen(
|
||||
viewModel: CharacterDetailViewModel = hiltViewModel(),
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun CharacterDetailScreenContent() {
|
||||
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Preview(uiMode = UI_MODE_NIGHT_NO)
|
||||
@Preview(uiMode = UI_MODE_NIGHT_YES)
|
||||
private fun CharacterDetailScreenContentPreview() {
|
||||
LexiconTheme {
|
||||
CharacterDetailScreenContent()
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.pixelized.lexique.ui.screens.detail
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import javax.inject.Inject
|
||||
|
||||
@HiltViewModel
|
||||
class CharacterDetailViewModel @Inject constructor() : ViewModel() {
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.pixelized.lexique.ui.screens.lexicon
|
||||
|
||||
import android.content.res.Configuration.UI_MODE_NIGHT_NO
|
||||
import android.content.res.Configuration.UI_MODE_NIGHT_YES
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import com.pixelized.lexique.ui.theme.LexiconTheme
|
||||
|
||||
@Composable
|
||||
fun LexiconScreen(
|
||||
viewModel: LexiconViewModel = hiltViewModel(),
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun LexiconScreenContent() {
|
||||
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Preview(uiMode = UI_MODE_NIGHT_NO)
|
||||
@Preview(uiMode = UI_MODE_NIGHT_YES)
|
||||
private fun LexiconScreenContentPreview() {
|
||||
LexiconTheme {
|
||||
LexiconScreenContent()
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.pixelized.lexique.ui.screens.lexicon
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import javax.inject.Inject
|
||||
|
||||
@HiltViewModel
|
||||
class LexiconViewModel @Inject constructor() : ViewModel()
|
||||
|
|
@ -38,7 +38,7 @@ private val LightColorScheme = lightColorScheme(
|
|||
)
|
||||
|
||||
@Composable
|
||||
fun LexiqueTheme(
|
||||
fun LexiconTheme(
|
||||
darkTheme: Boolean = isSystemInDarkTheme(),
|
||||
// Dynamic color is available on Android 12+
|
||||
dynamicColor: Boolean = true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue