- Now the user can add seeds

This commit is contained in:
Javier Varona 2017-10-01 15:58:08 -04:00
parent a21b0a8752
commit 7b0801eb97
4 changed files with 10 additions and 7 deletions

View file

@ -39,7 +39,7 @@ public class AccountSeedsManagementActivity extends AppCompatActivity {
accountSeedListViewModel = ViewModelProviders.of(this).get(AccountSeedListViewModel.class);
LiveData<List<AccountSeed>> accountSeedData = accountSeedListViewModel.getAccountSeedList();
//vAccountSeedList = this.findViewById(R.id.vAccountSeedList);
vAccountSeedList.setData(null);
accountSeedData.observe(this, new Observer<List<AccountSeed>>() {
@Override
@ -47,8 +47,6 @@ public class AccountSeedsManagementActivity extends AppCompatActivity {
vAccountSeedList.setData(accountSeeds);
}
});
//accountSeedListView.setData(null);
}
@OnClick (R.id.btnImportAccountSeed)

View file

@ -6,6 +6,7 @@ import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import java.util.List;
@ -31,7 +32,10 @@ public class ImportSeedActivity extends AppCompatActivity {
TextView tvPinConfirmation;
@BindView(R.id.etSeedWords)
TextView etSeedWords;
EditText etSeedWords;
@BindView (R.id.etAccountName)
EditText etAccountName;
@BindView(R.id.btnImport)
Button btnImport;
@ -54,6 +58,7 @@ public class ImportSeedActivity extends AppCompatActivity {
//TODO verify if PIN and PIN confirmation are not null and are the same
//TODO verify if words are already in the db
seed.setMasterSeed(etSeedWords.getText().toString());
seed.setName(etAccountName.getText().toString());
accountSeedViewModel.addSeed(seed);
}

View file

@ -42,12 +42,12 @@ public class IntroActivity extends AppCompatActivity {
//Checks if the user has any seed created
AccountSeedListViewModel accountSeedListViewModel = ViewModelProviders.of(this).get(AccountSeedListViewModel.class);
if (accountSeedListViewModel.accountSeedsCount() == 0){
//if (accountSeedListViewModel.accountSeedsCount() == 0){
//If the user doesn't have any seeds created, then
//send the user to create/import an account
Intent intent = new Intent(this, AccountSeedsManagementActivity.class);
startActivity(intent);
}
//}
/*CrystalDatabase db = CrystalDatabase.getAppDatabase(getApplicationContext());
List<AccountSeed> seeds = RandomSeedGenerator.generateSeeds(2);

View file

@ -28,7 +28,7 @@ public class GrapheneApiGenerator {
//TODO network connections
private static int connectionTimeout = 5000;
private static String url = "http://128.0.69.157:8090"
private static String url = "http://128.0.69.157:8090";
/**
* Retrieves the data of an account searching by it's id