diff options
author | Christian Schneppe <christian@pix-art.de> | 2016-05-31 22:05:26 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2016-05-31 22:05:26 +0200 |
commit | c41e6004909c10d4d24c7030d584f8e9fdf52d7c (patch) | |
tree | 85af238cffe70a8414387df9ebb20c5945f62518 | |
parent | 1a46ae528a7894a405c9fb1cfba90a6386e826d4 (diff) |
changed some folders for files
-rw-r--r-- | src/main/java/eu/siacs/conversations/persistance/FileBackend.java | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java index fe27cda5f..e2944ed23 100644 --- a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java +++ b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java @@ -74,7 +74,8 @@ public class FileBackend { } public void updateMediaScanner(File file) { - if (file.getAbsolutePath().startsWith(getConversationsImageDirectory())) { + if (file.getAbsolutePath().startsWith(getConversationsImageDirectory()) + || file.getAbsolutePath().startsWith(getConversationsVideoDirectory())) { Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); intent.setData(Uri.fromFile(file)); mXmppConnectionService.sendBroadcast(intent); @@ -106,17 +107,21 @@ public class FileBackend { if (path == null) { path = message.getUuid(); } - if (path.startsWith("/")) { - file = new DownloadableFile(path); - } else { - String mime = message.getMimeType(); - if (mime != null && mime.startsWith("image")) { - file = new DownloadableFile(getConversationsImageDirectory() + path); - } else { - file = new DownloadableFile(getConversationsFileDirectory() + path); - } - } - if (encrypted) { + if (path.startsWith("/")) { + file = new DownloadableFile(path); + } else { + String mime = message.getMimeType(); + if (mime != null && mime.startsWith("image")) { + file = new DownloadableFile(getConversationsImageDirectory() + path); + } else if (mime != null && mime.startsWith("video")) { + file = new DownloadableFile(getConversationsVideoDirectory() + path); + } else if (mime != null && mime.startsWith("audio")) { + file = new DownloadableFile(getConversationsAudioDirectory() + path); + } else { + file = new DownloadableFile(getConversationsFileDirectory() + path); + } + } + if (encrypted) { return new DownloadableFile(getConversationsFileDirectory() + file.getName() + ".pgp"); } else { return file; @@ -147,13 +152,19 @@ public class FileBackend { } public static String getConversationsFileDirectory() { - return Environment.getExternalStorageDirectory().getAbsolutePath()+"/Pix-Art Messenger/"; + return Environment.getExternalStorageDirectory().getAbsolutePath()+"/Pix-Art Messenger/files/"; } public static String getConversationsImageDirectory() { - return Environment.getExternalStoragePublicDirectory( - Environment.DIRECTORY_PICTURES).getAbsolutePath() - + "/Pix-Art Messenger/"; + return Environment.getExternalStorageDirectory().getAbsolutePath()+"/Pix-Art Messenger/images/"; + } + + public static String getConversationsVideoDirectory() { + return Environment.getExternalStorageDirectory().getAbsolutePath()+"/Pix-Art Messenger/videos/"; + } + + public static String getConversationsAudioDirectory() { + return Environment.getExternalStorageDirectory().getAbsolutePath()+"/Pix-Art Messenger/audios/"; } public Bitmap resize(Bitmap originalBitmap, int size) { |