android-signaturepad


Source link: https://github.com/gcacace/android-signaturepad

Android Signature Pad

Android Signature Pad is an Android library for drawing smooth signatures. It uses variable width Bézier curve interpolation based on Smoother Signatures post by Square.

Features

  • Bézier implementation for a smoother line
  • Variable point size based on velocity
  • Customizable pen color and size
  • Bitmap and SVG support
  • Data Binding

Installation

Latest version of the library can be found on Maven Central.

For Gradle users

Open your build.gradle and make sure that Maven Central repository is declared into repositories section:

repositories {

  mavenCentral()
 
}

Then, include the library as dependency:

compile 'com.github.gcacace:signature-pad:1.2.1'

For Maven users

Add this dependency to your pom.xml:

<dependency>
<groupId>com.github.gcacace</groupId>
<artifactId>signature-pad</artifactId>
<version>1.2.1</version>
<type>aar</type> </dependency>

Usage

Please see the /SignaturePad-Example app for a more detailed code example of how to use the library.

  1. Add the SignaturePad view to the layout you want to show.
 <com.github.gcacace.signaturepad.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"

/>
  1. Configure attributes.
  • penMinWidth - The minimum width of the stroke (default: 3dp).
  • penMaxWidth - The maximum width of the stroke (default: 7dp).
  • penColor - The color of the stroke (default: Color.BLACK).
  • velocityFilterWeight - Weight used to modify new velocity based on the previous velocity (default: 0.9).
  • clearOnDoubleClick - Double click to clear pad (default: false)
  1. Configure signature events listener

An OnSignedListener can be set on the view:

mSignaturePad = (SignaturePad) findViewById(R.id.signature_pad);
 mSignaturePad.setOnSignedListener(new SignaturePad.OnSignedListener() {

 @Override

public void onStartSigning() {

 //Event triggered when the pad is touched

}

@Override
  public void onSigned() {

//Event triggered when the pad is signed
  
}

@Override
  public void onClear() {

//Event triggered when the pad is cleared
  
}
 
}
);
  1. Get signature data
  • getSignatureBitmap() - A signature bitmap with a white background.
  • getTransparentSignatureBitmap() - A signature bitmap with a transparent background.
  • getSignatureSvg() - A signature Scalable Vector Graphics document.

Data Binding

The SignaturePad view has custom Data Binding attribute setters for all the listener events:

 <com.github.gcacace.signaturepad.views.SignaturePad

xmlns:android="http://schemas.android.com/apk/res/android"

xmlns:bind="http://schemas.android.com/apk/res-auto"

android:id="@+id/signature_pad"

android:layout_width="match_parent"

android:layout_height="match_parent"

bind:onStartSigning="@{
activity.onStartSigning
}
"

bind:onSigned="@{
activity.onSigned
}
"

bind:onClear="@{
activity.onClear
}
" />

Cordova Plugin

Thanks to netinhoteixeira, there is a Cordova plugin using that library. Please refer to https://github.com/netinhoteixeira/cordova-plugin-signature-view.

NativeScript Plugin

Thanks to bradmartin, there is a NativeScript plugin. Please refer to https://github.com/bradmartin/nativescript-signaturepad.

Caveats

Currently doesn't support screen rotations. Pull requests are welcome!

License

Copyright 2014-2016 Gianluca Cacace  Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License. You may obtain a copy of the License at
  http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 

Resources

PlayTabLayout is a tab layout very similar to Google Play tab layout. The main feature is that ripple shows in a particular place where user taps.

Use the LitToast to get lit and show your users a proper toast.

The Simple Number Separator is the lightweight library for separate number with coma in android or dot or dynamically by your locale device.

A sample Android application to demonstrate how to build screens as fully independent modules.

Goals

  • Use native Android SDK as much as possible (Fragment, ViewModel)
  • Support configuration changes

StylishWidget is a library for an Android Application project to make the UI more beautiful and allow to use third party fonts.

Android Support Library's NavigationView with RTL items.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes