k3b / APhotoManager

Manage local photos on Android: gallery, geotag with photomap, privacy, tags, find, sort, view, copy, send, ... .
GNU General Public License v3.0
224 stars 57 forks source link

Images are decoded without checking image size when loaded from a Filemanager in a Nomedia-Folder #197

Open sunshinelwj opened 2 years ago

sunshinelwj commented 2 years ago

When loading an image, Google suggests us to resize the image before decoding them, so as to save memory resource. https://developer.android.com/topic/performance/graphics/load-bitmap.html

However, in the code below, images are decoded directly without checking image size: de.k3b.android.androFotoFinder.gallery.cursor.GalleryCursorAdapterFromArray.java getView() (line number: 120) https://github.com/k3b/APhotoManager/blob/FDroid/app/src/main/java/de/k3b/android/androFotoFinder/gallery/cursor/GalleryCursorAdapterFromArray.java#L120

Are these images all of small sizes? Do you think they will affect APhotoManager's performance?

In addition, getView() is a callback that is frequently invoked in the UI thread. since image decoding is of high time consumption, we can perform these operations in worker threads (e.g., via AsyncTask).