This app shows a list of top headlines news from NewsApi.
- Showing a list of news articles
- A title, image, short description, and relative publish date is being displayed for every article.
- Article Details screen shows more details about an article.
- Draggable live streaming view (Just design without implementation)
- Read options view (Just design without functionality)
- Smooth animations and transitions
- The user have the ability to search for a specific article using the search view.
- Room database was used to save the loaded articles locally so they will be available offline.
- Open article url in an in-app browser
- Local articles saved in the database will be loaded when the user opens the app. a server request will be also initiated in the same time. The user will be able to see the loaded articles offline.
- The database is the single source of truth
- When the user rotate the screen, the user will see the same data at the same scroll position.
- The app targets Android API 30 with minSDK 23 and using androidX
- LiveData
- ViewModel
- Databinding
- Retrofit
- Dagger 2
- Rxjava
- Room
- Picasso
- Mockito
GET "https://newsapi.org/v2/top-headlines"
@Query apiKey "ADD_YOUR_API_KEY"
@Query country "us"
The app was built with a clean MVVM architecture following Android Architecture components and Android Jetpack. This is very important to make the code base more robust, testable, and maintainable in the long run.
https://developer.android.com/jetpack/docs/guide#best-practices
A UseCase layer layer was added before the Repository layer.
I used a generic class NetworkBoundResource for loading a resource. This class can provide a resource backed by both the database and the network.
For successfully running the app, you need to add an API key for the NewsAPi on the Constants.kt file.