From 8a7b41ad1df2484b39bdfb2a6ae4e7e4bf6f2895 Mon Sep 17 00:00:00 2001 From: dtvv Date: Wed, 17 Oct 2018 04:50:38 -0500 Subject: [PATCH] When the PIN does not match in the screen of import seed it does not show error message --- .../activities/ImportSeedActivity.java | 36 +++++++++++++++++++ app/src/main/res/layout/import_seed.xml | 14 +++++++- 2 files changed, 49 insertions(+), 1 deletion(-) 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 1085a4b..ee62e17 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/ImportSeedActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/ImportSeedActivity.java @@ -3,6 +3,7 @@ package cy.agorise.crystalwallet.activities; import android.app.Activity; import android.arch.lifecycle.ViewModelProviders; import android.content.Intent; +import android.graphics.Color; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.text.Editable; @@ -10,6 +11,7 @@ import android.text.TextWatcher; import android.view.View; import android.widget.Button; import android.widget.EditText; +import android.widget.TextView; import android.widget.Toast; import com.thekhaeng.pushdownanim.PushDownAnim; @@ -35,6 +37,10 @@ public class ImportSeedActivity extends AppCompatActivity implements UIValidator @BindView(R.id.etPin) EditText etPin; + + @BindView(R.id.txtErrorPIN) + TextView txtErrorPIN; + //@BindView(R.id.tvPinError) //TextView tvPinError; @@ -120,6 +126,11 @@ public class ImportSeedActivity extends AppCompatActivity implements UIValidator else{ disableCreate(); } + + /* + * Validate that PINs are equals + * */ + validatePINS(); } }); etPinConfirmation.addTextChangedListener(new TextWatcher() { @@ -145,6 +156,11 @@ public class ImportSeedActivity extends AppCompatActivity implements UIValidator else{ disableCreate(); } + + /* + * Validate that PINs are equals + * */ + validatePINS(); } }); etSeedWords.addTextChangedListener(new TextWatcher() { @@ -203,6 +219,26 @@ public class ImportSeedActivity extends AppCompatActivity implements UIValidator importSeedValidator.setListener(this); } + /* + * Validate that PINs are equals + * */ + private void validatePINS(){ + + final String pin = etPin.getText().toString().trim(); + final String confirmoPIN = etPinConfirmation.getText().toString().trim(); + if(!pin.isEmpty() && !confirmoPIN.isEmpty()){ + if(pin.compareTo(confirmoPIN)!=0){ + txtErrorPIN.setVisibility(View.VISIBLE); + } + else{ + txtErrorPIN.setVisibility(View.INVISIBLE); + } + } + else{ + txtErrorPIN.setVisibility(View.INVISIBLE); + } + } + /* * Method to validate if all the fields are fill diff --git a/app/src/main/res/layout/import_seed.xml b/app/src/main/res/layout/import_seed.xml index 4b68d61..4279257 100644 --- a/app/src/main/res/layout/import_seed.xml +++ b/app/src/main/res/layout/import_seed.xml @@ -49,11 +49,23 @@ + +