@@ -10,6 +10,7 @@ Android Signature Pad is an Android library for drawing smooth signatures. It us
10
10
* Variable point size based on velocity
11
11
* Customizable pen color and size
12
12
* Bitmap and SVG support
13
+ * Data Binding
13
14
14
15
##Installation
15
16
@@ -25,7 +26,7 @@ Open your `build.gradle` and make sure that Maven Central repository is declared
25
26
```
26
27
Then, include the library as dependency:
27
28
``` gradle
28
- compile 'com.github.gcacace:signature-pad:1.2.0 '
29
+ compile 'com.github.gcacace:signature-pad:1.2.1 '
29
30
```
30
31
31
32
### For Maven users
@@ -35,7 +36,7 @@ Add this dependency to your `pom.xml`:
35
36
<dependency >
36
37
<groupId >com.github.gcacace</groupId >
37
38
<artifactId >signature-pad</artifactId >
38
- <version >1.2.0 </version >
39
+ <version >1.2.1 </version >
39
40
<type >aar</type >
40
41
</dependency >
41
42
```
@@ -45,8 +46,7 @@ Add this dependency to your `pom.xml`:
45
46
* Please see the ` /SignaturePad-Example ` app for a more detailed code example of how to use the library.*
46
47
47
48
1 . Add the ` SignaturePad ` view to the layout you want to show.
48
- ``` xml
49
-
49
+ ``` xml
50
50
<com .github.gcacace.signaturepad.views.SignaturePad
51
51
xmlns : android =" http://schemas.android.com/apk/res/android"
52
52
xmlns : app =" http://schemas.android.com/apk/res-auto"
@@ -55,7 +55,8 @@ Add this dependency to your `pom.xml`:
55
55
android : layout_height =" match_parent"
56
56
app : penColor =" @android:color/black"
57
57
/>
58
- ```
58
+ ```
59
+
59
60
2 . Configure attributes.
60
61
* ` penMinWidth ` - The minimum width of the stroke (default: 3dp).
61
62
* ` penMaxWidth ` - The maximum width of the stroke (default: 7dp).
@@ -66,10 +67,16 @@ Add this dependency to your `pom.xml`:
66
67
3 . Configure signature events listener
67
68
68
69
An ` OnSignedListener ` can be set on the view:
69
- ```java
70
+ ``` java
70
71
71
72
mSignaturePad = (SignaturePad ) findViewById(R . id. signature_pad);
72
73
mSignaturePad. setOnSignedListener(new SignaturePad .OnSignedListener () {
74
+
75
+ @Override
76
+ public void onStartSigning () {
77
+ // Event triggered when the pad is touched
78
+ }
79
+
73
80
@Override
74
81
public void onSigned () {
75
82
// Event triggered when the pad is signed
@@ -80,13 +87,29 @@ Add this dependency to your `pom.xml`:
80
87
// Event triggered when the pad is cleared
81
88
}
82
89
});
83
- ```
90
+ ```
84
91
85
92
4 . Get signature data
86
93
* ` getSignatureBitmap() ` - A signature bitmap with a white background.
87
94
* ` getTransparentSignatureBitmap() ` - A signature bitmap with a transparent background.
88
95
* ` getSignatureSvg() ` - A signature Scalable Vector Graphics document.
89
96
97
+ ## Data Binding
98
+
99
+ The ` SignaturePad ` view has custom Data Binding attribute setters for all the listener events:
100
+
101
+ ``` xml
102
+ <com .github.gcacace.signaturepad.views.SignaturePad
103
+ xmlns : android =" http://schemas.android.com/apk/res/android"
104
+ xmlns : bind =" http://schemas.android.com/apk/res-auto"
105
+ android : id =" @+id/signature_pad"
106
+ android : layout_width =" match_parent"
107
+ android : layout_height =" match_parent"
108
+ bind : onStartSigning =" @{activity.onStartSigning}"
109
+ bind : onSigned =" @{activity.onSigned}"
110
+ bind : onClear =" @{activity.onClear}" />
111
+ ```
112
+
90
113
## Cordova Plugin
91
114
92
115
Thanks to [ netinhoteixeira] ( https://github.com/netinhoteixeira/ ) , there is a Cordova plugin using that library.
0 commit comments