From 76b5a6885d46a0cde5392029558bae85e71f403b Mon Sep 17 00:00:00 2001 From: Javier Varona Date: Thu, 11 Jan 2018 22:04:35 -0400 Subject: [PATCH] - Added dialog when creating a new bitshares account --- .../activities/CreateSeedActivity.java | 31 ++++++++++++++++++- ...ValidateCreateBitsharesAccountRequest.java | 2 +- .../res/layout/progress_creating_account.xml | 29 +++++++++++++++++ 3 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 app/src/main/res/layout/progress_creating_account.xml diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/CreateSeedActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/CreateSeedActivity.java index 9e306a0..40953e3 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/CreateSeedActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/CreateSeedActivity.java @@ -2,8 +2,10 @@ package cy.agorise.crystalwallet.activities; import android.arch.lifecycle.ViewModelProviders; import android.os.Bundle; +import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.text.Editable; +import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; @@ -108,9 +110,26 @@ public class CreateSeedActivity extends AppCompatActivity implements UIValidator final ValidateCreateBitsharesAccountRequest request = new ValidateCreateBitsharesAccountRequest(etAccountName.getText().toString(), getApplicationContext()); + + //Makes dialog to tell the user that the account is been created + AlertDialog.Builder alertBuilder = new AlertDialog.Builder(CreateSeedActivity.this,R.style.AppTheme); + alertBuilder.setView(R.layout.progress_creating_account); + //alertBuilder.setTitle("Processing"); + //alertBuilder.setMessage("Creating Bitshares Account"); + final AlertDialog processDialog = alertBuilder.create(); + CreateSeedActivity.this.runOnUiThread(new Runnable() { + @Override + public void run() { + processDialog.show(); + processDialog.getWindow().setLayout(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); + } + }); + request.setListener(new CryptoNetInfoRequestListener() { @Override public void onCarryOut() { + processDialog.dismiss(); + if (request.getAccount() != null){ finish(); } else { @@ -118,7 +137,17 @@ public class CreateSeedActivity extends AppCompatActivity implements UIValidator } } }); - CryptoNetInfoRequests.getInstance().addRequest(request); + + Thread thread = new Thread() { + @Override + public void run() { + CryptoNetInfoRequests.getInstance().addRequest(request); + } + }; + + thread.start(); + + //this.finish(); } diff --git a/app/src/main/java/cy/agorise/crystalwallet/cryptonetinforequests/ValidateCreateBitsharesAccountRequest.java b/app/src/main/java/cy/agorise/crystalwallet/cryptonetinforequests/ValidateCreateBitsharesAccountRequest.java index ca2e977..276174b 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/cryptonetinforequests/ValidateCreateBitsharesAccountRequest.java +++ b/app/src/main/java/cy/agorise/crystalwallet/cryptonetinforequests/ValidateCreateBitsharesAccountRequest.java @@ -53,7 +53,7 @@ public class ValidateCreateBitsharesAccountRequest extends CryptoNetInfoRequest } public void validate(){ - if ((this.accountExists != null) && (this.account != null)){ + if ((this.accountExists != null)){// && (this.account != null)){ this._fireOnCarryOutEvent(); } } diff --git a/app/src/main/res/layout/progress_creating_account.xml b/app/src/main/res/layout/progress_creating_account.xml new file mode 100644 index 0000000..2a002a6 --- /dev/null +++ b/app/src/main/res/layout/progress_creating_account.xml @@ -0,0 +1,29 @@ + + + + + + + + +