When try to import the account, it should show a loading window while the user is waiting for it

This commit is contained in:
dtvv 2018-10-04 15:25:07 -05:00
parent 1545f0e10b
commit a54363a9ef

View file

@ -1,5 +1,6 @@
package cy.agorise.crystalwallet.activities; package cy.agorise.crystalwallet.activities;
import android.app.Activity;
import android.arch.lifecycle.ViewModelProviders; import android.arch.lifecycle.ViewModelProviders;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
@ -15,6 +16,7 @@ import butterknife.ButterKnife;
import butterknife.OnClick; import butterknife.OnClick;
import butterknife.OnTextChanged; import butterknife.OnTextChanged;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.dialogs.material.CrystalLoading;
import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequestListener; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequestListener;
import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequests; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequests;
import cy.agorise.crystalwallet.requestmanagers.ValidateImportBitsharesAccountRequest; import cy.agorise.crystalwallet.requestmanagers.ValidateImportBitsharesAccountRequest;
@ -54,6 +56,8 @@ public class ImportSeedActivity extends AppCompatActivity implements UIValidator
@BindView(R.id.btnCancel) @BindView(R.id.btnCancel)
Button btnCancel; Button btnCancel;
final Activity activity = this;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -227,12 +231,25 @@ public class ImportSeedActivity extends AppCompatActivity implements UIValidator
if (this.importSeedValidator.isValid()) { if (this.importSeedValidator.isValid()) {
/*
* Loading dialog
* */
final CrystalLoading crystalLoading = new CrystalLoading(activity);
crystalLoading.show();
final ValidateImportBitsharesAccountRequest validatorRequest = final ValidateImportBitsharesAccountRequest validatorRequest =
new ValidateImportBitsharesAccountRequest(etAccountName.getText().toString(), etSeedWords.getText().toString(), getApplicationContext(), true); new ValidateImportBitsharesAccountRequest(etAccountName.getText().toString(), etSeedWords.getText().toString(), getApplicationContext(), true);
validatorRequest.setListener(new CryptoNetInfoRequestListener() { validatorRequest.setListener(new CryptoNetInfoRequestListener() {
@Override @Override
public void onCarryOut() { public void onCarryOut() {
/*
* Hide the loading dialog
* */
crystalLoading.dismiss();
if (!validatorRequest.getStatus().equals(ValidateImportBitsharesAccountRequest.StatusCode.SUCCEEDED)) { if (!validatorRequest.getStatus().equals(ValidateImportBitsharesAccountRequest.StatusCode.SUCCEEDED)) {
String errorText = "An error ocurred attempting to import the account"; String errorText = "An error ocurred attempting to import the account";