Android Image Cropper async support and custom progress UI

It's embarrassing really, soon after creating my Android-Image-Cropper fork as I wrote about in my previous post, a GitHub user noted that I have a slowness issue caused by loading/decoding image URI on main thread potentially causing an ANR, really a newbie mistake.
Unfortunately starting a new startup I didn't have the time to fix it then, and no one come forward with a pull request. Fortunately the company is more mature now so I can commit a bit of my free time for the project.
 
What we will have here:

  • A few words on the implementation.
  • Using setImageUriAsync and getCroppedImageAsync.
  • Handling OnSetImageUriComplete and OnGetCroppedImageComplete listeners.
  • Overriding default progress bar UI using showProgressBar view attribute and listeners.

 
TL;DR See the gist.
Continue reading

Advertisements