aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/persistance
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-11-14 01:29:56 +0100
committeriNPUTmice <daniel@gultsch.de>2014-11-15 15:34:12 +0100
commitc7acfe85c379b99c05cef98dbbab6f815b99ed83 (patch)
treebebb789d4f6edd18aae07495ec3fca477066b1d8 /src/main/java/eu/siacs/conversations/persistance
parentdac12be53e18962c80fd471421adac29b5c92f06 (diff)
progress for http images as well. fixed open button for sent files
Diffstat (limited to 'src/main/java/eu/siacs/conversations/persistance')
-rw-r--r--src/main/java/eu/siacs/conversations/persistance/FileBackend.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java
index 908cbefc..7b0ae180 100644
--- a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java
+++ b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java
@@ -8,6 +8,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.net.URL;
import java.net.URLConnection;
import java.security.DigestOutputStream;
import java.security.MessageDigest;
@@ -462,6 +463,10 @@ public class FileBackend {
}
public void updateFileParams(Message message) {
+ updateFileParams(message,null);
+ }
+
+ public void updateFileParams(Message message, URL url) {
DownloadableFile file = getFile(message);
if (message.getType() == Message.TYPE_IMAGE || file.getMimeType().startsWith("image/")) {
BitmapFactory.Options options = new BitmapFactory.Options();
@@ -469,7 +474,11 @@ public class FileBackend {
BitmapFactory.decodeFile(file.getAbsolutePath(), options);
int imageHeight = options.outHeight;
int imageWidth = options.outWidth;
- message.setBody(Long.toString(file.getSize()) + '|' + imageWidth + '|' + imageHeight);
+ if (url == null) {
+ message.setBody(Long.toString(file.getSize()) + '|' + imageWidth + '|' + imageHeight);
+ } else {
+ message.setBody(url.toString()+"|"+Long.toString(file.getSize()) + '|' + imageWidth + '|' + imageHeight);
+ }
} else {
message.setBody(Long.toString(file.getSize()));
}