line-sdk-android icon indicating copy to clipboard operation
line-sdk-android copied to clipboard

feat: Make image loading customizable and remove Picasso dependency

Open bc-lee opened this issue 5 months ago • 1 comments

This commit introduces an ImageLoader interface and LineSdkImageConfig to allow apps to provide their own image loading implementation.

A DefaultImageLoader is provided as a basic, yet efficient, implementation with the following characteristics:

  • Caches bitmaps in memory using LruCache to reduce network requests and improve UI responsiveness.
  • Safely handles ImageView references within coroutines using WeakReference to prevent potential memory leaks.
  • Decodes image dimensions efficiently using inJustDecodeBounds before loading the full image into memory.

The SDK no longer uses Picasso directly, and the dependency has been removed. Advanced image loading features can be implemented by creating a custom ImageLoader with libraries like Glide or Coil.

Dialogs now use LineSdkImageConfig.getImageLoader() to load images.

Fixes #163.

bc-lee avatar Aug 05 '25 19:08 bc-lee

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Aug 05 '25 19:08 CLAassistant