A smooth and silky signature pad for android.
Method added
getCompressedSignatureBitmap(int compressLevel)
- compressLeven is from 1-100, which mean compress percentage of bitmapgetFixedSizeSignatureBitmap(int desiredWidth)
- desiredWidth is target width, which would adjust height automaticallygetFixedSizeSignatureBitmap(int desiredWidth,int desiredHeight)
- desiredWidth is target width and desiredHeight is target height
Bug fixed
- SVG double click bug fixed
Download SilkySignature or grab via Gradle:
implementation 'com.williamww:silky-signature:0.1.0'
You MUST request runtime permission when you are trying to save the signature image on version 6.0 or higher!
Add this to layout file
<com.williamww.silkysignature.views.SignaturePad
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/signature_pad"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:penColor="@android:color/black"
/>
Control in code
mSignaturePad = (SignaturePad) findViewById(R.id.signature_pad);
mSignaturePad.setOnSignedListener(new SignaturePad.OnSignedListener() {
@Override
public void onSigned() {
//Event triggered when the pad is signed
}
@Override
public void onClear() {
//Event triggered when the pad is cleared
}
});
To get signature image
getSignatureBitmap()
- A signature bitmap with a white background.getTransparentSignatureBitmap()
- A signature bitmap with a transparent background.getSignatureSvg()
- A signature Scalable Vector Graphics document in svg format.