diff options
author | Christian Schneppe <christian@pix-art.de> | 2016-08-26 23:48:48 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2016-08-28 21:33:19 +0200 |
commit | b3b3475e93a9b08f9e35edbf74673728b560ad3b (patch) | |
tree | fc72bfce668b358310061c0a94736a0bd14e8b5d /src/main/java/de/pixart/messenger/persistance | |
parent | 1f7f535d37b844dbd87447e1872c270edbca1302 (diff) |
compress videos bigger than 10 MB before sending
Diffstat (limited to 'src/main/java/de/pixart/messenger/persistance')
-rw-r--r-- | src/main/java/de/pixart/messenger/persistance/FileBackend.java | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/FileBackend.java b/src/main/java/de/pixart/messenger/persistance/FileBackend.java index d1e18f313..2972c71de 100644 --- a/src/main/java/de/pixart/messenger/persistance/FileBackend.java +++ b/src/main/java/de/pixart/messenger/persistance/FileBackend.java @@ -274,17 +274,16 @@ public class FileBackend { Log.d(Config.LOGTAG, "output file name " + file.getAbsolutePath()); } - public void copyFileToPrivateStorage(Message message, Uri uri) throws FileCopyException { - String mime = mXmppConnectionService.getContentResolver().getType(uri); - Log.d(Config.LOGTAG, "copy " + uri.toString() + " to private storage (mime="+mime+")"); - String extension = MimeTypeMap.getSingleton().getExtensionFromMimeType(mime); - if (extension == null) { - extension = getExtensionFromUri(uri); - } - String filename = fileDateFormat.format(new Date(message.getTimeSent()))+"_"+message.getUuid().substring(0,4); - message.setRelativeFilePath(filename + "." + extension); - copyFileToPrivateStorage(mXmppConnectionService.getFileBackend().getFile(message), uri); - } + public void copyFileToPrivateStorage(Message message, Uri uri) throws FileCopyException { + String mime = mXmppConnectionService.getContentResolver().getType(uri); + Log.d(Config.LOGTAG, "copy " + uri.toString() + " to private storage (mime="+mime+")"); + String extension = MimeTypeMap.getSingleton().getExtensionFromMimeType(mime); + if (extension == null) { + extension = getExtensionFromUri(uri); + } + message.setRelativeFilePath(message.getUuid() + "." + extension); + copyFileToPrivateStorage(mXmppConnectionService.getFileBackend().getFile(message), uri); + } private String getExtensionFromUri(Uri uri) { String[] projection = {MediaStore.MediaColumns.DATA}; |