本文整理汇总了Java中eu.siacs.conversations.utils.GeoHelper类的典型用法代码示例。如果您正苦于以下问题:Java GeoHelper类的具体用法?Java GeoHelper怎么用?Java GeoHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GeoHelper类属于eu.siacs.conversations.utils包,在下文中一共展示了GeoHelper类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mergeable
import eu.siacs.conversations.utils.GeoHelper; //导入依赖的package包/类
public boolean mergeable(final Message message) {
return message != null &&
(message.getType() == Message.TYPE_TEXT &&
this.getTransferable() == null &&
message.getTransferable() == null &&
message.getEncryption() != Message.ENCRYPTION_PGP &&
this.getType() == message.getType() &&
//this.getStatus() == message.getStatus() &&
isStatusMergeable(this.getStatus(), message.getStatus()) &&
this.getEncryption() == message.getEncryption() &&
this.getCounterpart() != null &&
this.getCounterpart().equals(message.getCounterpart()) &&
(message.getTimeSent() - this.getTimeSent()) <= (Config.MESSAGE_MERGE_WINDOW * 1000) &&
!GeoHelper.isGeoUri(message.getBody()) &&
!GeoHelper.isGeoUri(this.body) &&
message.treatAsDownloadable() == Decision.NEVER &&
this.treatAsDownloadable() == Decision.NEVER &&
!message.getBody().startsWith(ME_COMMAND) &&
!this.getBody().startsWith(ME_COMMAND) &&
!this.bodyIsHeart() &&
!message.bodyIsHeart() &&
this.isTrusted() == message.isTrusted()
);
}
示例2: shareWith
import eu.siacs.conversations.utils.GeoHelper; //导入依赖的package包/类
private void shareWith(Message message) {
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
if (GeoHelper.isGeoUri(message.getBody())) {
shareIntent.putExtra(Intent.EXTRA_TEXT, message.getBody());
shareIntent.setType("text/plain");
} else {
shareIntent.putExtra(Intent.EXTRA_STREAM,
activity.xmppConnectionService.getFileBackend()
.getJingleFileUri(message));
shareIntent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
String mime = message.getMimeType();
if (mime == null) {
mime = "*/*";
}
shareIntent.setType(mime);
}
try {
activity.startActivity(Intent.createChooser(shareIntent, getText(R.string.share_with)));
} catch (ActivityNotFoundException e) {
//This should happen only on faulty androids because normally chooser is always available
Toast.makeText(activity,R.string.no_application_found_to_open_file,Toast.LENGTH_SHORT).show();
}
}
示例3: copyUrl
import eu.siacs.conversations.utils.GeoHelper; //导入依赖的package包/类
private void copyUrl(Message message) {
final String url;
final int resId;
if (GeoHelper.isGeoUri(message.getBody())) {
resId = R.string.location;
url = message.getBody();
} else if (message.hasFileOnRemoteHost()) {
resId = R.string.file_url;
url = message.getFileParams().url.toString();
} else {
url = message.getBody().trim();
resId = R.string.file_url;
}
if (activity.copyTextToClipboard(url, resId)) {
Toast.makeText(activity, R.string.url_copied_to_clipboard,
Toast.LENGTH_SHORT).show();
}
}
示例4: getFirstLocationMessage
import eu.siacs.conversations.utils.GeoHelper; //导入依赖的package包/类
private Message getFirstLocationMessage(final Iterable<Message> messages) {
for (final Message message : messages) {
if (GeoHelper.isGeoUri(message.getBody())) {
return message;
}
}
return null;
}
示例5: createShowLocationIntent
import eu.siacs.conversations.utils.GeoHelper; //导入依赖的package包/类
private PendingIntent createShowLocationIntent(final Message message) {
Iterable<Intent> intents = GeoHelper.createGeoIntentsFromMessage(message);
for (Intent intent : intents) {
if (intent.resolveActivity(mXmppConnectionService.getPackageManager()) != null) {
return PendingIntent.getActivity(mXmppConnectionService, 18, intent, PendingIntent.FLAG_UPDATE_CURRENT);
}
}
return createOpenConversationsIntent();
}
示例6: showLocation
import eu.siacs.conversations.utils.GeoHelper; //导入依赖的package包/类
public void showLocation(Message message) {
for(Intent intent : GeoHelper.createGeoIntentsFromMessage(message)) {
if (intent.resolveActivity(getContext().getPackageManager()) != null) {
getContext().startActivity(intent);
return;
}
}
Toast.makeText(activity,R.string.no_application_found_to_display_location,Toast.LENGTH_SHORT).show();
}
示例7: createShowLocationIntent
import eu.siacs.conversations.utils.GeoHelper; //导入依赖的package包/类
private PendingIntent createShowLocationIntent(final Message message) {
Iterable<Intent> intents = GeoHelper.createGeoIntentsFromMessage(message);
for (Intent intent : intents) {
if (intent.resolveActivity(mXmppConnectionService.getPackageManager()) != null) {
return PendingIntent.getActivity(mXmppConnectionService, generateRequestCode(message.getConversation(), 18), intent, PendingIntent.FLAG_UPDATE_CURRENT);
}
}
return createOpenConversationsIntent();
}
示例8: populateContextMenu
import eu.siacs.conversations.utils.GeoHelper; //导入依赖的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);
}
}
}
示例9: isGeoUri
import eu.siacs.conversations.utils.GeoHelper; //导入依赖的package包/类
public synchronized boolean isGeoUri() {
if (isGeoUri == null) {
isGeoUri = GeoHelper.GEO_URI.matcher(body).matches();
}
return isGeoUri;
}