CurrencyConverter

Additional

Language
Java
Version
1.0 (Jun 21, 2019)
Created
Aug 2, 2018
Updated
Oct 25, 2019
Owner
Vinicius (vinisauter)
Contributor
Vinicius (vinisauter)
1
Activity
Badge
Generate
Download
Source code

Announcement

CurrencyConverter

Integrating into your project

This library is available in JitPack.io repository. To use it, make sure to add the below inside root build.gradle file

allprojects {
    repositories {
        mavenCentral()
        maven { url "https://jitpack.io" }
    }
}

and add the repository's url to the app's build.gradle file.

dependencies {
   implementation 'com.github.vinisauter:CurrencyConverter:1.0'
    // Other dependencies your app might use
}

IMPLEMENTATION

Get currency list:

 List<Currency> clist = CurrencyConverter.getCurrencyList();

Calculate currency from:

 CurrencyConverter.calculate(10, "BRL", "USD", new CurrencyConverter.Callback() {
            @Override
            public void onValueCalculated(Double value, Exception e) {
                if (e != null) {
                    Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show();
                }else{
                    //Do someting with value.
                    ...
                    textView.setText(CurrencyConverter.formatCurrencyValue(to, value));
                }
            }
        });

Reset data if necessary:

 CurrencyConverter.reset();

Donation