Mobile Application that displays the latest facts and figures of your favourite cryptocurrency coins.
This projects makes use of the CoinLore API and also provides an android library that exposes the same to developers.
JetPack Compose: Jetpack Compose is Android’s modern toolkit for building native UI
Android KTX: KTX extensions provide concise, idiomatic Kotlin to Jetpack, Android platform, and other APIs.
Retrofit: Retrofit turns your HTTP API into a Java interface.
GSON: Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to an equivalent Java object
OkHttp-Logging-Interceptor: Logs HTTP request and response data.
Coroutines: A coroutine is a concurrency design pattern that you can use on Android to simplify code that executes asynchronously.
Koin: A dependency injection library.
Install CoinLore API by adding the following to your
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
add the following to the dependencies sections
dependencies {
implementation 'com.github.iankang:CryptKnow:1.0.5'
}
This is an implementation example for the CoinLoreApi.
Initialize the CoinLoreApi.
private val coinLoreApi: CoinLoreApi = CoinLoreApi()
use the object in a stateful composable.
@Composable
fun Greeting(coinLoreApi: CoinLoreApi) {
val coinState = produceState(initialValue = CoinLoreResponse<CoinsTickersResponse>()){
value = coinLoreApi.getCoinsTickers()
}
if(coinState.value.isOk == true){
Text(
text = coinState.value.data.toString()
)
}else{
Text("Loading")
}
}