diff options
author | steckbrief <steckbrief@chefmail.de> | 2017-02-06 10:01:13 +0100 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2017-02-06 10:01:13 +0100 |
commit | 754de6bb0449a577d2bb9c28cca6adf0ef9554f6 (patch) | |
tree | 279b405d94e0d86d10ed94bd34d919457944ead6 /src/main/java/de/thedevstack/conversationsplus/ui/ConversationFragment.java | |
parent | cd633f13b8d7327e47994bb5a000f0c0b7089e7f (diff) |
relates FS#241: Implementation of http download based on okhttp
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/ui/ConversationFragment.java')
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/ui/ConversationFragment.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/ConversationFragment.java b/src/main/java/de/thedevstack/conversationsplus/ui/ConversationFragment.java index 157e6dc3..0f32e762 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/ConversationFragment.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/ConversationFragment.java @@ -43,8 +43,7 @@ import java.util.Collections; import java.util.List; import de.thedevstack.conversationsplus.ConversationsPlusPreferences; -import de.thedevstack.conversationsplus.http.HttpConnectionManager; -import de.thedevstack.conversationsplus.http.HttpDownloadConnection; +import de.thedevstack.conversationsplus.services.filetransfer.FileTransferManager; import de.thedevstack.conversationsplus.services.filetransfer.http.delete.DeleteRemoteFileService; import de.thedevstack.conversationsplus.ui.dialogs.SimpleConfirmDialog; import de.thedevstack.conversationsplus.ui.dialogs.MessageDetailsDialog; @@ -559,8 +558,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa } if (m.hasFileOnRemoteHost() || GeoHelper.isGeoUri(m.getBody()) - || m.treatAsDownloadable() == Message.Decision.MUST - || (t != null && t instanceof HttpDownloadConnection)) { + || m.treatAsDownloadable() == Message.Decision.MUST) { copyUrl.setVisible(true); } if ((m.getType() == Message.TYPE_TEXT && t == null && m.treatAsDownloadable() != Message.Decision.NEVER) @@ -687,8 +685,12 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa } private void downloadFile(Message message) { - HttpDownloadConnection downloadConnection = HttpConnectionManager.createNewDownloadConnection(message, true); - if (null == downloadConnection) { + FileTransferManager ftm = FileTransferManager.getInstance(); + boolean created = false; + if (ftm.accept(message)) { + created = ftm.transferFile(message); + } + if (!created) { Toast.makeText(activity, R.string.file_not_on_remote_host, Toast.LENGTH_LONG).show(); } } |