Skip to content

Commit

Permalink
Add tests for setUpOptiBpActivityResultListener
Browse files Browse the repository at this point in the history
  • Loading branch information
SebaMutuku committed Aug 11, 2023
1 parent e9eaac7 commit 3fc8d2d
Show file tree
Hide file tree
Showing 4 changed files with 376 additions and 237 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,18 +157,14 @@ protected void addOnBarCodeResultListeners(final Context context, final Material
if (context instanceof JsonApi) {
JsonApi jsonApi = (JsonApi) context;
jsonApi.addOnActivityResultListener(JsonFormConstants.BARCODE_CONSTANTS.BARCODE_REQUEST_CODE,
new OnActivityResultListener() {
@Override
public void onActivityResult(int requestCode,
int resultCode, Intent data) {
if (requestCode == JsonFormConstants.BARCODE_CONSTANTS.BARCODE_REQUEST_CODE && resultCode == RESULT_OK) {
if (data != null) {
Barcode barcode = data.getParcelableExtra(JsonFormConstants.BARCODE_CONSTANTS.BARCODE_KEY);
Timber.d("Scanned QR Code %s ", barcode.displayValue);
editText.setText(barcode.displayValue);
} else
Timber.i("NO RESULT FOR QR CODE");
}
(requestCode, resultCode, data) -> {
if (requestCode == JsonFormConstants.BARCODE_CONSTANTS.BARCODE_REQUEST_CODE && resultCode == RESULT_OK) {
if (data != null) {
Barcode barcode = data.getParcelableExtra(JsonFormConstants.BARCODE_CONSTANTS.BARCODE_KEY);
Timber.d("Scanned QR Code %s ", barcode.displayValue);
editText.setText(barcode.displayValue);
} else
Timber.i("NO RESULT FOR QR CODE");
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,17 @@ private void addFingerprintResultsListener(final Context context, final ImageVie
if (context instanceof JsonApi) {
JsonApi jsonApi = (JsonApi) context;
jsonApi.addOnActivityResultListener(JsonFormConstants.ACTIVITY_REQUEST_CODE.REQUEST_CODE_REGISTER,
new OnActivityResultListener() {
@Override
public void onActivityResult(int requestCode,
int resultCode, Intent data) {
if (requestCode == JsonFormConstants.ACTIVITY_REQUEST_CODE.REQUEST_CODE_REGISTER && resultCode == RESULT_OK) {
if (data != null) {

SimPrintsRegistration registration = (SimPrintsRegistration) data.getSerializableExtra(SimPrintsConstantHelper.INTENT_DATA);
imageView.setTag(R.id.simprints_guid, registration.getGuid());
setFingerprintDrawable(context, imageView, registration.getGuid(), true);
Timber.d("Scanned Fingerprint GUID %s ", registration.getGuid());
} else {
Timber.i("NO RESULT FOR FINGERPRINT");
setFingerprintDrawable(context, imageView, "", true);
}
(requestCode, resultCode, data) -> {
if (requestCode == JsonFormConstants.ACTIVITY_REQUEST_CODE.REQUEST_CODE_REGISTER && resultCode == RESULT_OK) {
if (data != null) {

SimPrintsRegistration registration = (SimPrintsRegistration) data.getSerializableExtra(SimPrintsConstantHelper.INTENT_DATA);
imageView.setTag(R.id.simprints_guid, registration.getGuid());
setFingerprintDrawable(context, imageView, registration.getGuid(), true);
Timber.d("Scanned Fingerprint GUID %s ", registration.getGuid());
} else {
Timber.i("NO RESULT FOR FINGERPRINT");
setFingerprintDrawable(context, imageView, "", true);
}
}
});
Expand Down
Loading

0 comments on commit 3fc8d2d

Please sign in to comment.