- Fixed ui info request when account name changes

This commit is contained in:
Javier Varona 2017-10-04 20:54:24 -04:00
parent e466fc8d53
commit e9e8c11eb3
4 changed files with 20 additions and 21 deletions

View file

@ -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();
}
}

View file

@ -18,7 +18,7 @@ public abstract class CryptoNetInfoRequest {
this.listener = listener;
}
public void _fireOnCarryOutEvent(){
protected void _fireOnCarryOutEvent(){
listener.onCarryOut();
}
}

View file

@ -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();
//
}
});

View file

@ -63,12 +63,11 @@ 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());
final ValidateImportBitsharesAccountRequest request = new ValidateImportBitsharesAccountRequest(accountName,mnemonic);
request.setListener(new CryptoNetInfoRequestListener() {
@Override
public void onCarryOut() {
@ -82,5 +81,4 @@ public class ImportSeedValidator {
});
CryptoNetInfoRequests.getInstance().addRequest(request);
}
}
}