Android Architecture
/Android Architecture
Porządkuje strukturę aplikacji Android: MVVM lub MVI, ViewModel, StateFlow, repozytoria, nawigację i wstrzykiwanie zależności.
- Autor
- a2heng ↗
- Repozytorium
- android-dev-in-android ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 12.11.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 1
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 12.11.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Porządkuje strukturę aplikacji Android: MVVM lub MVI, ViewModel, StateFlow, repozytoria, nawigację i wstrzykiwanie zależności.
Oryginalny opis (EN)
Structure an Android app cleanly: MVVM/MVI, ViewModel, StateFlow, repositories, navigation and optional DI. Use when a project grows beyond one screen or the user asks for a maintainable structure.
Jak działa
- Default: MVVM, no over-engineering
- ViewModel + StateFlow
- Navigation
- DI
- Rules
Podgląd SKILL.md
---
name: Android Architecture
description: Structure an Android app cleanly: MVVM/MVI, ViewModel, StateFlow, repositories, navigation and optional DI. Use when a project grows beyond one screen or the user asks for a maintainable structure.
---
# Android Architecture
## Default: MVVM, no over-engineering
```text
app/
├─ data/ # repositories, network, database
├─ domain/ # optional use cases (only if they add value)
└─ ui/
├─ home/ # HomeViewModel + HomeScreen/Activity
└─ detail/
```
- **UI** observes state and sends events.
- **ViewModel** owns UI state and calls repositories.
- **Repository** hides data sources (network, DB, files).
- Do not put Android `Context` in ViewModels.
## ViewModel + StateFlow
```kotlin
data class HomeUiState(val loading: Boolean = false, val items: List<Item> = emptyList(), val error: String? = null)
class HomeViewModel(private val repo: ItemRepository) : ViewModel() {
private val _state = MutableStateFlow(HomeUiState())
val state: StateFlow<HomeUiState> = _state.asStateFlow()
fun load() = viewModelScope.launch {
_state.update { it.copy(loading = true, error = null) }
runCatching { repo.items() }
.onSuccess { items -> _state.update { it.copy(loading = false, items = items) } }
.onFailure { e -> _state.update { it.copy(loading = false, error = e.message) } }
}
}
```
In Compose: `collectAsStateWithLifecycle()`. In Views: `repeatOnLifecycle`.
## Navigation
- Compose: `androidx.navigation:navigation-compose`.
- Views: Navigation Component or a simple single-activity + fragments.
- Keep one source of truth for routes; pass IDs, not whole objects.
## DI
Hilt/Koin are optional and add dependencies. For small apps, manual
construction in an `Application` class or a simple `ServiceLocator` is enough
and works offline.
## Rules
- One class, one reason to change.
- No business logic in Activities/Fragments/Composables.
- No singletons holding Activity context.
- Prefer immutable state and explicit events.
- Before adding a library, check the offline dependency cache (`android-deps`).
Wersje
W bazie nie ma innych skilli o nazwie Android Architecture.
Migawka bazy z 13.11.2026 · wersja paczki 68bf52d0cc4d (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 2 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100android-architecture-components-mvvm
Pomaga strukturyzować produkcyjne aplikacje Android w MVVM z ViewModel, StateFlow, LiveData i Clean Architecture. - 100mvi-compose-kotlin
Pomaga budować ekrany Androida w Jetpack Compose i Kotlin według wzorca MVI: niezmienny stan, akcje i centralny Store. - 95android-architecture
Pomaga wdrażać MVVM, czystą architekturę i wstrzykiwanie zależności z Hilt oraz układać warstwy aplikacji Android. - 100android-dev
Stanowi bazę dla całej pracy nad Androidem i Kotlin Multiplatform: Gradle, Hilt, Room, Retrofit, Ktor, ViewModel, Compose, wzorce MVVM i MVI oraz API Jetpack i AndroidX. - 100agency-app-architecture
Zakłada wielomodułowy szkielet aplikacji: Clean Architecture, MVVM z MVI, KMP i konwencje Gradle, gdy tworzysz nowe repozytorium. - 90mobile-patterns
Wyjaśnia wzorce architektury mobilnej, takie jak MVVM, MVI, Clean Architecture, Coordinator i Repository.