aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/ui
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-04-24 21:33:07 +0200
committerChristian Schneppe <christian@pix-art.de>2018-04-24 21:33:07 +0200
commit3bfbf315f6264304acaf5a9ade3be48767f5b49f (patch)
tree59e1c632e9e9ca4d549d99868ba770e5d0ea8e7d /src/main/java/de/pixart/messenger/ui
parent9103c001805cb70ae6c264523afbf249155b997d (diff)
fixed redownload
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
index 2febcded4..1f03dc778 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
@@ -1330,9 +1330,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
return;
}
- final boolean treatAsFile = m.getType() != Message.TYPE_TEXT
- && m.getType() != Message.TYPE_PRIVATE
- && !(t instanceof TransferablePlaceholder);
+ final boolean deleted = t != null && t instanceof TransferablePlaceholder;
final boolean encrypted = m.getEncryption() == Message.ENCRYPTION_DECRYPTION_FAILED
|| m.getEncryption() == Message.ENCRYPTION_PGP;
final boolean receiving = m.getStatus() == Message.STATUS_RECEIVED && (t instanceof JingleConnection || t instanceof HttpDownloadConnection);
@@ -1349,7 +1347,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
MenuItem downloadFile = menu.findItem(R.id.download_file);
MenuItem deleteFile = menu.findItem(R.id.delete_file);
MenuItem showErrorMessage = menu.findItem(R.id.show_error_message);
- if (!treatAsFile && !encrypted && !m.isGeoUri() && !m.treatAsDownloadable()) {
+ if (!m.isFileOrImage() && !encrypted && !m.isGeoUri() && !m.treatAsDownloadable()) {
copyMessage.setVisible(true);
quoteMessage.setVisible(MessageUtils.prepareQuote(m).length() > 0);
}
@@ -1361,7 +1359,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
&& (m.getConversation().getMucOptions().nonanonymous() || m.getConversation().getMode() == Conversation.MODE_SINGLE)) {
correctMessage.setVisible(true);
}
- if ((treatAsFile && !receiving) || (m.getType() == Message.TYPE_TEXT && !m.treatAsDownloadable())) {
+ if ((m.isFileOrImage() && !deleted && !receiving) || (m.getType() == Message.TYPE_TEXT && !m.treatAsDownloadable())) {
shareWith.setVisible(true);
}
@@ -1375,17 +1373,17 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
|| (t != null && t instanceof HttpDownloadConnection)) {
copyUrl.setVisible(true);
}
- if ((m.isFileOrImage() && t instanceof TransferablePlaceholder && m.hasFileOnRemoteHost())) {
+ if (m.isFileOrImage() && deleted && m.hasFileOnRemoteHost()) {
downloadFile.setVisible(true);
downloadFile.setTitle(activity.getString(R.string.download_x_file, UIHelper.getFileDescriptionString(activity, m)));
}
boolean waitingOfferedSending = m.getStatus() == Message.STATUS_WAITING
|| m.getStatus() == Message.STATUS_UNSEND
|| m.getStatus() == Message.STATUS_OFFERED;
- if ((t != null && !(t instanceof TransferablePlaceholder)) || waitingOfferedSending && m.needsUploading()) {
+ if ((t != null && !deleted) || waitingOfferedSending && m.needsUploading()) {
cancelTransmission.setVisible(true);
}
- if (treatAsFile) {
+ if (m.isFileOrImage() && !deleted) {
String path = m.getRelativeFilePath();
Log.d(Config.LOGTAG, "Path = " + path);
if (path == null || !path.startsWith("/") || path.contains(FileBackend.getConversationsDirectory("null", false))) {
@@ -1672,11 +1670,12 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
}
Transferable transferable = message.getTransferable();
if (transferable != null) {
- if (transferable instanceof TransferablePlaceholder && message.treatAsDownloadable()) {
+ if (transferable instanceof TransferablePlaceholder && message.hasFileOnRemoteHost()) {
activity.xmppConnectionService.getHttpConnectionManager().createNewDownloadConnection(message, true);
return;
}
if (!transferable.start()) {
+ Log.d(Config.LOGTAG, "type: " + transferable.getClass().getName());
Toast.makeText(getActivity(), R.string.not_connected_try_again, Toast.LENGTH_SHORT).show();
}
} else if (message.treatAsDownloadable()) {