Gather News all over the world
An android app built using Jetpack Compose that consumes THE GUARDIAN API to show news of the day, breaking news, news of different sections in addition you can also search for any news by just typing any keyword(s)
First, obtain your API key from GUARDIANS and add it in a file named apikey.properties
within the root directory:
YOUR_API_KEY="****"
Then, replace it in the build.gradle(:app)
:
...
def apikeyPropertiesFile = rootProject.file("apikey.properties")
def apikeyProperties = new Properties()
apikeyProperties.load(new FileInputStream(apikeyPropertiesFile))
android {
defaultConfig {
// should correspond to key/value pairs inside the file
buildConfigField("String", "YOUR_API_KEY", apikeyProperties['YOUR_API_KEY'])
}
}
Finally, rebuild the project for changes to take effect and don't forget to update the references of this key in the AuthInterceptor.kt
file.
and retrieve the api key like this to pass it to the header of the interceptor
...
// inside of any of your application's code
val guardiansApiKey = BuildConfig.YOUR_API_KEY,
-
Kotlin - Kotlin is a programming language that can run on JVM.
-
- Jetpack Compose- Modern toolkit for building native UI.
- 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.
- Room - Provides an abstraction layer over SQLite used for offline data caching.
- Preferences Datastore - Jetpack DataStore is a data storage solution that allows you to store key-value pairs or typed objects with protocol buffers. DataStore uses Kotlin coroutines and Flow to store data asynchronously, consistently, and transactionally.
- 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.
-
MVVM Architecture - A software architecture that removes the tight coupling between components. Most importantly, in this architecture, the children don't have the direct reference to the parent, they only have the reference by observables.
-
Hilt - Hilt provides a standard way to incorporate Dagger dependency injection into an Android application.
-
Accompanist Pager Layout -A library which provides paging layouts for Jetpack Compose. If you've used Android's ViewPager before, it has similar properties.
-
Accompanist HorizontalPager - is a layout which lays out items in a horizontal row, and allows the user to horizontally swipe between pages.
-
Accompanist - System UI Controller - A library that provides easy-to-use utilities for recoloring the Android system bars from Jetpack Compose.
-
CoilImage Loader - Coil is a Jetpack Compose image loading library which fetches and displays network images.
-
Retrofit - Type-safe http client and supports coroutines out of the box.
-
GSON - JSON Parser,used to parse requests on the data layer for Entities and understands Kotlin non-nullable and default parameters.
-
OkHttp Logging Interceptor - Logs HTTP request and response data.
-
Coroutines - Library Support for coroutines.
-
Flows - Flows are built on top of coroutines and can provide multiple values. A flow is conceptually a stream of data that can be computed asynchronously.
-
Shimmer loading effect to display as the data is loaded from the
guardians api
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
PRs are :)