Skip to main content
Feature modules encapsulate specific features of the application, following clean architecture principles. Each feature module is self-contained with its own screens, ViewModels, UI components, and state management.

Module Overview

Home

Main screen displaying article list

Launcher

Splash screen and app initialization

Article Detail

Detailed view of individual articles

Home Feature

Module: feature:home Package: es.mobiledev.feature.home The home feature displays a list of favorite articles and handles navigation to article details.

HomeScreen

File: feature/home/src/main/java/es/mobiledev/feature/home/screen/HomeScreen.kt:16
@Composable
fun HomeScreen(
    navigateToArticleDetail: (Long) -> Unit,
)
navigateToArticleDetail
(Long) -> Unit
required
Callback function invoked when user taps an article, receives article ID as parameter
Features:
  • Displays list of favorite articles
  • Lifecycle-aware data loading with LifecycleStartEffect
  • Loading state management
  • Navigation to article detail screen

Usage Example

HomeScreen(
    navigateToArticleDetail = { articleId ->
        navController.navigate(AppScreens.ArticleDetail(articleId))
    }
)

HomeViewModel

Package: es.mobiledev.feature.home.viewmodel Extends: BaseViewModel<HomeUiData> Manages the home screen state and business logic. Key Methods:
fun getFavoriteArticles()
fun onFavoriteClick(article: ArticleBo, isFavorite: Boolean)
getFavoriteArticles
function
Loads the list of favorite articles from the repository
onFavoriteClick
function
Toggles favorite status of an article
article
ArticleBo
required
The article to toggle
isFavorite
Boolean
required
Current favorite status

HomeUiState

data class HomeUiData(
    val articles: List<ArticleBo> = emptyList(),
    val favoriteArticles: List<ArticleBo> = emptyList()
)
articles
List<ArticleBo>
default:"emptyList()"
List of all articles to display
favoriteArticles
List<ArticleBo>
default:"emptyList()"
List of user’s favorite articles

Launcher Feature

Module: feature:launcher Package: es.mobiledev.feature.launcher The launcher feature handles the app’s splash screen and initialization logic.

LauncherScreen

File: feature/launcher/src/main/java/es/mobiledev/feature/launcher/screen/LauncherScreen.kt:21
@Composable
fun LauncherScreen(
    onLauncherFinished: () -> Unit,
)
onLauncherFinished
() -> Unit
required
Callback invoked when launcher initialization is complete
Features:
  • Displays splash screen with branded background
  • Performs app initialization tasks
  • Automatically navigates to home when complete
  • Uses LaunchedEffect for side effects

Usage Example

LauncherScreen(
    onLauncherFinished = {
        navController.navigate(AppScreens.Home) {
            popUpTo(AppScreens.Launcher) { inclusive = true }
        }
    }
)

LauncherViewModel

Package: es.mobiledev.feature.launcher.viewmodel Extends: BaseViewModel<LauncherUiData> Manages launcher initialization logic and timing.

LauncherUiState

data class LauncherUiData(
    val hasFinish: Boolean = false
)
hasFinish
Boolean
default:"false"
Flag indicating whether launcher initialization has completed
The launcher screen typically saves the last open time and performs any necessary startup checks before transitioning to the main app.

Article Detail Feature

Module: feature:articledetail Package: es.mobiledev.feature.articledetail The article detail feature displays comprehensive information about a single article.

ArticleDetailScreen

File: feature/articledetail/src/main/java/es/mobiledev/feature/articledetail/screen/ArticleDetailScreen.kt:18
@Composable
fun ArticleDetailScreen()
Features:
  • Displays full article details including image, title, authors, and content
  • Custom bottom bar with article URL for sharing
  • Favorite toggle functionality
  • Loading state management
  • Retrieves article ID from navigation arguments

Key Components

ArticleDetailScreen(
    bottomBar = {
        uiState.data.article?.url?.let { safeUrl ->
            ArticleDetailBottomBar(newsUrl = safeUrl)
        }
    }
)

ArticleDetailViewModel

Package: es.mobiledev.feature.articledetail.viewmodel Extends: BaseViewModel<ArticleDetailUiData> Key Methods:
fun loadArticle(id: Long)
fun onFavoriteClick(article: ArticleBo, isFavorite: Boolean)
loadArticle
function
Loads article details by ID from the repository
id
Long
required
The unique identifier of the article to load
onFavoriteClick
function
Toggles the favorite status of the current article
article
ArticleBo
required
The article to toggle
isFavorite
Boolean
required
Current favorite status

ArticleDetailUiState

data class ArticleDetailUiData(
    val article: ArticleBo? = null,
    val isFavorite: Boolean = false
)
article
ArticleBo?
default:"null"
The article being displayed, null while loading
isFavorite
Boolean
default:"false"
Whether the current article is marked as favorite

Article Detail Components

The module includes specialized composables:
  • ArticleDetailImage - Hero image display
  • ArticleDetailBody - Article content and text
  • ArticleDetailActionRow - Actions like favorite, share
  • ArticleDetailBottomBar - Custom bottom bar with URL
  • ArticleDetailScreenContent - Main content wrapper

Feature Module Architecture

All feature modules follow a consistent structure:
feature/{feature-name}/
├── component/          # UI components specific to this feature
├── screen/            # Main screen composables
├── state/             # UI state data classes
└── viewmodel/         # ViewModels for business logic
Feature modules are independent and can be developed, tested, and maintained separately. They depend only on domain and common modules, never on other features.

Common Dependencies

All feature modules depend on:
- domain:model
- domain:useCase
- navigation
- commonAndroid

Build docs developers (and LLMs) love