diff options
Diffstat (limited to 'src/main/java/de/pixart/messenger/persistance/FileBackend.java')
-rw-r--r-- | src/main/java/de/pixart/messenger/persistance/FileBackend.java | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/FileBackend.java b/src/main/java/de/pixart/messenger/persistance/FileBackend.java index 8397a7bb8..765766b5f 100644 --- a/src/main/java/de/pixart/messenger/persistance/FileBackend.java +++ b/src/main/java/de/pixart/messenger/persistance/FileBackend.java @@ -111,8 +111,7 @@ public class FileBackend { } } - public boolean deleteFile(Message message) { - File file = getFile(message); + public boolean deleteFile(File file) { if (file.delete()) { updateMediaScanner(file); return true; @@ -121,6 +120,11 @@ public class FileBackend { } } + public boolean deleteFile(Message message) { + File file = getFile(message); + return deleteFile(file); + } + public DownloadableFile getFile(Message message) { return getFile(message, true); } @@ -219,8 +223,8 @@ public class FileBackend { } public static String getConversationsDirectory(final String type) { - if (type.equalsIgnoreCase("null") || type == null) { - return getAppMediaDirectory() + "Pix-Art Messenger" + "/"; + if (type.equalsIgnoreCase("null")) { + return Environment.getExternalStorageDirectory().getAbsolutePath() + "/" + "Pix-Art Messenger" + "/"; } else { return getAppMediaDirectory() + "Pix-Art Messenger" + " " + type + "/"; } @@ -858,6 +862,7 @@ public class FileBackend { return cropCenterSquare(input, size); } } catch (FileNotFoundException | SecurityException e) { + Log.d(Config.LOGTAG, "unable to open file " + image.toString(), e); return null; } finally { close(is); @@ -1097,7 +1102,7 @@ public class FileBackend { drawOverlay(bitmap, R.drawable.play_video, 0.75f); } else { bitmap = cropCenterSquare(attachment.getUri(), size); - if ("image/gif".equals(attachment.getMime())) { + if (bitmap != null && "image/gif".equals(attachment.getMime())) { Bitmap withGifOverlay = bitmap.copy(Bitmap.Config.ARGB_8888, true); drawOverlay(withGifOverlay, R.drawable.play_gif, 1.0f); bitmap.recycle(); |