CustomViews icon indicating copy to clipboard operation
CustomViews copied to clipboard

How to know if you have painted or not?

Open cataro opened this issue 10 years ago • 5 comments

Hi!!! I need to know if you have painted or not?

Thanks!!!

cataro avatar Jun 23 '14 11:06 cataro

I am not sure what you mean, could you elaborate?

CoatedMoose avatar Jun 23 '14 12:06 CoatedMoose

Yes, of course. When I present the Signatureview and I click the Ok button, would need to know if it is signed or not, since it always captures the image, has been signed or not.

Thank you.

2014-06-23 14:34 GMT+02:00 Andrew Crichton [email protected]:

I am not sure what you mean, could you elaborate?

— Reply to this email directly or view it on GitHub https://github.com/CoatedMoose/CustomViews/issues/9#issuecomment-46838621 .

cataro avatar Jun 23 '14 12:06 cataro

Yes, of course. When I present the Signatureview and I click the Ok button, would need to know if it is signed or not, since it always captures the image, has been signed or not.

Thank you.

cataro avatar Jun 23 '14 12:06 cataro

Knowing if it is signed is not really a possibility given the nature of signatures. I think that a reasonable solution would be to implement listeners for touch-down/touch-up events and assume that if a line is drawn, that it is signed. Alternatively, you could check the image to ensure the % of pixels coloured is > than some value (this seems like it might frustrate users with small/sparse signatures.

CoatedMoose avatar Jun 23 '14 20:06 CoatedMoose

My solution was to place a counter in touchMove that is incremented by one each time the method is called.

then before saving the signature I call the following method to validate it

public boolean isCompletedSignature() {
    if(counter >= COMPLETED_THRESHOLD)  
    {
        return true;
    }
    return false;
}

completed threshold is set at 5 which seems to be high enough to prevent just a short line being accepted but passes anything else. Old post i know but might help somebody else

momoteRyanmt avatar Jan 06 '15 19:01 momoteRyanmt