This simple Currency Converter app is designed to illustrate working with complex json objects as well showing usage of Flow, Live Data, Coroutines, Hilt - (Clean Architecture)
I also decided to use Room Database to store all currencies locally. This eliminates the dependency on internet everytime to fetch list of currencies.
Data is provided by Currency Conversion API
- Operating System : Android
- Programming Language: Kotlin
- Architecture : MVVM
- Dependency Injection : Hilt
- Fragment Management : Navigation Component
- Material Components for Android : Material Components for Android
- Design : Material Design 3
- Moshi : Moshi
- Retrofit : Retrofit
- Room : Room
- Coroutines : Coroutines
- Kotlin Flow : Kotlin Flow
- LiveData : LiveData
- ViewModel : ViewModel
The rates screen response data.
{
"status":"success",
"currencies": {
"AUD":"Australian Dollar",
"BGN":"Bulgarian Lev"
}
}
Conversion response data
{
"base_currency_code": "USD",
"base_currency_name": "United States dollar",
"amount": "100.0000",
"updated_date": "2022-05-22",
"rates": {
"PLN": {
"currency_name": "Polish złoty",
"rate": "4.3826",
"rate_for_amount": "438.2576"
},
"THB": {
"currency_name": "Thai baht",
"rate": "34.4133",
"rate_for_amount": "3441.3273"
}
},
"status": "success"
}
There are a few ways to open this project.
Android Studio
->File
->New
->From Version control
->Git
- Enter
[email protected]:mbobiosio/CurrencyConverter.git
into URL field an pressClone
button 3, Build the project and run on an android device or emulator
- Run
git clone [email protected]:mbobiosio/CurrencyConverter.git
command to clone project - Open
Android Studio
and selectFile | Open...
from the menu. Select cloned directory and pressOpen
button - Build the project and run on an android device or emulator
You need to supply API key for conversions. You can get a free api key from getgeoapi.com
.
When you obtain the key, you can provide them to the app by putting the following in the Constants
:
const val API_KEY = ""
This project is released under the MIT license. See LICENSE for details.
MIT License
Copyright (c) 2022 Mbuodile Obiosio
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.