don't show 'cancel download', if file is not downloading

This commit is contained in:
Christian Schneppe 2021-02-10 20:25:56 +01:00
parent 02f24aba26
commit 9ccc59b645
2 changed files with 8 additions and 0 deletions

View file

@ -144,6 +144,7 @@ import static eu.siacs.conversations.ui.XmppActivity.EXTRA_ACCOUNT;
import static eu.siacs.conversations.ui.XmppActivity.REQUEST_INVITE_TO_CONVERSATION;
import static eu.siacs.conversations.ui.util.SoftKeyboardUtils.hideSoftKeyboard;
import static eu.siacs.conversations.utils.Compatibility.runsTwentyOne;
import static eu.siacs.conversations.utils.MessageUtils.fileWithKnownSize;
import static eu.siacs.conversations.utils.PermissionUtils.allGranted;
import static eu.siacs.conversations.utils.PermissionUtils.getFirstDenied;
import static eu.siacs.conversations.utils.PermissionUtils.readGranted;
@ -1358,6 +1359,9 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
if (cancelable) {
cancelTransmission.setVisible(true);
}
if (fileWithKnownSize(m)) {
cancelTransmission.setVisible(false);
}
if (m.isFileOrImage() && !deleted && !cancelable) {
String path = m.getRelativeFilePath();
Log.d(Config.LOGTAG, "Path = " + path);

View file

@ -112,4 +112,8 @@ public class MessageUtils {
public static boolean unInitiatedButKnownSize(Message message) {
return message.getType() == Message.TYPE_TEXT && message.getTransferable() == null && message.isOOb() && message.getFileParams().size > 0 && message.getFileParams().url != null;
}
public static boolean fileWithKnownSize(Message message) {
return message.getType() == Message.TYPE_TEXT && message.isOOb() && message.getFileParams().size > 0 && message.getFileParams().url != null;
}
}