From 0605390144b85dfe3531ad47cfa276f9f5c8ba5b Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Fri, 17 Oct 2014 13:09:02 +0200 Subject: do not attempt to download images when not connected --- src/eu/siacs/conversations/http/HttpConnection.java | 13 ++++++++++--- src/eu/siacs/conversations/http/HttpConnectionManager.java | 2 -- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'src/eu/siacs/conversations/http') diff --git a/src/eu/siacs/conversations/http/HttpConnection.java b/src/eu/siacs/conversations/http/HttpConnection.java index b0c230d0e..0254dc2f0 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 ff71d45c4..9a2a24052 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; -- cgit v1.2.3