Countries Pad display a list of countries obtained from Rest Countries API. You can view the selected country on a map. Additionally you can filter countries by area, population or by name.
Countries Pad is implemented using Android Clean Architecture with these highlights:
- Uses Model-View-ViewModel (MVVM) pattern with Clean Architecture (data, domain and presentation)
- It has 2 Screen destinations which use Compose Destination to manage navigation
This screen is based on a LazyVerticalGrid to display country flags in pgn formart.
There is a feature to search countryby name, cioc (or cca3) code.
This screen displays the country's Coat of Arms as well as the Country's Flag. It also displays a map showing the country's location on the globe.
Countries Pad is implemented using Android Clean Architecture, Retrofit2, Dagger Hilt, ViewModel, Coroutines, Room, Navigation Components and some other libraries from the Android Jetpack.
- Android KTX - helps to write more concise, idiomatic Kotlin code.
- Jetpack Compose - modern toolkit for building native Android UI
- Material Design 3 - an adaptable system of guidelines, components, and tools that support the best practices of user interface design.
- Compose Destinations - used to handle all navigations and arguments passing while hiding the complex, non-type-safe and boilerplate code
- ViewModel to store and manage UI-related data in a lifecycle conscious way.
- Dagger Hilt - used for Dependency Injection.
- Coil - an image loading library for Android backed by Kotlin Coroutines
- Retrofit a REST Client for Android which makes it relatively easy to retrieve and upload JSON (or other structured data) via a REST based webservice.
- Coroutines and Kotlin Flow - used to manage the local storage i.e.
writing to and reading from the database
. Coroutines help in managing background threads and reduces the need for callbacks. - Room persistence library which provides an abstraction layer over SQLite to allow for more robust database access while harnessing the full power of SQLite.
- Timber - a logger with a small, extensible API which provides utility on top of Android's normal Log class.
- Lottie Animations - provides Lightweight and scalable animations files
- Maps Compose library - for displaying Google Maps in compose
Countries Pad requires a minimum API level of 21. Clone the repository or download the code directly.
You don't need an API Key for Rest Countries API
Base URL
https://restcountries.com/
GET v3.1/all
Parameter | Type | Description |
---|---|---|
none |
none |
No Parameter needed |
This request returns a Json String
Data Point | Type |
---|---|
name | String |
officialName | String |
List | List |
capital | String |
region | String |
subRegion | String |
List | List |
Double | Pair<Double, Double> |
flagUrl | String |
coatOfArmsUrl | String |
ciocCode | String |
area | Int |
population | Int |
Create an interface with a function to iterate through the returned JSON String extract the data points.
interface JsonStringParser<T> {
fun parseJson(jsonString: String): List<T>
}
Contributions to make Countries Pad better are always welcome!
If you are interested in seeing a particular feature implemented in this app, please open a new issue after which you can make a PR!
MIT License
Copyright (c) [2022] [Tonnie Dev]
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.