- Crystal Wallet Service Created!

This commit is contained in:
Javier Varona 2017-10-04 20:29:44 -04:00
parent 3c31669736
commit e466fc8d53
3 changed files with 17 additions and 8 deletions

View file

@ -1,10 +1,12 @@
package cy.agorise.crystalwallet.application;
import android.app.Application;
import android.content.Intent;
import com.idescout.sql.SqlScoutServer;
import cy.agorise.crystalwallet.dao.CrystalDatabase;
import cy.agorise.crystalwallet.service.CrystalWalletService;
/**
* Created by Henry Varona on 6/9/2017.
@ -19,5 +21,8 @@ public class CrystalApplication extends Application {
//initialize the database
CrystalDatabase db = CrystalDatabase.getAppDatabase(this.getApplicationContext());
SqlScoutServer.create(this, getPackageName());
Intent intent = new Intent(getApplicationContext(), CrystalWalletService.class);
startService(intent);
}
}

View file

@ -1,19 +1,15 @@
package cy.agorise.crystalwallet.service;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.support.v4.app.NotificationCompat;
import android.util.Log;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequests;
import cy.agorise.crystalwallet.manager.BitsharesAccountManager;
/**
@ -28,6 +24,7 @@ public class CrystalWalletService extends Service {
private BitsharesAccountManager bitsharesAccountManager;
private Thread LoadAccountTransactionsThread;
private boolean keepLoadingAccountTransactions;
private CryptoNetInfoRequests cryptoNetInfoRequests;
// Handler that receives messages from the thread
private final class ServiceHandler extends Handler {
@ -50,8 +47,9 @@ public class CrystalWalletService extends Service {
while(this.keepLoadingAccountTransactions){
try{
Log.i("CrystalServiceLATThread","Searching for transactions...");
Thread.sleep(60000);//Sleep for 1 minutes //TODO Configurable time
Log.i("Crystal Service","Searching for transactions...");
Thread.sleep(60000);//Sleep for 1 minutes
// TODO search for accounts and make managers find new transactions
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
@ -60,7 +58,13 @@ public class CrystalWalletService extends Service {
@Override
public void onCreate() {
//Creates a instance for the cryptoNetInfoRequest and the managers
this.cryptoNetInfoRequests = CryptoNetInfoRequests.getInstance();
this.bitsharesAccountManager = new BitsharesAccountManager();
//Add the managers as listeners of the CryptoNetInfoRequest so
//they can carry out the info requests from the ui
this.cryptoNetInfoRequests.addListener(this.bitsharesAccountManager);
}
@Override

View file

@ -39,7 +39,7 @@ public class AccountSeedViewModel extends AndroidViewModel {
this.importSeedValidator = new ImportSeedValidator(this.app.getResources());
}
return null;
return this.importSeedValidator;
}
public void addSeed(AccountSeed seed){