GithubCompose is a sample project that presents a modern approach to Android app development.
The project tries to combine popular Android tools and to demonstrate best development practices by utilizing up to date tech-stack like Compose, Kotlin Flow and Koin.
The sample app presents a modern Android application Architecture that is scalable and maintainable through a MVI.
UI
Tech/Tools
Modern Architecture
The project is layered traditionally with a View, Presentation, Model separation and presents a MVI inspired from Yusuf Ceylan's architecture but adapted to Compose.
Architecture layers:
There are a three core components described:
State - data class that holds the state content of the corresponding screen e.g. list of User
, loading status etc. The state is exposed as a Compose runtime MutableState
object from that perfectly matches the use-case of receiving continuous updates with initial value.
Event - plain object that is sent through callbacks from the UI to the presentation layer. Events should reflect UI events caused by the user. Event updates are exposed as a MutableSharedFlow
type which is similar to StateFlow
and that behaves as in the absence of a subscriber, any posted event will be immediately dropped.
Effect - plain object that signals one-time side-effect actions that should impact the UI e.g. triggering a navigation action, showing a Toast, SnackBar etc. Effects are exposed as ChannelFlow
which behave as in each event is delivered to a single subscriber. An attempt to post an event without subscribers will suspend as soon as the channel buffer becomes full, waiting for a subscriber to appear.
Every screen/flow defines its own contract class that states all corresponding core components described above: state content, events and effects.