Stop double caching the thumbnails
Notification doesn't need it cached anyway, so save the space.
This commit is contained in:
parent
840c96c5e1
commit
7a809bd26a
|
@ -946,18 +946,10 @@ public class FileBackend {
|
||||||
return thumbnail;
|
return thumbnail;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bitmap getThumbnailBitmap(Message message, Resources res, int size, boolean cacheOnly) throws IOException {
|
public Bitmap getThumbnailBitmap(Message message, Resources res, int size) throws IOException {
|
||||||
final String uuid = message.getUuid();
|
final Drawable drawable = getThumbnail(message, res, size, false);
|
||||||
final LruCache<String, Bitmap> cache = mXmppConnectionService.getBitmapCache();
|
if (drawable == null) return null;
|
||||||
Bitmap thumbnail = cache.get(uuid);
|
return drawDrawable(drawable);
|
||||||
if ((thumbnail == null) && (!cacheOnly)) {
|
|
||||||
final Drawable drawable = getThumbnail(message, res, size, cacheOnly);
|
|
||||||
if (drawable != null) {
|
|
||||||
thumbnail = drawDrawable(drawable);
|
|
||||||
cache.put(uuid, thumbnail);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return thumbnail;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Drawable getImagePreview(File file, Resources res, int size, final String mime) throws IOException {
|
private Drawable getImagePreview(File file, Resources res, int size, final String mime) throws IOException {
|
||||||
|
|
|
@ -1062,7 +1062,7 @@ public class NotificationService {
|
||||||
|
|
||||||
private void modifyForImage(final Builder builder, final Message message, final ArrayList<Message> messages) {
|
private void modifyForImage(final Builder builder, final Message message, final ArrayList<Message> messages) {
|
||||||
try {
|
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<>();
|
final ArrayList<Message> tmp = new ArrayList<>();
|
||||||
for (final Message msg : messages) {
|
for (final Message msg : messages) {
|
||||||
if (msg.getType() == Message.TYPE_TEXT
|
if (msg.getType() == Message.TYPE_TEXT
|
||||||
|
|
Loading…
Reference in a new issue