Skip to main content

Signature

This module creates a canvas, and lets the users upload their signatures.

Preparetion for starting the signature module

start method returns a Fragment that you can use to capture set number of signatures. When number of signature will be taken is equal to your goal you can call the upload function inside the callback as below.

int NUMBER_OF_SIGNATURE_WILL_BE_TAKEN = 1;                                                                        
Amani.sharedInstance().Signature().start(this, NUMBER_OF_SIGNATURE_WILL_BE_TAKEN, (bitmap, countOfSignature) -> {
if (bitmap != null) {
if (NUMBER_OF_SIGNATURE_WILL_BE_TAKEN == countOfSignature) {
Amani.sharedInstance().Signature().upload((isSuccess, result, errors) -> {
if (isSuccess) {
Log.d(TAG, "Signature is uploaded");
}
if (result != null) {
if (result.equals("OK")) {
Log.d(TAG, "Pending Review");
}
}
if (errors != null) {
if (errors.get(0) != null) {
Log.d(TAG, " Error" + errors.get(0));
}
}
});
}
}
});

Adding Confirm and Clean button

You should add two buttons with label of clear and confirm.

Cleaning the Canvas

You can call clean function, on a button that sits on the top of the fragment.

Amani.sharedInstance().Signature().clean();

Confirm

To confrim the current signature user must press the confirm button and call this function.

Amani.sharedInstance().Signature().confirm(context);

Resetting the count of signatures

If you want to reset the process in the middle of capturing, you must call resetCountOfSignature() method. It should be used when necessary as it's use is optional.

Amani.sharedInstance().Signature().resetCountOfSignature();

Uploading the Signatures

Simply call the upload method as shown below.

Amani.sharedInstance().Signature().upload { isSucess: Boolean ->
Log.d(TAG, "upload isSuccess $isSucess")
Log.d(TAG, "upload result $result")
if(errors!= null) Log.d(TAG, "upload first error${errors[0]}")
}