RiccardoMoro / FreeDrawView

A View on which you can freely draw, customizing paint width, alpha and color, and take a screenshot of the content. Useful for note apps, signatures or free hand writing.
649 stars 117 forks source link

Make possible to add a Bitmap to FreeDrawView #8

Closed csbenz closed 7 years ago

csbenz commented 7 years ago

To be able to edit an old drawing.

RiccardoMoro commented 7 years ago

You mean restore a previous state from a FreeDrawView?

csbenz commented 7 years ago

I'm saving the drawings as Bitmaps in memory. When the user wants to edit a drawing, the library gives no option to start from the said Bitmap to be able to edit it.

On Tue, Feb 7, 2017, 18:01 Riccardo Moro notifications@github.com wrote:

You mean restore a previous state from a FreeDrawView?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/RiccardoMoro/FreeDrawView/issues/8#issuecomment-278065099, or mute the thread https://github.com/notifications/unsubscribe-auth/ADkBZB7Xl_SAXcCVBQTD_a_1FoVKABeaks5raKMvgaJpZM4L4upq . {"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/RiccardoMoro/FreeDrawView","title":"RiccardoMoro/FreeDrawView","subtitle":"GitHub repository","main_image_url":" https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png ","avatar_image_url":" https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/RiccardoMoro/FreeDrawView"}},"updates":{"snippets":[{"icon":"PERSON","message":"@RiccardoMoro in #8: You mean restore a previous state from a FreeDrawView?"}],"action":{"name":"View Issue","url":" https://github.com/RiccardoMoro/FreeDrawView/issues/8#issuecomment-278065099 "}}}

RiccardoMoro commented 7 years ago

Mmm I was thinking, it would be easier if I just give you a method public Parcelable getViewState() which gives a Parcelable containing the FreeDrawView state and a public void restoreStateFromParcelable(Parcelable parcelable) which given the Parcelable restores the View state, would that be good for you? (for now, I'll be working on the bitmap thing with the https://github.com/RiccardoMoro/FreeDrawView/issues/5 issue)

csbenz commented 7 years ago

That would be helpful, except for multi-platform apps. I'm saving the drawing in a cloud database and have to be able to recuperate it anywhere (eg PC). Still, I could store both the bitmap and the Parcelable State.

RiccardoMoro commented 7 years ago

Yes, you're right, I didn't think of multi-platform apps, my bad.. As a fast solution I can add the Parcelable save-restore today, and with time I'll add the option to restore from a Bitmap, would that be ok?

csbenz commented 7 years ago

Yes, fine! :) thanks for your work

On Thu, Feb 9, 2017, 19:36 Riccardo Moro notifications@github.com wrote:

Yes, you're right, I didn't think of multi-platform apps, my bad.. As a fast solution I can add the Parcelable save-restore today, and with time I'll add the option to restore from a Bitmap, would that be ok?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/RiccardoMoro/FreeDrawView/issues/8#issuecomment-278731104, or mute the thread https://github.com/notifications/unsubscribe-auth/ADkBZC_Quyv0m0itwl9-nrexFxMx6Pfcks5ra1v_gaJpZM4L4upq . {"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/RiccardoMoro/FreeDrawView","title":"RiccardoMoro/FreeDrawView","subtitle":"GitHub repository","main_image_url":" https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png ","avatar_image_url":" https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/RiccardoMoro/FreeDrawView"}},"updates":{"snippets":[{"icon":"PERSON","message":"@RiccardoMoro in #8: Yes, you're right, I didn't think of multi-platform apps, my bad..\r\nAs a fast solution I can add the Parcelable save-restore today, and with time I'll add the option to restore from a Bitmap, would that be ok?"}],"action":{"name":"View Issue","url":" https://github.com/RiccardoMoro/FreeDrawView/issues/8#issuecomment-278731104 "}}}

RiccardoMoro commented 7 years ago

Slowly working on this... I'm very busy working lately sorry I've made the method to get a Parcelable of the saved state, but than when I tried to write it inside a File I had an error doing myParcelable.marshall() because of the size of the Parcelable itself.. I'm trying something else in the next few days

csbenz commented 7 years ago

Thanks for the update and for working on this issue.

RiccardoMoro commented 7 years ago

@csbenz (Finally) I'm about to release the save-restore functionality. (in v1.1.0, I'll push it on bintray in about an hour) With the getCurrentViewStateAsSerializable() you can get the draw state as a Serializable And with restoreStateFromSerializable(FreeDrawSerializableState state) you can restore it.

Let me know if you find any problem with this new functionality Check out the new readme just above the View attributes section to see more

Thank you for the patience, Riccardo

RiccardoMoro commented 7 years ago

Closing this issue, let me know id you are having problems