An android app built using Kotlin that consumes Ney York Times API to display current popular articles. It has been built following Architecture Principle, Repository Pattern, MVVM Architecture in the presentation layer as well as jetpack components.
The key needs to be added to the local.properties
file, so that it's read as a build config value. A better way to save the keys would be by using the Google Secret Gradle Plugin
API_KEY="*******************"
-
Hilt - Dependency Injection library.
-
- Android KTX - Provide concise, idiomatic Kotlin to Jetpack and Android platform APIs.
- AndroidX - Major improvement to the original Android Support Library, which is no longer maintained.
- Lifecycle - Perform actions in response to a change in the lifecycle status of another component, such as activities and fragments.
- ViewModel
- LiveData - Lifecycle-aware, meaning it respects the lifecycle of other app components, such as activities, fragments, or services.
- ViewModel - Designed to store and manage UI-related data in a lifecycle conscious way. The ViewModel class allows data to survive configuration changes such as screen rotations.
- Data Binding - Allows you to bind UI components in your layouts to data sources in your app using a declarative format rather than programmatically.
- Room - Provides an abstraction layer over SQLite used for offline data caching.
- Navigation Component-Component that allows easier implementation of navigation from simple button clicks to more complex patterns.
-
Retrofit - To make network request.
-
Tests
-
CI/CD
- Github Actions
I added some screenshots in the screenshots
folder, in the root directory of the project. Added some GIFs to also show end to end test on the app
Mode | Home screen | Article Details Screen | Read More |
---|---|---|---|
Light | |||
On Error |
A well planned architecture is extremely important for an app to scale and all architectures have one common goal- to manage complexity of your app. This isn't something to be worried about in smaller apps however it may prove very useful when working on apps with longer development lifecycle and a bigger team.
Clean architecture was proposed by Robert C. Martin in 2012 in the Clean Code Blog and it follow the SOLID principle.
The circles represent different layers of your app. Note that:
-
The center circle is the most abstract, and the outer circle is the most concrete. This is called the Abstraction Principle. The Abstraction Principle specifies that inner circles should contain business logic, and outer circles should contain implementation details.
-
Another principle of Clean Architecture is the Dependency Inversion. This rule specifies that each circle can depend only on the nearest inward circle ie. low-level modules do not depend on high-level modules but the other way around.
- Loose coupling between the code - The code can easily be modified without affecting any or a large part of the app's codebase.
- Easier to test code.
- Separation of Concern - Different modules have specific responsibilities making it easier for modification and maintenance.