-
Notifications
You must be signed in to change notification settings - Fork 13
/
MainActivity.kt
38 lines (32 loc) · 1.18 KB
/
MainActivity.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package dev.enro.example
import android.os.Bundle
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.fragment.app.FragmentActivity
import dagger.hilt.android.AndroidEntryPoint
import dev.enro.annotations.NavigationDestination
import dev.enro.core.NavigationKey
import dev.enro.core.container.EmptyBehavior
import dev.enro.core.fragment.container.navigationContainer
import dev.enro.core.navigationHandle
import dev.enro.example.databinding.ActivityMainBinding
import kotlinx.parcelize.Parcelize
@Parcelize
class MainKey : NavigationKey.SupportsPresent
@AndroidEntryPoint
@NavigationDestination(MainKey::class)
class MainActivity : FragmentActivity() {
private val navigation by navigationHandle {
defaultKey(MainKey())
}
private val rootContainer by navigationContainer(
containerId = R.id.rootContainer,
root = { RootFragment() },
emptyBehavior = EmptyBehavior.CloseParent
)
override fun onCreate(savedInstanceState: Bundle?) {
installSplashScreen()
super.onCreate(savedInstanceState)
val binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
}
}