aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/persistance
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-11-13 22:59:00 +0100
committeriNPUTmice <daniel@gultsch.de>2014-11-15 15:34:11 +0100
commit02cbda68a7af5c500f2044cb97507c680ef2bc41 (patch)
tree0b60e96d3b2e50e7c7483d407b8110e677ecbbb3 /src/main/java/eu/siacs/conversations/persistance
parent7a90ca429bb46fae4cbd600bd4c2274f4a731a16 (diff)
bug fixes and various improvements for file transfer
Diffstat (limited to 'src/main/java/eu/siacs/conversations/persistance')
-rw-r--r--src/main/java/eu/siacs/conversations/persistance/FileBackend.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java
index f052bd532..2d054b5ec 100644
--- a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java
+++ b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java
@@ -433,6 +433,21 @@ public class FileBackend {
return Uri.parse("file://" + file.getAbsolutePath());
}
+ public void updateFileParams(Message message) {
+ DownloadableFile file = getFile(message);
+ if (message.getType() == Message.TYPE_IMAGE || file.getMimeType().startsWith("image/")) {
+ BitmapFactory.Options options = new BitmapFactory.Options();
+ options.inJustDecodeBounds = true;
+ BitmapFactory.decodeFile(file.getAbsolutePath(), options);
+ int imageHeight = options.outHeight;
+ int imageWidth = options.outWidth;
+ message.setBody(Long.toString(file.getSize()) + '|' + imageWidth + '|' + imageHeight);
+ } else {
+ message.setBody(Long.toString(file.getSize()));
+ }
+
+ }
+
public class FileCopyException extends Exception {
private static final long serialVersionUID = -1010013599132881427L;
private int resId;