From 7b0801eb97d705974ce364a346d61d876e4fd3b1 Mon Sep 17 00:00:00 2001 From: Javier Varona Date: Sun, 1 Oct 2017 15:58:08 -0400 Subject: [PATCH] - Now the user can add seeds --- .../activities/AccountSeedsManagementActivity.java | 4 +--- .../crystalwallet/activities/ImportSeedActivity.java | 7 ++++++- .../cy/agorise/crystalwallet/activities/IntroActivity.java | 4 ++-- .../crystalwallet/apigenerator/GrapheneApiGenerator.java | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/AccountSeedsManagementActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/AccountSeedsManagementActivity.java index 53b1170..3a1a2af 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/AccountSeedsManagementActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/AccountSeedsManagementActivity.java @@ -39,7 +39,7 @@ public class AccountSeedsManagementActivity extends AppCompatActivity { accountSeedListViewModel = ViewModelProviders.of(this).get(AccountSeedListViewModel.class); LiveData> accountSeedData = accountSeedListViewModel.getAccountSeedList(); - //vAccountSeedList = this.findViewById(R.id.vAccountSeedList); + vAccountSeedList.setData(null); accountSeedData.observe(this, new Observer>() { @Override @@ -47,8 +47,6 @@ public class AccountSeedsManagementActivity extends AppCompatActivity { vAccountSeedList.setData(accountSeeds); } }); - - //accountSeedListView.setData(null); } @OnClick (R.id.btnImportAccountSeed) diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/ImportSeedActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/ImportSeedActivity.java index 7bc0701..f6c2f45 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/ImportSeedActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/ImportSeedActivity.java @@ -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); } diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/IntroActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/IntroActivity.java index 382fdd4..b5aa54a 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/IntroActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/IntroActivity.java @@ -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 seeds = RandomSeedGenerator.generateSeeds(2); diff --git a/app/src/main/java/cy/agorise/crystalwallet/apigenerator/GrapheneApiGenerator.java b/app/src/main/java/cy/agorise/crystalwallet/apigenerator/GrapheneApiGenerator.java index 8c5499a..573fb02 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/apigenerator/GrapheneApiGenerator.java +++ b/app/src/main/java/cy/agorise/crystalwallet/apigenerator/GrapheneApiGenerator.java @@ -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