diff options
author | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-04-25 23:06:20 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-04-25 23:06:20 +0200 |
commit | 645139eb68cb966b90d36790e5b60c0bc6727c78 (patch) | |
tree | 9633c20bd4f2e5aa1906373bdea5a07b1aacd6fc /src/eu/siacs/conversations/persistance | |
parent | bf2d0d5596a08872230056d056241ee906962171 (diff) |
couple of more optimazations on image loading
Diffstat (limited to 'src/eu/siacs/conversations/persistance')
-rw-r--r-- | src/eu/siacs/conversations/persistance/FileBackend.java | 43 |
1 files changed, 2 insertions, 41 deletions
diff --git a/src/eu/siacs/conversations/persistance/FileBackend.java b/src/eu/siacs/conversations/persistance/FileBackend.java index 129176a4..c451b906 100644 --- a/src/eu/siacs/conversations/persistance/FileBackend.java +++ b/src/eu/siacs/conversations/persistance/FileBackend.java @@ -118,10 +118,10 @@ public class FileBackend { .getAbsolutePath()); } - public Bitmap getThumbnail(Message message, int size) + public Bitmap getThumbnail(Message message, int size, boolean cacheOnly) throws FileNotFoundException { Bitmap thumbnail = thumbnailCache.get(message.getUuid()); - if (thumbnail == null) { + if ((thumbnail == null)&&(!cacheOnly)) { Bitmap fullsize = BitmapFactory.decodeFile(getJingleFile(message) .getAbsolutePath()); if (fullsize == null) { @@ -132,45 +132,6 @@ public class FileBackend { } return thumbnail; } - - public void getThumbnailAsync(final Message message, final int size, ImageView imageView, TextView textView) { - - Bitmap thumbnail = thumbnailCache.get(message.getUuid()); - if (thumbnail == null) { - final WeakReference<ImageView> image = new WeakReference<ImageView>(imageView); - final WeakReference<TextView> text = new WeakReference<TextView>(textView); - new Thread(new Runnable() { - - @Override - public void run() { - if (image.get()!=null) { - image.get().setVisibility(View.GONE); - } - if (text.get()!=null) { - text.get().setVisibility(View.VISIBLE); - text.get().setText("loading image"); - } - Bitmap fullsize = BitmapFactory.decodeFile(getJingleFile(message) - .getAbsolutePath()); - if (fullsize!=null) { - Bitmap thumbnail = resize(fullsize, size); - thumbnailCache.put(message.getUuid(), thumbnail); - if (image.get()!=null) { - image.get().setVisibility(View.VISIBLE); - image.get().setImageBitmap(thumbnail); - } - if (text.get()!=null) { - text.get().setVisibility(View.GONE); - } - } - } - }).start(); - } else { - textView.setVisibility(View.GONE); - imageView.setVisibility(View.VISIBLE); - imageView.setImageBitmap(thumbnail); - } - } public void removeFiles(Conversation conversation) { String prefix = context.getFilesDir().getAbsolutePath(); |