app module is the main application module that serves as the entry point for the Compose Project Template. It orchestrates the app’s initialization, theme setup, and navigation graph.
Key Classes
App
The application class annotated with@HiltAndroidApp for Hilt dependency injection.
Package: es.mobiledev.cpt
Base Android Application class providing application-level context
The
@HiltAndroidApp annotation triggers Hilt’s code generation and creates the application-level dependency container.MainActivity
The single activity that hosts all Compose screens using Jetpack Navigation. Package:es.mobiledev.cpt
File: app/src/main/java/es/mobiledev/cpt/MainActivity.kt:13
Nullable navigation controller for managing app navigation
- Edge-to-edge display support via
enableEdgeToEdge() - Jetpack Compose UI with Material3 theme
- Hilt dependency injection with
@AndroidEntryPoint - Single-activity architecture
AppNavigation
Composable function that defines the main navigation graph of the application. Package:es.mobiledev.cpt
File: app/src/main/java/es/mobiledev/cpt/AppNavigation.kt:38
The NavHostController used to manage the app’s navigation
- Manages navigation between screens (Launcher, Home, Test, ArticleDetail)
- Controls visibility of TopBar and BottomBar based on current screen
- Integrates with
ScreenWrapperfor consistent UI structure - Tracks current selected navigation module
Navigation Routes
The app supports the following navigation destinations:Initial launcher screen shown on app startup
- hasTopBar: false
- hasBottomBar: false
Main home screen displaying articles
- hasTopBar: true
- hasBottomBar: true
Test navigation screen
- hasTopBar: true
- hasBottomBar: true
Article detail screen with article ID parameter
- Parameter:
id: Long - hasTopBar: true
- hasBottomBar: true
Usage Example
Navigation Implementation
The navigation graph uses type-safe navigation with Kotlin serialization. All screen routes are defined in the
navigation module using sealed interfaces.Theme Configuration
The app module includes theme configuration files:- Color.kt - Material3 color scheme definitions
- Theme.kt - CPTTheme composable with light/dark mode support
- Type.kt - Typography definitions
Module Dependencies
The app module depends on:Build Configuration
- Gradle
- Hilt Setup