The news app is based upon NewsSampleMVVM but showcases MVI architecture pattern combined with power of ViewModel and LiveData, thanks to Roxie library
It's a simple news app ποΈwhich uses NewsAPI to fetch top news headlines from the API. The main aim of this app is to show how MVI helps in managing state combined with power of ViewModel and LiveData to make our lives easier.
The idea is to add new features With time to build a full-fledge app while making it easier to understand the codebase.
- Go to NewsAPI and generate an API key (It's only 2 steps!)
- Create new file ->
credentials.properties
- Add the API key as shown below:
NEWS_API_KEY = "YOUR_API_KEY"
- Build and run the app
- Enjoyyyyy π
- Architecture Components [ViewModel, LiveData, Lifecycle]
- Roxie library for MVI implementation
- Dagger for Dependency Injection
The following diagram shows the dependency graph of the app.
Generated by Daggraph
The app uses uni-directional flow of state of the app1 to have predictable state machine style architecture. It's inspired by MVVM and MVI hence it uses the following MVVM architecture while leveraging state management with MVI.
The uni-directional pipeline for the flow of state.
Source: Building MVI apps with Roxie
Super important and all the test cases will come soon.
Trying to learn the new Architecture Components? I have wrote a series of articles to understand Android Architecture Components. Feel free to check it out to learn more.
- Android Architecture Components - A Deep Dive - Caster.io πΊ
- Android Architecture Components Podcast on Fragmented π€
Please read CONTRIBUTING.md for contributions.
The MIT License (MIT)
Copyright (c) 2019 Akshay Chordiya
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.