Stop double caching the thumbnails

Notification doesn't need it cached anyway, so save the space.
This commit is contained in:
Stephen Paul Weber 2022-03-09 11:19:26 -05:00
parent 840c96c5e1
commit 7a809bd26a
No known key found for this signature in database
GPG key ID: D11C2911CE519CDE
2 changed files with 5 additions and 13 deletions

View file

@ -946,18 +946,10 @@ public class FileBackend {
return thumbnail;
}
public Bitmap getThumbnailBitmap(Message message, Resources res, int size, boolean cacheOnly) throws IOException {
final String uuid = message.getUuid();
final LruCache<String, Bitmap> cache = mXmppConnectionService.getBitmapCache();
Bitmap thumbnail = cache.get(uuid);
if ((thumbnail == null) && (!cacheOnly)) {
final Drawable drawable = getThumbnail(message, res, size, cacheOnly);
if (drawable != null) {
thumbnail = drawDrawable(drawable);
cache.put(uuid, thumbnail);
}
}
return thumbnail;
public Bitmap getThumbnailBitmap(Message message, Resources res, int size) throws IOException {
final Drawable drawable = getThumbnail(message, res, size, false);
if (drawable == null) return null;
return drawDrawable(drawable);
}
private Drawable getImagePreview(File file, Resources res, int size, final String mime) throws IOException {

View file

@ -1062,7 +1062,7 @@ public class NotificationService {
private void modifyForImage(final Builder builder, final Message message, final ArrayList<Message> messages) {
try {
final Bitmap bitmap = mXmppConnectionService.getFileBackend().getThumbnailBitmap(message, mXmppConnectionService.getResources(), getPixel(288), false);
final Bitmap bitmap = mXmppConnectionService.getFileBackend().getThumbnailBitmap(message, mXmppConnectionService.getResources(), getPixel(288));
final ArrayList<Message> tmp = new ArrayList<>();
for (final Message msg : messages) {
if (msg.getType() == Message.TYPE_TEXT