burhanrashid52 / PhotoEditor

A Photo Editor library with simple, easy support for image editing using paints,text,filters,emoji and Sticker like stories.
MIT License
4.08k stars 983 forks source link

Replace AsyncTask with Kotlin coroutines when saving image #499

Closed wasky closed 1 year ago

wasky commented 1 year ago

This commit replaces deprecated AsyncTask for saving images with Kotlin coroutines. Coroutines is Google's recommended solution for asynchronous programming on Android.

The commit also fixes a crash caused by View.draw() being called from worker thread when saving image (issue #374). As documentation says (https://developer.android.com/topic/performance/threads#references):

By design, Android View objects are not thread-safe. An app is expected to create, use, and destroy UI objects, all on the main thread. If you try to modify or even reference a UI object in a thread other than the main thread, the result can be exceptions, silent failures, crashes, and other undefined misbehavior.

burhanrashid52 commented 1 year ago

@wasky I will review it later. Meanwhile, can you help with the documentation and change log that will happen because of this change? And also the arrow change?

I've labeled all the issues and PR with 3.0.0.

wasky commented 1 year ago

OK

gabrielnakhata commented 1 year ago

@wasky, Sorry to refer to this request as I have a question... This 3.0.0 label for this edition will be the last revised for publication from the library, correct?

burhanrashid52 commented 1 year ago

@lucianocheng Would you like to review this code since I don't have much context on a coroutine?

lucianocheng commented 1 year ago

@burhanrashid52 unfortunately I don't think I can get to this anytime soon.

burhanrashid52 commented 1 year ago

@wasky, Sorry to refer to this request as I have a question... This 3.0.0 label for this edition will be the last revised for publication from the library, correct?

Yes