A simple android news application to demonstrate the usage for MVVM design pattern using Room database, LiveData, Databinding, Retrofit. The application supports caching of news articles.
The application uses the NY Times Most Popular Articles API and shows a list of articles, that shows details when items on the list are tapped (a typical master/detail app).
- MVVM Architecture - Robust, testable, and maintainable app with classes for managing your UI component lifecycle and handling data persistence.
- AndroidX - AndroidX is a major improvement to the original Android Support Library
- Data Binding - Declaratively bind observable data to UI elements. - Lifecycles - Create a UI that automatically responds to lifecycle events. - LiveData - Build data objects that notify views when the underlying database changes.
- Room - Access your app's SQLite database with in-app objects and compile-time checks. - ViewModel - Store UI-related data that isn't destroyed on app rotations. Easily schedule asynchronous tasks for optimal execution.
- Test - An Android testing framework for unit and runtime UI tests. Third party
- Glide for image loading
- MVVM Architecture
- Room database offline caching.
- Unit test demonstration using JUnit and Mockito
- Gradle scripts for running sonarqube static code analysis, code coverage.
Open terminal and type the following command
./gradlew clean jacocoTestReport
The coverage report will be generated on the following path.
app/build/reports
Open gradle.properties and update the below line with the sonarqube server url
systemProp.sonar.host.url=http://localhost:9000
Before running the sonarqube job, make sure the project version has been updated in the build.gradle. On every run, increment the version by 1.
property "sonar.sources", "src/main/java"
property "sonar.projectName", "Headlines" // Name of your project
property "sonar.projectVersion", "1.0.0" // Version of your project
property "sonar.projectDescription", "News feed application"
For running the sonarqube job, type the below command in the terminal.
./gradlew sonarqube assembleDebug
Check out these web pages to learn more about following:
If you've found an error in this sample, please file an issue: https://github.com/faiyyazs/HeadLines/issues
Patches are encouraged, and may be submitted by forking this project and submitting a pull request through GitHub.