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 597abd0..978a38c 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/ImportSeedActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/ImportSeedActivity.java @@ -9,6 +9,7 @@ import android.text.Editable; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; +import android.widget.Toast; import java.util.List; @@ -61,7 +62,7 @@ public class ImportSeedActivity extends AppCompatActivity implements ImportSeedV @OnTextChanged(value = R.id.etAccountName, callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED) void afterAccountNameChanged(Editable editable) { - this.importSeedValidator.validateAccountName(editable.toString()); + this.importSeedValidator.validateAccountName(editable.toString(), etSeedWords.getText().toString()); } @OnClick(R.id.btnImport) @@ -88,5 +89,7 @@ public class ImportSeedActivity extends AppCompatActivity implements ImportSeedV @Override public void onValidationFailed(String error) { //Show errors + Toast.makeText(this, error, + Toast.LENGTH_LONG).show(); } } diff --git a/app/src/main/java/cy/agorise/crystalwallet/cryptonetinforequests/CryptoNetInfoRequest.java b/app/src/main/java/cy/agorise/crystalwallet/cryptonetinforequests/CryptoNetInfoRequest.java index 24c11e9..a9e7f83 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/cryptonetinforequests/CryptoNetInfoRequest.java +++ b/app/src/main/java/cy/agorise/crystalwallet/cryptonetinforequests/CryptoNetInfoRequest.java @@ -18,7 +18,7 @@ public abstract class CryptoNetInfoRequest { this.listener = listener; } - public void _fireOnCarryOutEvent(){ + protected void _fireOnCarryOutEvent(){ listener.onCarryOut(); } } diff --git a/app/src/main/java/cy/agorise/crystalwallet/manager/BitsharesAccountManager.java b/app/src/main/java/cy/agorise/crystalwallet/manager/BitsharesAccountManager.java index 06e15c4..9b6698a 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/manager/BitsharesAccountManager.java +++ b/app/src/main/java/cy/agorise/crystalwallet/manager/BitsharesAccountManager.java @@ -49,19 +49,17 @@ public class BitsharesAccountManager implements CryptoAccountManager, CryptoNetI for(PublicKey activeKey : prop.active.getKeyAuthList()){ if(activeKey.toBytes().equals(bk.getPublicKey())){ importRequest.setMnemonicIsCorrect(true); - importRequest._fireOnCarryOutEvent(); return; } } importRequest.setMnemonicIsCorrect(false); - importRequest._fireOnCarryOutEvent(); } } @Override public void fail(int idPetition) { - importRequest._fireOnCarryOutEvent(); + // } }); GrapheneApiGenerator.getAccountById((String)answer,getAccountInfo); @@ -69,7 +67,7 @@ public class BitsharesAccountManager implements CryptoAccountManager, CryptoNetI @Override public void fail(int idPetition) { - importRequest._fireOnCarryOutEvent(); + // } }); diff --git a/app/src/main/java/cy/agorise/crystalwallet/viewmodels/validators/ImportSeedValidator.java b/app/src/main/java/cy/agorise/crystalwallet/viewmodels/validators/ImportSeedValidator.java index 5bd5cf5..09ee261 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/viewmodels/validators/ImportSeedValidator.java +++ b/app/src/main/java/cy/agorise/crystalwallet/viewmodels/validators/ImportSeedValidator.java @@ -63,24 +63,22 @@ public class ImportSeedValidator { //} - public void validateAccountName(final String accountName){ + public void validateAccountName(final String accountName, final String mnemonic){ final ValidationField validationField = getValidationField("accountname"); validationField.setLastValue(accountName); - if (this.accountSeed != null){ - final ValidateImportBitsharesAccountRequest request = new ValidateImportBitsharesAccountRequest(this.accountSeed.getName(),this.accountSeed.getMasterSeed()); - request.setListener(new CryptoNetInfoRequestListener() { - @Override - public void onCarryOut() { - if (!request.getAccountExists()){ - validationField.setValidForValue(accountName, false); - validationField.setMessage(res.getString(R.string.account_name_not_exist)); - } else { - validationField.setValidForValue(accountName, true); - } + final ValidateImportBitsharesAccountRequest request = new ValidateImportBitsharesAccountRequest(accountName,mnemonic); + request.setListener(new CryptoNetInfoRequestListener() { + @Override + public void onCarryOut() { + if (!request.getAccountExists()){ + validationField.setValidForValue(accountName, false); + validationField.setMessage(res.getString(R.string.account_name_not_exist)); + } else { + validationField.setValidForValue(accountName, true); } - }); - CryptoNetInfoRequests.getInstance().addRequest(request); - } + } + }); + CryptoNetInfoRequests.getInstance().addRequest(request); } }