When the PIN does not match in the screen of import seed it does not show error message
This commit is contained in:
parent
3941585740
commit
8a7b41ad1d
2 changed files with 49 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -49,11 +49,23 @@
|
|||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtErrorPIN"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/tilPinConfirmation"
|
||||
android:textColor="@color/red"
|
||||
android:textSize="14sp"
|
||||
android:text="@string/mismatch_pin"
|
||||
android:layout_marginLeft="30dp"
|
||||
android:visibility="invisible"
|
||||
android:layout_marginTop="5dp"/>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/etSeedWordsLayout"
|
||||
android:layout_width="330dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/tilPinConfirmation"
|
||||
android:layout_below="@+id/txtErrorPIN"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_centerHorizontal="true">
|
||||
|
||||
|
|
Loading…
Reference in a new issue