BasicAirData / GPSLogger

A GPS logger for Android mobile devices
http://www.basicairdata.eu/projects/android/android-gps-logger/
GNU General Public License v3.0
401 stars 126 forks source link

Preload and Keep in memory Tracks Thumbnail #22

Closed GrazianoCapelli closed 7 years ago

GrazianoCapelli commented 7 years ago

Currently the thumbnail of each tracks is loaded on-the-fly by a tracklist card when needed, causing:

It would be fine to keep in memory the thumbnail of every track of the tracklist.

I tried including Picasso library with a good result (I left commented out the few lines of code I've added to try it). But the use of Picasso for very little and static images isn't an optimized solution. It would be better to include the thumb Bitmap directly into each Track object, maybe including a synchronous and an asynchronous setter, and a getter (for the cards).

Thus, I think we could implement a way to enable these features: 1) The app can tell to a track to Async load a thumbnail (on start, or when the thumb is ready); 2) The tracklist can request a thumbnail, causing a (urgent) synchronous load of the thumb if not yet loaded.

GrazianoCapelli commented 7 years ago

Enhancement implemented in commit 323c7a4.

GrazianoCapelli commented 7 years ago

I decided to reopen the issue and revert to the previous solution, because the new one was too memory hungry. I prefer to keep the application as light as possible (now we allocate less than 16 MB of memory, including EGM grid). Thus I need more work. Maybe a branch will be opened.

GrazianoCapelli commented 7 years ago

Thumbs are now asynchronously loaded in a SparseArray on start. The memory usage is now reasonably low and no reload is done when activities are restarted.