diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-10-17 13:09:02 +0200 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-10-17 13:09:02 +0200 |
commit | 0605390144b85dfe3531ad47cfa276f9f5c8ba5b (patch) | |
tree | c05fbb7eb88f9dbb541ae91684060d59621afeed /src/eu/siacs/conversations/http | |
parent | 3372e50155ac16c9eabce9a484914c2acbf391c8 (diff) |
do not attempt to download images when not connected
Diffstat (limited to 'src/eu/siacs/conversations/http')
-rw-r--r-- | src/eu/siacs/conversations/http/HttpConnection.java | 13 | ||||
-rw-r--r-- | src/eu/siacs/conversations/http/HttpConnectionManager.java | 2 |
2 files changed, 10 insertions, 5 deletions
diff --git a/src/eu/siacs/conversations/http/HttpConnection.java b/src/eu/siacs/conversations/http/HttpConnection.java index b0c230d0..0254dc2f 100644 --- a/src/eu/siacs/conversations/http/HttpConnection.java +++ b/src/eu/siacs/conversations/http/HttpConnection.java @@ -12,7 +12,9 @@ import javax.net.ssl.HttpsURLConnection; import android.content.Intent; import android.graphics.BitmapFactory; import android.net.Uri; +import android.util.Log; +import eu.siacs.conversations.Config; import eu.siacs.conversations.entities.Downloadable; import eu.siacs.conversations.entities.DownloadableFile; import eu.siacs.conversations.entities.Message; @@ -35,9 +37,14 @@ public class HttpConnection implements Downloadable { } @Override - public void start() { - changeStatus(STATUS_DOWNLOADING); - new Thread(new FileDownloader()).start(); + public boolean start() { + if (mXmppConnectionService.hasInternetConnection()) { + changeStatus(STATUS_DOWNLOADING); + new Thread(new FileDownloader()).start(); + return true; + } else { + return false; + } } public void init(Message message) { diff --git a/src/eu/siacs/conversations/http/HttpConnectionManager.java b/src/eu/siacs/conversations/http/HttpConnectionManager.java index ff71d45c..9a2a2405 100644 --- a/src/eu/siacs/conversations/http/HttpConnectionManager.java +++ b/src/eu/siacs/conversations/http/HttpConnectionManager.java @@ -1,11 +1,9 @@ package eu.siacs.conversations.http; -import java.net.URL; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; import eu.siacs.conversations.entities.Message; -import eu.siacs.conversations.entities.Message.ImageParams; import eu.siacs.conversations.services.AbstractConnectionManager; import eu.siacs.conversations.services.XmppConnectionService; |