Add listener to the class PatternRequestActivity to reuse the on success or fail password event
This commit is contained in:
parent
a21796d2d0
commit
ba96d999ff
1 changed files with 30 additions and 0 deletions
|
@ -39,6 +39,11 @@ public class PatternRequestActivity extends AppCompatActivity {
|
||||||
@BindView(R.id.txtBadtry)
|
@BindView(R.id.txtBadtry)
|
||||||
TextView txtBadtry;
|
TextView txtBadtry;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* External listener for success or fail
|
||||||
|
* */
|
||||||
|
private OnResponse onResponse;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Contains the bad tries
|
* Contains the bad tries
|
||||||
* */
|
* */
|
||||||
|
@ -100,11 +105,24 @@ public class PatternRequestActivity extends AppCompatActivity {
|
||||||
if (CrystalSecurityMonitor.getInstance(null).is2ndFactorSet()) {
|
if (CrystalSecurityMonitor.getInstance(null).is2ndFactorSet()) {
|
||||||
//CrystalSecurityMonitor.getInstance(null).call2ndFactor(thisActivity);
|
//CrystalSecurityMonitor.getInstance(null).call2ndFactor(thisActivity);
|
||||||
thisActivity.finish();
|
thisActivity.finish();
|
||||||
|
|
||||||
|
if(onResponse != null){
|
||||||
|
onResponse.onSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
thisActivity.finish();
|
thisActivity.finish();
|
||||||
|
|
||||||
|
if(onResponse != null){
|
||||||
|
onResponse.onSuccess();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
incorrect();
|
incorrect();
|
||||||
|
|
||||||
|
if(onResponse != null){
|
||||||
|
onResponse.onFailed();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,6 +140,10 @@ public class PatternRequestActivity extends AppCompatActivity {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setOnResponse(OnResponse onResponse) {
|
||||||
|
this.onResponse = onResponse;
|
||||||
|
}
|
||||||
|
|
||||||
private void incorrect(){
|
private void incorrect(){
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -224,6 +246,14 @@ public class PatternRequestActivity extends AppCompatActivity {
|
||||||
|
|
||||||
return patternString;
|
return patternString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Listener events for success and fail
|
||||||
|
* */
|
||||||
|
public interface OnResponse{
|
||||||
|
void onSuccess();
|
||||||
|
void onFailed();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue