Coder Social home page Coder Social logo

zahid-ali-shah / signatureview Goto Github PK

View Code? Open in Web Editor NEW
239.0 14.0 68.0 581 KB

SignatureView is an open source Android library which allow developers to produce pen and paper like effect for creating signatures on Android

License: Apache License 2.0

Java 100.00%
signatureview android signatureview-demo bitmap paper creating-signatures

signatureview's Introduction

  • ๐Ÿ‘‹ Hi, Iโ€™m Zahid Ali
  • ๐Ÿ‘€ Iโ€™m interested in open source projects
  • ๐ŸŒฑ Iโ€™m currently learning React.js and concurrency in programming languages
  • ๐Ÿฆ Follow me on twitter

signatureview's People

Contributors

dhanalakshmis avatar pchupik avatar zahid-ali-shah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

signatureview's Issues

Add setBitmap(Bitmap)

I'm implementing a solution with this that requires modifying a signature saved from a previous session. Is there an easy way to do this? Thanks!

Shajrah

Hi zahid, where is your shajrah project? I interest with that project, thanks

How to know whether a bitmap contains signature or not?

Hi,

Using the getSignatureBitmap() method we can get the bitmap but my question is, how do i know whether the bitmap does not contain any signature? Is there any workaround to identify that bitmap is empty i.e it does not contain any signature.

Thanks in Advance.
Kamal.

Not changing color

When changing the color using signatureview.setPencolor(Color.Red) .it doesnot change,i can change color only while changing in layout.

brand new

dear All, dear Zahid Ali,
first of all please excuse my poor english and my poor expertise in Android dev...
I'm actually a Visual Studio develeper and I'm often in troubles the limited time I spend in Android Studio, even more as it changes every time I do start it :)
I found reference to this piece of work of yours on stack overflow forum, as I'm required to capture "strokes and electronic signature" on some bitmaps/jpegs for later references..
your work has been strongly suggested and I downloaded it...
again, working that little with Android Studio I was unable to reference your "jar" as you recommend in your "getting started" section, so I ended up copying your 2 base classes into my project and... of course, it works... as expected :)

but my need is to capture strokes/signature on a base jpeg I've to load from device storage...
I've seen a method I thought were there for the purpose...
having
SignatureView m_signImage;
I tried
Bitmap bitmap = BitmapFactory.decodeFile( fileName );
m_signImage.setBitmap( bitmap );

(and bitmap is acttually correclty loaded from the file system with the desired jpg file, a 49,9 kb picture which is defined as 1024 x 576)
to show the "underlying" bitmap into the canvas, but I do actually have no visual result of the loade jpeg and the running application freezes in
SignatureView . public void setBitmap(Bitmap bitmap) { if (bitmap != null) { bmp = bitmap; canvasBmp = new Canvas(bitmap); // <---- freeze postInvalidate(); } }
so I do assume I'm making something wrong, of course...
can you please provide further info about what I'm doing wrong?
TIA,
Andrea

Migrate from JCenter

Hi

Could you put this package on a different gradle repository? JCenter's being shut down :-(

Ta muchly :-)

Recyclerview bug when signature view is rendered

I have a recycler view and i'm implementing a signature in each item

imagen
But i'm getting this behaivor:

imagen

I can't capture in each item of the recycler view the signature and seems it's duplicating and having some kind of bug. Any help?

I drop here my adapter code:

public class PersonaAdapter extends RecyclerView.Adapter<PersonaAdapter.ViewHolder> {

    public ArrayList<PersonasClass> personas;
    public Context context;

    public PersonaAdapter(ArrayList<PersonasClass> personas, Context context) {
        this.personas = personas;
        this.context = context;
    }

    @NonNull
    @Override
    public PersonaAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
        Context context = viewGroup.getContext();
        LayoutInflater layoutInflater = LayoutInflater.from(context);
        View v = layoutInflater.inflate(R.layout.item_personsa, viewGroup, false);
        PersonaAdapter.ViewHolder viewHolder = new PersonaAdapter.ViewHolder(v);

        return viewHolder;
    }

    @Override
    public void onBindViewHolder(@NonNull PersonaAdapter.ViewHolder viewHolder, int i) {
        viewHolder.number_element.setText((i+1) + ".");
    }

    @Override
    public int getItemViewType(int position) {
        return position;
    }

    @Override
    public int getItemCount() {
        return personas.size();
    }

    public class ViewHolder extends RecyclerView.ViewHolder {
        public EditText full_name, email, phone;
        public TextView number_element;
        public ViewHolder(@NonNull View itemView) {
            super(itemView);
            full_name = (EditText) itemView.findViewById(R.id.full_name);
            email = (EditText) itemView.findViewById(R.id.email);
            phone = (EditText) itemView.findViewById(R.id.phone);
            number_element = (TextView) itemView.findViewById(R.id.number_element);
            SignatureView signatureView = (SignatureView) itemView.findViewById(R.id.signature_view);
        }
    }
}

com.kyanogen.signatureview.SignatureView.newBitmapCanvas(

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.excellonsoft.serviceapp, PID: 3939
java.lang.IllegalArgumentException: width and height must be > 0
at android.graphics.Bitmap.createBitmap(Bitmap.java:829)
at android.graphics.Bitmap.createBitmap(Bitmap.java:808)
at android.graphics.Bitmap.createBitmap(Bitmap.java:775)
at com.kyanogen.signatureview.SignatureView.newBitmapCanvas(SignatureView.java:186)
at com.kyanogen.signatureview.SignatureView.onLayout(SignatureView.java:179)
at android.view.View.layout(View.java:16630)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
at android.view.View.layout(View.java:16630)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
at android.view.View.layout(View.java:16630)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
at android.view.View.layout(View.java:16630)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.support.v7.widget.RecyclerView$LayoutManager.layoutDecoratedWithMargins(RecyclerView.java:8074)
at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1472)
at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1377)
at android.support.v7.widget.LinearLayoutManager.scrollBy(LinearLayoutManager.java:1193)
at android.support.v7.widget.LinearLayoutManager.scrollVerticallyBy(LinearLayoutManager.java:1043)
at android.support.v7.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:4413)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
at android.view.Choreographer.doCallbacks(Choreographer.java:670)
at android.view.Choreographer.doFrame(Choreographer.java:603)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

setBitmap may be is incorrect

I think bellow code is incorrect

    public void setBitmap(Bitmap bitmap) {
        if (bmp!=null) {
            bmp=bitmap;
            canvasBmp = new Canvas(bitmap);
            postInvalidate();
        }
    }

I think the correct code should be

    public void setBitmap(Bitmap bitmap) {
        if (bitmap !=null) {
            bmp=bitmap;
            canvasBmp = new Canvas(bitmap);
            postInvalidate();
        }
    }

Download icon didn't work

EXPECTED BEHAVIOR
The app was expected to download signature when clicked on the icon.

ACTUAL BEHAVIOR
when clicked on download icon option it didn't work

HOW TO REPRODUCE

Launch the app and open

Sigh anythings on the app

Click download icon at the top and note the bug

Device used: Tecno Droipad 7D

Operating system: Android version 7.0

App version: 1.0.2

Recording of the Bug

https://youtu.be/cr6WfikcnW8

Signature focus

I have an issue using signature with editText. The signature never get the focus so the keyboard (if open for the editText) never disappear.

Render a bitmap in Signature View.

I am able to capture signature and get a bitmap of the signature.But there are no options to render a bitmap into Signature View.
I tried using ,
signatureView.draw(new Canvas(bitmap));

But it didn't work out.

I have fixed the bug and have opened a pull request.If you are ok with it you can merge it.

App clear canvas while change from portrait to landscape

EXPECTED BEHAVIOR
The app was not expected to clear canvas whether portrait or landscape

ACTUAL BEHAVIOR
When i change from portrait to landscape the signature clear

HOW TO REPRODUCE

Launch the app and open

Sigh anythings on the app

Change to landscape and note the bug

Device used: Tecno Droipad 7D

Operating system: Android version 7.0

App version: 1.0.2

Recording of the Bug
https://youtu.be/5NKPOKmmmVg

Pen colour not working

Pen colour not working in either XML or Code

sign:penColor="@color/colorPrimary"

signatureView.setPenColor(R.color.colorPrimary);

Both not working, Always using black colour. Please have a look on this issue. I am using Android OS 4.2.1

Activity containing signature view will crash android version 9

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.graphics.Bitmap.isRecycled()' on a null object reference
at android.graphics.BaseCanvas.throwIfCannotDraw(BaseCanvas.java:61)
at android.view.DisplayListCanvas.throwIfCannotDraw(DisplayListCanvas.java:226)
at android.view.RecordingCanvas.drawBitmap(RecordingCanvas.java:79)
at com.kyanogen.signatureview.SignatureView.onDraw(SignatureView.java:287)
at android.view.View.draw(View.java:20234)
at android.view.View.updateDisplayListIfDirty(View.java:19109)
at android.view.View.draw(View.java:19962)
at android.view.ViewGroup.drawChild(ViewGroup.java:4337)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4114)
at android.view.View.draw(View.java:20237)
at android.view.View.updateDisplayListIfDirty(View.java:19109)
at android.view.View.draw(View.java:19962)
at android.view.ViewGroup.drawChild(ViewGroup.java:4337)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4114)
at android.view.View.updateDisplayListIfDirty(View.java:19100)
at android.view.View.draw(View.java:19962)
at android.view.ViewGroup.drawChild(ViewGroup.java:4337)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4114)
at android.view.View.updateDisplayListIfDirty(View.java:19100)
at android.view.View.draw(View.java:19962)
at android.view.ViewGroup.drawChild(ViewGroup.java:4337)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4114)
at android.view.View.updateDisplayListIfDirty(View.java:19100)
at android.view.View.draw(View.java:19962)
at android.view.ViewGroup.drawChild(ViewGroup.java:4337)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4114)
at android.view.View.updateDisplayListIfDirty(View.java:19100)
at android.view.View.draw(View.java:19962)
at android.view.ViewGroup.drawChild(ViewGroup.java:4337)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4114)
at android.view.View.draw(View.java:20237)
at com.android.internal.policy.DecorView.draw(DecorView.java:784)
at android.view.View.updateDisplayListIfDirty(View.java:19109)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:686)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:692)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:801)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:3418)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:3195)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2564)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1534)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7421)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1092)
at android.view.Choreographer.doCallbacks(Choreographer.java:888)
at android.view.Choreographer.doFrame(Choreographer.java:819)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1078)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6810)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)

bitmap is empty

when i check is bitmap Empty give me false and then i check bitmap therer bitmap="" what is the issues

Please Provide a method for UNDO and REDO.

this is a fantastic project and I am using this library without any error issue. but I think this library should have a method for UNDO and REDO. this thing I missed while I am using my app. I am kindly requesting please add those abilities for UNDO and REDO also with the Eraser option. thank you

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.