本文整理汇总了Java中eu.siacs.conversations.entities.TransferablePlaceholder类的典型用法代码示例。如果您正苦于以下问题:Java TransferablePlaceholder类的具体用法?Java TransferablePlaceholder怎么用?Java TransferablePlaceholder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TransferablePlaceholder类属于eu.siacs.conversations.entities包,在下文中一共展示了TransferablePlaceholder类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: markFileDeleted
import eu.siacs.conversations.entities.TransferablePlaceholder; //导入依赖的package包/类
private void markFileDeleted(String uuid) {
for (Conversation conversation : getConversations()) {
Message message = conversation.findMessageWithFileAndUuid(uuid);
if (message != null) {
if (!getFileBackend().isFileAvailable(message)) {
message.setTransferable(new TransferablePlaceholder(Transferable.STATUS_DELETED));
final int s = message.getStatus();
if (s == Message.STATUS_WAITING || s == Message.STATUS_OFFERED || s == Message.STATUS_UNSEND) {
markMessage(message, Message.STATUS_SEND_FAILED);
} else {
updateConversationUi();
}
}
return;
}
}
}
示例2: cancel
import eu.siacs.conversations.entities.TransferablePlaceholder; //导入依赖的package包/类
public void cancel() {
this.disconnectSocks5Connections();
if (this.transport != null && this.transport instanceof JingleInbandTransport) {
this.transport.disconnect();
}
this.sendCancel();
this.mJingleConnectionManager.finishConnection(this);
if (this.responder.equals(account.getJid())) {
this.message.setTransferable(new TransferablePlaceholder(Transferable.STATUS_FAILED));
if (this.file!=null) {
file.delete();
}
this.mXmppConnectionService.updateConversationUi();
} else {
this.mXmppConnectionService.markMessage(this.message,
Message.STATUS_SEND_FAILED);
this.message.setTransferable(null);
}
}
示例3: fail
import eu.siacs.conversations.entities.TransferablePlaceholder; //导入依赖的package包/类
private void fail() {
this.mJingleStatus = JINGLE_STATUS_FAILED;
this.disconnectSocks5Connections();
if (this.transport != null && this.transport instanceof JingleInbandTransport) {
this.transport.disconnect();
}
FileBackend.close(mFileInputStream);
FileBackend.close(mFileOutputStream);
if (this.message != null) {
if (this.responder.equals(account.getJid())) {
this.message.setTransferable(new TransferablePlaceholder(Transferable.STATUS_FAILED));
if (this.file!=null) {
file.delete();
}
this.mXmppConnectionService.updateConversationUi();
} else {
this.mXmppConnectionService.markMessage(this.message,
Message.STATUS_SEND_FAILED);
this.message.setTransferable(null);
}
}
this.mJingleConnectionManager.finishConnection(this);
}
示例4: markFileDeleted
import eu.siacs.conversations.entities.TransferablePlaceholder; //导入依赖的package包/类
private void markFileDeleted(final String path) {
Log.d(Config.LOGTAG, "deleted file " + path);
for (Conversation conversation : getConversations()) {
conversation.findMessagesWithFiles(new Conversation.OnMessageFound() {
@Override
public void onMessageFound(Message message) {
DownloadableFile file = fileBackend.getFile(message);
if (file.getAbsolutePath().equals(path)) {
if (!file.exists()) {
message.setTransferable(new TransferablePlaceholder(Transferable.STATUS_DELETED));
final int s = message.getStatus();
if (s == Message.STATUS_WAITING || s == Message.STATUS_OFFERED || s == Message.STATUS_UNSEND) {
markMessage(message, Message.STATUS_SEND_FAILED);
} else {
updateConversationUi();
}
} else {
Log.d(Config.LOGTAG, "found matching message for file " + path + " but file still exists");
}
}
}
});
}
}
示例5: cancel
import eu.siacs.conversations.entities.TransferablePlaceholder; //导入依赖的package包/类
public void cancel() {
this.disconnectSocks5Connections();
if (this.transport != null && this.transport instanceof JingleInbandTransport) {
this.transport.disconnect();
}
this.sendCancel();
this.mJingleConnectionManager.finishConnection(this);
if (responding()) {
this.message.setTransferable(new TransferablePlaceholder(Transferable.STATUS_FAILED));
if (this.file!=null) {
file.delete();
}
this.mJingleConnectionManager.updateConversationUi(true);
} else {
this.mXmppConnectionService.markMessage(this.message, Message.STATUS_SEND_FAILED);
this.message.setTransferable(null);
}
}
示例6: fail
import eu.siacs.conversations.entities.TransferablePlaceholder; //导入依赖的package包/类
private void fail(String errorMessage) {
this.mJingleStatus = JINGLE_STATUS_FAILED;
this.disconnectSocks5Connections();
if (this.transport != null && this.transport instanceof JingleInbandTransport) {
this.transport.disconnect();
}
FileBackend.close(mFileInputStream);
FileBackend.close(mFileOutputStream);
if (this.message != null) {
if (responding()) {
this.message.setTransferable(new TransferablePlaceholder(Transferable.STATUS_FAILED));
if (this.file!=null) {
file.delete();
}
this.mJingleConnectionManager.updateConversationUi(true);
} else {
this.mXmppConnectionService.markMessage(this.message,
Message.STATUS_SEND_FAILED,
errorMessage);
this.message.setTransferable(null);
}
}
this.mJingleConnectionManager.finishConnection(this);
}
示例7: cancel
import eu.siacs.conversations.entities.TransferablePlaceholder; //导入依赖的package包/类
@Override
public void cancel() {
this.canceled = true;
mHttpConnectionManager.finishConnection(this);
if (message.isFileOrImage()) {
message.setTransferable(new TransferablePlaceholder(Transferable.STATUS_DELETED));
} else {
message.setTransferable(null);
}
mXmppConnectionService.updateConversationUi();
}
示例8: checkDeletedFiles
import eu.siacs.conversations.entities.TransferablePlaceholder; //导入依赖的package包/类
private void checkDeletedFiles(Conversation conversation) {
conversation.findMessagesWithFiles(new Conversation.OnMessageFound() {
@Override
public void onMessageFound(Message message) {
if (!getFileBackend().isFileAvailable(message)) {
message.setTransferable(new TransferablePlaceholder(Transferable.STATUS_DELETED));
final int s = message.getStatus();
if (s == Message.STATUS_WAITING || s == Message.STATUS_OFFERED || s == Message.STATUS_UNSEND) {
markMessage(message, Message.STATUS_SEND_FAILED);
}
}
}
});
}
示例9: resendMessage
import eu.siacs.conversations.entities.TransferablePlaceholder; //导入依赖的package包/类
private void resendMessage(Message message) {
if (message.getType() == Message.TYPE_FILE || message.getType() == Message.TYPE_IMAGE) {
DownloadableFile file = activity.xmppConnectionService.getFileBackend().getFile(message);
if (!file.exists()) {
Toast.makeText(activity, R.string.file_deleted, Toast.LENGTH_SHORT).show();
message.setTransferable(new TransferablePlaceholder(Transferable.STATUS_DELETED));
return;
}
}
activity.xmppConnectionService.resendFailedMessages(message);
}
示例10: cancel
import eu.siacs.conversations.entities.TransferablePlaceholder; //导入依赖的package包/类
@Override
public void cancel() {
this.canceled = true;
mHttpConnectionManager.finishConnection(this);
if (message.isFileOrImage()) {
message.setTransferable(new TransferablePlaceholder(Transferable.STATUS_DELETED));
} else {
message.setTransferable(null);
}
mHttpConnectionManager.updateConversationUi(true);
}
示例11: deleteFile
import eu.siacs.conversations.entities.TransferablePlaceholder; //导入依赖的package包/类
private void deleteFile(Message message) {
if (activity.xmppConnectionService.getFileBackend().deleteFile(message)) {
message.setTransferable(new TransferablePlaceholder(Transferable.STATUS_DELETED));
activity.updateConversationList();
updateMessages();
}
}
示例12: resendMessage
import eu.siacs.conversations.entities.TransferablePlaceholder; //导入依赖的package包/类
private void resendMessage(final Message message) {
if (message.isFileOrImage()) {
DownloadableFile file = activity.xmppConnectionService.getFileBackend().getFile(message);
if (file.exists()) {
final Conversation conversation = message.getConversation();
final XmppConnection xmppConnection = conversation.getAccount().getXmppConnection();
if (!message.hasFileOnRemoteHost()
&& xmppConnection != null
&& !xmppConnection.getFeatures().httpUpload(message.getFileParams().size)) {
activity.selectPresence(conversation, new OnPresenceSelected() {
@Override
public void onPresenceSelected() {
message.setCounterpart(conversation.getNextCounterpart());
activity.xmppConnectionService.resendFailedMessages(message);
}
});
return;
}
} else {
Toast.makeText(activity, R.string.file_deleted, Toast.LENGTH_SHORT).show();
message.setTransferable(new TransferablePlaceholder(Transferable.STATUS_DELETED));
activity.updateConversationList();
updateMessages();
return;
}
}
activity.xmppConnectionService.resendFailedMessages(message);
}
示例13: populateContextMenu
import eu.siacs.conversations.entities.TransferablePlaceholder; //导入依赖的package包/类
private void populateContextMenu(ContextMenu menu) {
final Message m = this.selectedMessage;
if (m.getType() != Message.TYPE_STATUS) {
activity.getMenuInflater().inflate(R.menu.message_context, menu);
menu.setHeaderTitle(R.string.message_options);
MenuItem copyText = menu.findItem(R.id.copy_text);
MenuItem shareWith = menu.findItem(R.id.share_with);
MenuItem sendAgain = menu.findItem(R.id.send_again);
MenuItem copyUrl = menu.findItem(R.id.copy_url);
MenuItem downloadFile = menu.findItem(R.id.download_file);
MenuItem cancelTransmission = menu.findItem(R.id.cancel_transmission);
if ((m.getType() == Message.TYPE_TEXT || m.getType() == Message.TYPE_PRIVATE)
&& m.getTransferable() == null
&& !GeoHelper.isGeoUri(m.getBody())
&& m.treatAsDownloadable() != Message.Decision.MUST) {
copyText.setVisible(true);
}
if ((m.getType() != Message.TYPE_TEXT
&& m.getType() != Message.TYPE_PRIVATE
&& m.getTransferable() == null)
|| (GeoHelper.isGeoUri(m.getBody()))) {
shareWith.setVisible(true);
}
if (m.getStatus() == Message.STATUS_SEND_FAILED) {
sendAgain.setVisible(true);
}
if (m.hasFileOnRemoteHost()
|| GeoHelper.isGeoUri(m.getBody())
|| m.treatAsDownloadable() == Message.Decision.MUST) {
copyUrl.setVisible(true);
}
if ((m.getType() == Message.TYPE_TEXT && m.getTransferable() == null && m.treatAsDownloadable() != Message.Decision.NEVER)
|| (m.isFileOrImage() && m.getTransferable() instanceof TransferablePlaceholder && m.hasFileOnRemoteHost())){
downloadFile.setVisible(true);
downloadFile.setTitle(activity.getString(R.string.download_x_file,UIHelper.getFileDescriptionString(activity, m)));
}
if ((m.getTransferable() != null && !(m.getTransferable() instanceof TransferablePlaceholder))
|| (m.isFileOrImage() && (m.getStatus() == Message.STATUS_WAITING
|| m.getStatus() == Message.STATUS_OFFERED))) {
cancelTransmission.setVisible(true);
}
}
}
示例14: populateContextMenu
import eu.siacs.conversations.entities.TransferablePlaceholder; //导入依赖的package包/类
private void populateContextMenu(ContextMenu menu) {
final Message m = this.selectedMessage;
final Transferable t = m.getTransferable();
Message relevantForCorrection = m;
while (relevantForCorrection.mergeable(relevantForCorrection.next())) {
relevantForCorrection = relevantForCorrection.next();
}
if (m.getType() != Message.TYPE_STATUS) {
final boolean treatAsFile = m.getType() != Message.TYPE_TEXT
&& m.getType() != Message.TYPE_PRIVATE
&& t == null;
final boolean encrypted = m.getEncryption() == Message.ENCRYPTION_DECRYPTION_FAILED
|| m.getEncryption() == Message.ENCRYPTION_PGP;
activity.getMenuInflater().inflate(R.menu.message_context, menu);
menu.setHeaderTitle(R.string.message_options);
MenuItem copyMessage = menu.findItem(R.id.copy_message);
MenuItem quoteMessage = menu.findItem(R.id.quote_message);
MenuItem retryDecryption = menu.findItem(R.id.retry_decryption);
MenuItem correctMessage = menu.findItem(R.id.correct_message);
MenuItem shareWith = menu.findItem(R.id.share_with);
MenuItem sendAgain = menu.findItem(R.id.send_again);
MenuItem copyUrl = menu.findItem(R.id.copy_url);
MenuItem downloadFile = menu.findItem(R.id.download_file);
MenuItem cancelTransmission = menu.findItem(R.id.cancel_transmission);
MenuItem deleteFile = menu.findItem(R.id.delete_file);
MenuItem showErrorMessage = menu.findItem(R.id.show_error_message);
if (!treatAsFile && !encrypted && !m.isGeoUri() && !m.treatAsDownloadable()) {
copyMessage.setVisible(true);
quoteMessage.setVisible(MessageUtils.prepareQuote(m).length() > 0);
}
if (m.getEncryption() == Message.ENCRYPTION_DECRYPTION_FAILED) {
retryDecryption.setVisible(true);
}
if (relevantForCorrection.getType() == Message.TYPE_TEXT
&& relevantForCorrection.isLastCorrectableMessage()
&& (m.getConversation().getMucOptions().nonanonymous() || m.getConversation().getMode() == Conversation.MODE_SINGLE)) {
correctMessage.setVisible(true);
}
if (treatAsFile || (m.getType() == Message.TYPE_TEXT && !m.treatAsDownloadable())) {
shareWith.setVisible(true);
}
if (m.getStatus() == Message.STATUS_SEND_FAILED) {
sendAgain.setVisible(true);
}
if (m.hasFileOnRemoteHost()
|| m.isGeoUri()
|| m.treatAsDownloadable()
|| (t != null && t instanceof HttpDownloadConnection)) {
copyUrl.setVisible(true);
}
if ((m.isFileOrImage() && t instanceof TransferablePlaceholder && 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()) {
cancelTransmission.setVisible(true);
}
if (treatAsFile) {
String path = m.getRelativeFilePath();
if (path == null || !path.startsWith("/")) {
deleteFile.setVisible(true);
deleteFile.setTitle(activity.getString(R.string.delete_x_file, UIHelper.getFileDescriptionString(activity, m)));
}
}
if (m.getStatus() == Message.STATUS_SEND_FAILED && m.getErrorMessage() != null) {
showErrorMessage.setVisible(true);
}
}
}