Code Monkey home page Code Monkey logo

sigcap's Introduction

sigcap

This library is intended to help capture signatures with an easily-configurable style.

sigcap Sample

Installation

repositories {
    jcenter()
}

dependencies {
    compile('com.guardanis:sigcap:1.0.0')
}

Usage

The basic component is the SignatureInputView which actually handles the touch-to-draw events for the signature, as well as the drawing for the baseline (and x-marker). All the default styling values can be overriden at the resource-level, or at the implementation level with the styled attributes.

If you want to implement the undo action outside the default dialog, you'd have to manually call SignatureInputView.undoLastSignaturePath().

Calling SignatureInputView.saveSignature() will attempt to save the drawing cache of the SignatureInputView into a File and return the result if it's successful. Please note, it is highly recommended you delete the signature file after you're done using it.

SignatureDialogBuilder

This helper class is all you need to integrate sigcap (unless you really want to get fancy), with strings and colors easily overriden through the resources (same as the default resources mentioned above).

Here's an example of how to call the SignatureDialogBuilder, from the gif example above:

new SignatureDialogBuilder()
            .show(this, new SignatureDialogBuilder.SignatureEventListener() {
                @Override
                public void onSignatureEntered(File savedFile) {
                    new ImageFileRequest<ImageView>(MainActivity.this, savedFile)
                            .setTargetView((ImageView) findViewById(R.id.test_image))
                            .setFadeTransition()
                            .execute(); // Just showing the image 
                }

                @Override
                public void onSignatureInputCanceled() {
                    Toast.makeText(MainActivity.this, "Signature input canceled", Toast.LENGTH_SHORT)
                            .show();
                }

                @Override
                public void onSignatureInputError(Throwable e) {
                    if(e instanceof NoSignatureException) // They clicked confirm without entering anything
                        doSomethingOnNoSignatureEntered();
                    else Toast.makeText(MainActivity.this, "Signature error", Toast.LENGTH_SHORT)
                            .show();
                }
            });

sigcap's People

Contributors

mattsilber avatar ravidsrk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.