- Now the bitcoin accounts get their transactions loaded

This commit is contained in:
Javier Varona 2018-11-19 23:19:23 -04:00
parent 7367b33bb2
commit 62541e1863
3 changed files with 18 additions and 1 deletions

View file

@ -29,6 +29,9 @@ public interface CryptoNetAccountDao {
@Query("SELECT cna.* FROM crypto_net_account cna WHERE seed_id = :seedId")
List<CryptoNetAccount> getAllCryptoNetAccountBySeed( long seedId);
@Query("SELECT cna.* FROM crypto_net_account cna WHERE crypto_net == 'BITCOIN'")
LiveData<List<CryptoNetAccount>> getAllBitcoins();
@Query("SELECT * FROM crypto_net_account WHERE id = :accountId")
LiveData<CryptoNetAccount> getByIdLiveData( long accountId);

View file

@ -170,7 +170,15 @@ public class CrystalWalletService extends LifecycleService {
}
});
final LiveData<List<CryptoNetAccount>> cryptoNetAccountList = db.cryptoNetAccountDao().getAllBitcoins();
cryptoNetAccountList.observe(this, new Observer<List<CryptoNetAccount>>() {
@Override
public void onChanged(@Nullable List<CryptoNetAccount> cryptoNetAccounts) {
for(CryptoNetAccount nextCryptoNetAccount : cryptoNetAccounts) {
generalAccountManager.loadAccountFromDB(nextCryptoNetAccount,thisService);
}
}
});
/*while(this.keepLoadingAccountTransactions){
try{

View file

@ -2,6 +2,7 @@ package cy.agorise.crystalwallet.views;
import android.arch.lifecycle.ViewModelProviders;
import android.content.Context;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -30,6 +31,11 @@ public class CryptoNetAccountAdapter extends ArrayAdapter<CryptoNetAccount> {
this.data = objects;
}
@Override
public CryptoNetAccount getItem(int position) {
return data.get(position);
}
@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
return getView(position, convertView, parent);