Remove the search for the equivalence of the same asset

This commit is contained in:
henry 2018-04-23 21:13:48 -04:00
parent e3fb99f1eb
commit e5bbce9fcd
3 changed files with 18 additions and 3 deletions

View file

@ -589,7 +589,14 @@ public abstract class GrapheneApiGenerator {
}
}
public static void getEquivalenValue(String baseAssetName, final List<BitsharesAsset> quoteAssets, final Context context){
/**
* Retrieves the equivalent value from a list of assets to a base asset
*
* @param baseAssetName The base asset to use
* @param quoteAssets The list of quotes assets to query
* @param context The Context of this Application
*/
public static void getEquivalentValue(String baseAssetName, final List<BitsharesAsset> quoteAssets, final Context context){
CrystalDatabase db = CrystalDatabase.getAppDatabase(context);
final CryptoCurrencyDao cryptoCurrencyDao = db.cryptoCurrencyDao();
final BitsharesAssetDao bitsharesAssetDao = db.bitsharesAssetDao();

View file

@ -4,7 +4,7 @@ import cy.agorise.crystalwallet.enums.CryptoCoin;
import cy.agorise.crystalwallet.enums.SeedType;
/**
* Imports a bitsahres accounts,
* Imports a bitshares accounts,
*
* return true if the account exist, and the mnemonic (brainkey provide is for that account
* Created by Henry Varona on 1/10/2017.

View file

@ -3,6 +3,7 @@ package cy.agorise.crystalwallet.service;
import android.arch.lifecycle.LifecycleService;
import android.util.Log;
import java.util.ArrayList;
import java.util.List;
import cy.agorise.crystalwallet.apigenerator.GrapheneApiGenerator;
@ -29,8 +30,15 @@ public class EquivalencesThread extends Thread{
super.run();
while(this.keepLoadingEquivalences){
List<BitsharesAsset> queryAsset = new ArrayList<>();
for(BitsharesAsset asset : bitsharesAssets){
if(!asset.getName().equals(fromAsset)){
queryAsset.add(asset);
}
}
try {
GrapheneApiGenerator.getEquivalenValue(fromAsset, bitsharesAssets, this.service);
//GrapheneApiGenerator.getEquivalentValue(fromAsset, bitsharesAssets, this.service);
GrapheneApiGenerator.getEquivalentValue(fromAsset, queryAsset, this.service);
Log.i("Equivalences Thread", "In loop");
Thread.sleep(300000);
} catch (InterruptedException e) {