2014-03-05 14:41:14 +00:00
|
|
|
package eu.siacs.conversations.ui;
|
|
|
|
|
2014-03-06 19:00:46 +00:00
|
|
|
import java.util.Iterator;
|
|
|
|
|
2014-05-09 18:47:03 +00:00
|
|
|
import org.openintents.openpgp.util.OpenPgpUtils;
|
|
|
|
|
2014-03-05 14:41:14 +00:00
|
|
|
import android.app.AlertDialog;
|
2014-05-09 18:47:03 +00:00
|
|
|
import android.app.PendingIntent;
|
2014-03-06 19:00:46 +00:00
|
|
|
import android.content.Context;
|
2014-03-05 14:41:14 +00:00
|
|
|
import android.content.DialogInterface;
|
|
|
|
import android.content.Intent;
|
2014-05-09 18:47:03 +00:00
|
|
|
import android.content.IntentSender.SendIntentException;
|
2014-03-05 14:41:14 +00:00
|
|
|
import android.net.Uri;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.provider.ContactsContract.CommonDataKinds;
|
|
|
|
import android.provider.ContactsContract.Contacts;
|
|
|
|
import android.provider.ContactsContract.Intents;
|
2014-03-06 19:00:46 +00:00
|
|
|
import android.view.LayoutInflater;
|
2014-03-05 14:41:14 +00:00
|
|
|
import android.view.Menu;
|
|
|
|
import android.view.MenuItem;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.View.OnClickListener;
|
|
|
|
import android.widget.CheckBox;
|
|
|
|
import android.widget.EditText;
|
2014-03-06 19:00:46 +00:00
|
|
|
import android.widget.LinearLayout;
|
2014-03-05 14:41:14 +00:00
|
|
|
import android.widget.QuickContactBadge;
|
|
|
|
import android.widget.TextView;
|
2014-03-07 19:36:04 +00:00
|
|
|
import android.widget.Toast;
|
2014-03-05 14:41:14 +00:00
|
|
|
import eu.siacs.conversations.R;
|
2014-05-09 18:47:03 +00:00
|
|
|
import eu.siacs.conversations.crypto.PgpEngine;
|
2014-05-19 13:15:09 +00:00
|
|
|
import eu.siacs.conversations.entities.Account;
|
2014-03-05 14:41:14 +00:00
|
|
|
import eu.siacs.conversations.entities.Contact;
|
|
|
|
import eu.siacs.conversations.entities.Presences;
|
2014-07-12 01:44:23 +00:00
|
|
|
import eu.siacs.conversations.services.XmppConnectionService;
|
2014-03-05 14:41:14 +00:00
|
|
|
import eu.siacs.conversations.utils.UIHelper;
|
2014-07-12 01:44:23 +00:00
|
|
|
import eu.siacs.conversations.xmpp.stanzas.PresencePacket;
|
2014-03-05 14:41:14 +00:00
|
|
|
|
|
|
|
public class ContactDetailsActivity extends XmppActivity {
|
|
|
|
public static final String ACTION_VIEW_CONTACT = "view_contact";
|
|
|
|
|
|
|
|
protected ContactDetailsActivity activity = this;
|
|
|
|
|
|
|
|
private Contact contact;
|
2014-05-19 13:15:09 +00:00
|
|
|
|
|
|
|
private String accountJid;
|
|
|
|
private String contactJid;
|
|
|
|
|
2014-03-05 14:41:14 +00:00
|
|
|
private EditText name;
|
2014-05-19 13:15:09 +00:00
|
|
|
private TextView contactJidTv;
|
|
|
|
private TextView accountJidTv;
|
2014-03-05 14:41:14 +00:00
|
|
|
private TextView status;
|
2014-06-13 09:50:47 +00:00
|
|
|
private TextView lastseen;
|
2014-03-05 14:41:14 +00:00
|
|
|
private CheckBox send;
|
|
|
|
private CheckBox receive;
|
|
|
|
private QuickContactBadge badge;
|
|
|
|
|
|
|
|
private DialogInterface.OnClickListener removeFromRoster = new DialogInterface.OnClickListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
2014-05-19 13:15:09 +00:00
|
|
|
activity.xmppConnectionService.deleteContactOnServer(contact);
|
2014-03-05 14:41:14 +00:00
|
|
|
activity.finish();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
private DialogInterface.OnClickListener editContactNameListener = new DialogInterface.OnClickListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
2014-05-19 13:15:09 +00:00
|
|
|
contact.setServerName(name.getText().toString());
|
|
|
|
activity.xmppConnectionService.pushContactToServer(contact);
|
2014-03-05 14:41:14 +00:00
|
|
|
populateView();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
private DialogInterface.OnClickListener addToPhonebook = new DialogInterface.OnClickListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
|
|
|
|
intent.setType(Contacts.CONTENT_ITEM_TYPE);
|
|
|
|
intent.putExtra(Intents.Insert.IM_HANDLE, contact.getJid());
|
|
|
|
intent.putExtra(Intents.Insert.IM_PROTOCOL,
|
|
|
|
CommonDataKinds.Im.PROTOCOL_JABBER);
|
|
|
|
intent.putExtra("finishActivityOnSaveCompleted", true);
|
|
|
|
activity.startActivityForResult(intent, 0);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
private OnClickListener onBadgeClick = new OnClickListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
2014-05-22 20:58:25 +00:00
|
|
|
builder.setTitle(getString(R.string.action_add_phone_book));
|
|
|
|
builder.setMessage(getString(R.string.add_phone_book_text, contact.getJid()));
|
|
|
|
builder.setNegativeButton(getString(R.string.cancel), null);
|
|
|
|
builder.setPositiveButton(getString(R.string.add), addToPhonebook);
|
2014-03-05 14:41:14 +00:00
|
|
|
builder.create().show();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-06 19:00:46 +00:00
|
|
|
private LinearLayout keys;
|
|
|
|
|
2014-03-05 14:41:14 +00:00
|
|
|
@Override
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
if (getIntent().getAction().equals(ACTION_VIEW_CONTACT)) {
|
2014-05-19 13:15:09 +00:00
|
|
|
this.accountJid = getIntent().getExtras().getString("account");
|
|
|
|
this.contactJid = getIntent().getExtras().getString("contact");
|
2014-03-05 14:41:14 +00:00
|
|
|
}
|
|
|
|
setContentView(R.layout.activity_contact_details);
|
|
|
|
|
2014-05-19 13:15:09 +00:00
|
|
|
contactJidTv = (TextView) findViewById(R.id.details_contactjid);
|
|
|
|
accountJidTv = (TextView) findViewById(R.id.details_account);
|
2014-03-05 14:41:14 +00:00
|
|
|
status = (TextView) findViewById(R.id.details_contactstatus);
|
2014-06-13 09:50:47 +00:00
|
|
|
lastseen = (TextView) findViewById(R.id.details_lastseen);
|
2014-03-05 14:41:14 +00:00
|
|
|
send = (CheckBox) findViewById(R.id.details_send_presence);
|
|
|
|
receive = (CheckBox) findViewById(R.id.details_receive_presence);
|
|
|
|
badge = (QuickContactBadge) findViewById(R.id.details_contact_badge);
|
2014-03-06 19:00:46 +00:00
|
|
|
keys = (LinearLayout) findViewById(R.id.details_contact_keys);
|
2014-03-05 14:41:14 +00:00
|
|
|
getActionBar().setHomeButtonEnabled(true);
|
|
|
|
getActionBar().setDisplayHomeAsUpEnabled(true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onOptionsItemSelected(MenuItem menuItem) {
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
2014-05-22 20:58:25 +00:00
|
|
|
builder.setNegativeButton(getString(R.string.cancel), null);
|
2014-03-05 14:41:14 +00:00
|
|
|
switch (menuItem.getItemId()) {
|
|
|
|
case android.R.id.home:
|
|
|
|
finish();
|
|
|
|
break;
|
|
|
|
case R.id.action_delete_contact:
|
2014-05-22 20:58:25 +00:00
|
|
|
builder.setTitle(getString(R.string.action_delete_contact))
|
2014-03-07 19:36:04 +00:00
|
|
|
.setMessage(
|
|
|
|
getString(R.string.remove_contact_text,
|
|
|
|
contact.getJid()))
|
2014-05-22 20:58:25 +00:00
|
|
|
.setPositiveButton(getString(R.string.delete), removeFromRoster).create()
|
2014-03-05 14:41:14 +00:00
|
|
|
.show();
|
|
|
|
break;
|
|
|
|
case R.id.action_edit_contact:
|
|
|
|
if (contact.getSystemAccount() == null) {
|
2014-03-07 19:36:04 +00:00
|
|
|
|
|
|
|
View view = (View) getLayoutInflater().inflate(
|
|
|
|
R.layout.edit_contact_name, null);
|
2014-03-05 14:41:14 +00:00
|
|
|
name = (EditText) view.findViewById(R.id.editText1);
|
|
|
|
name.setText(contact.getDisplayName());
|
2014-03-07 19:36:04 +00:00
|
|
|
builder.setView(view).setTitle(contact.getJid())
|
2014-05-22 20:58:25 +00:00
|
|
|
.setPositiveButton(getString(R.string.edit), editContactNameListener)
|
2014-03-05 14:41:14 +00:00
|
|
|
.create().show();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
Intent intent = new Intent(Intent.ACTION_EDIT);
|
|
|
|
String[] systemAccount = contact.getSystemAccount().split("#");
|
|
|
|
long id = Long.parseLong(systemAccount[0]);
|
|
|
|
Uri uri = Contacts.getLookupUri(id, systemAccount[1]);
|
2014-03-07 19:36:04 +00:00
|
|
|
intent.setDataAndType(uri, Contacts.CONTENT_ITEM_TYPE);
|
2014-03-05 14:41:14 +00:00
|
|
|
intent.putExtra("finishActivityOnSaveCompleted", true);
|
2014-03-07 19:36:04 +00:00
|
|
|
startActivity(intent);
|
2014-03-05 14:41:14 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return super.onOptionsItemSelected(menuItem);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onCreateOptionsMenu(Menu menu) {
|
|
|
|
getMenuInflater().inflate(R.menu.contact_details, menu);
|
|
|
|
return true;
|
|
|
|
}
|
2014-03-07 19:36:04 +00:00
|
|
|
|
2014-03-05 14:41:14 +00:00
|
|
|
private void populateView() {
|
|
|
|
setTitle(contact.getDisplayName());
|
2014-05-19 13:15:09 +00:00
|
|
|
if (contact.getOption(Contact.Options.FROM)) {
|
2014-03-05 14:41:14 +00:00
|
|
|
send.setChecked(true);
|
2014-07-11 11:52:27 +00:00
|
|
|
} else if (contact.getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)){
|
|
|
|
send.setChecked(false);
|
2014-03-05 14:41:14 +00:00
|
|
|
} else {
|
2014-05-13 09:23:11 +00:00
|
|
|
send.setText(R.string.preemptively_grant);
|
2014-03-05 14:41:14 +00:00
|
|
|
if (contact
|
2014-05-19 13:15:09 +00:00
|
|
|
.getOption(Contact.Options.PREEMPTIVE_GRANT)) {
|
2014-03-05 14:41:14 +00:00
|
|
|
send.setChecked(true);
|
|
|
|
} else {
|
|
|
|
send.setChecked(false);
|
|
|
|
}
|
|
|
|
}
|
2014-05-19 13:15:09 +00:00
|
|
|
if (contact.getOption(Contact.Options.TO)) {
|
2014-03-05 14:41:14 +00:00
|
|
|
receive.setChecked(true);
|
|
|
|
} else {
|
2014-05-13 09:23:11 +00:00
|
|
|
receive.setText(R.string.ask_for_presence_updates);
|
2014-05-19 13:15:09 +00:00
|
|
|
if (contact.getOption(Contact.Options.ASKING)) {
|
2014-03-05 14:41:14 +00:00
|
|
|
receive.setChecked(true);
|
|
|
|
} else {
|
|
|
|
receive.setChecked(false);
|
|
|
|
}
|
|
|
|
}
|
2014-06-13 09:50:47 +00:00
|
|
|
|
|
|
|
lastseen.setText(UIHelper.lastseen(getApplicationContext(),contact.lastseen.time));
|
2014-03-05 14:41:14 +00:00
|
|
|
|
|
|
|
switch (contact.getMostAvailableStatus()) {
|
|
|
|
case Presences.CHAT:
|
2014-05-22 20:58:25 +00:00
|
|
|
status.setText(R.string.contact_status_free_to_chat);
|
2014-03-05 14:41:14 +00:00
|
|
|
status.setTextColor(0xFF83b600);
|
|
|
|
break;
|
|
|
|
case Presences.ONLINE:
|
2014-05-22 20:58:25 +00:00
|
|
|
status.setText(R.string.contact_status_online);
|
2014-03-05 14:41:14 +00:00
|
|
|
status.setTextColor(0xFF83b600);
|
|
|
|
break;
|
|
|
|
case Presences.AWAY:
|
2014-05-22 20:58:25 +00:00
|
|
|
status.setText(R.string.contact_status_away);
|
2014-03-05 14:41:14 +00:00
|
|
|
status.setTextColor(0xFFffa713);
|
|
|
|
break;
|
|
|
|
case Presences.XA:
|
2014-05-22 20:58:25 +00:00
|
|
|
status.setText(R.string.contact_status_extended_away);
|
2014-03-05 14:41:14 +00:00
|
|
|
status.setTextColor(0xFFffa713);
|
|
|
|
break;
|
|
|
|
case Presences.DND:
|
2014-05-22 20:58:25 +00:00
|
|
|
status.setText(R.string.contact_status_do_not_disturb);
|
2014-03-05 14:41:14 +00:00
|
|
|
status.setTextColor(0xFFe92727);
|
|
|
|
break;
|
|
|
|
case Presences.OFFLINE:
|
2014-05-22 20:58:25 +00:00
|
|
|
status.setText(R.string.contact_status_offline);
|
2014-03-05 14:41:14 +00:00
|
|
|
status.setTextColor(0xFFe92727);
|
|
|
|
break;
|
|
|
|
default:
|
2014-05-22 20:58:25 +00:00
|
|
|
status.setText(R.string.contact_status_offline);
|
2014-03-05 14:41:14 +00:00
|
|
|
status.setTextColor(0xFFe92727);
|
|
|
|
break;
|
|
|
|
}
|
2014-04-16 17:14:20 +00:00
|
|
|
if (contact.getPresences().size() > 1) {
|
2014-05-19 13:15:09 +00:00
|
|
|
contactJidTv.setText(contact.getJid()+" ("+contact.getPresences().size()+")");
|
2014-04-16 17:14:20 +00:00
|
|
|
} else {
|
2014-05-19 13:15:09 +00:00
|
|
|
contactJidTv.setText(contact.getJid());
|
2014-04-16 17:14:20 +00:00
|
|
|
}
|
2014-05-19 13:15:09 +00:00
|
|
|
accountJidTv.setText(contact.getAccount().getJid());
|
2014-03-05 14:41:14 +00:00
|
|
|
|
2014-04-11 20:30:50 +00:00
|
|
|
UIHelper.prepareContactBadge(this, badge, contact, getApplicationContext());
|
2014-03-05 14:41:14 +00:00
|
|
|
|
|
|
|
if (contact.getSystemAccount() == null) {
|
|
|
|
badge.setOnClickListener(onBadgeClick);
|
|
|
|
}
|
2014-03-07 19:36:04 +00:00
|
|
|
|
2014-03-06 19:00:46 +00:00
|
|
|
keys.removeAllViews();
|
|
|
|
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
2014-03-07 19:36:04 +00:00
|
|
|
for (Iterator<String> iterator = contact.getOtrFingerprints()
|
|
|
|
.iterator(); iterator.hasNext();) {
|
2014-03-06 19:00:46 +00:00
|
|
|
String otrFingerprint = iterator.next();
|
|
|
|
View view = (View) inflater.inflate(R.layout.contact_key, null);
|
|
|
|
TextView key = (TextView) view.findViewById(R.id.key);
|
2014-03-07 19:36:04 +00:00
|
|
|
TextView keyType = (TextView) view.findViewById(R.id.key_type);
|
2014-03-06 19:00:46 +00:00
|
|
|
keyType.setText("OTR Fingerprint");
|
|
|
|
key.setText(otrFingerprint);
|
|
|
|
keys.addView(view);
|
|
|
|
}
|
2014-03-07 19:36:04 +00:00
|
|
|
if (contact.getPgpKeyId() != 0) {
|
2014-03-06 19:00:46 +00:00
|
|
|
View view = (View) inflater.inflate(R.layout.contact_key, null);
|
|
|
|
TextView key = (TextView) view.findViewById(R.id.key);
|
2014-03-07 19:36:04 +00:00
|
|
|
TextView keyType = (TextView) view.findViewById(R.id.key_type);
|
2014-03-06 19:00:46 +00:00
|
|
|
keyType.setText("PGP Key ID");
|
2014-05-09 18:47:03 +00:00
|
|
|
key.setText(OpenPgpUtils.convertKeyIdToHex(contact.getPgpKeyId()));
|
|
|
|
view.setOnClickListener(new OnClickListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
PgpEngine pgp = activity.xmppConnectionService.getPgpEngine();
|
|
|
|
if (pgp!=null) {
|
|
|
|
PendingIntent intent = pgp.getIntentForKey(contact);
|
|
|
|
if (intent!=null) {
|
|
|
|
try {
|
|
|
|
startIntentSenderForResult(intent.getIntentSender(), 0, null, 0, 0, 0);
|
|
|
|
} catch (SendIntentException e) {
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2014-03-06 19:00:46 +00:00
|
|
|
keys.addView(view);
|
|
|
|
}
|
2014-03-05 14:41:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onBackendConnected() {
|
2014-05-19 13:15:09 +00:00
|
|
|
if ((accountJid != null)&&(contactJid != null)) {
|
|
|
|
Account account = xmppConnectionService.findAccountByJid(accountJid);
|
|
|
|
if (account==null) {
|
|
|
|
return;
|
2014-03-05 14:41:14 +00:00
|
|
|
}
|
2014-05-19 13:15:09 +00:00
|
|
|
this.contact = account.getRoster().getContact(contactJid);
|
|
|
|
populateView();
|
2014-03-05 14:41:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-07 19:36:04 +00:00
|
|
|
@Override
|
|
|
|
protected void onStop() {
|
|
|
|
super.onStop();
|
2014-07-12 01:44:23 +00:00
|
|
|
XmppConnectionService xcs = activity.xmppConnectionService;
|
|
|
|
PresencePacket packet = null;
|
2014-05-19 13:15:09 +00:00
|
|
|
boolean updated = false;
|
2014-06-25 15:32:58 +00:00
|
|
|
if (contact!=null) {
|
|
|
|
boolean online = contact.getAccount().getStatus() == Account.STATUS_ONLINE;
|
|
|
|
if (contact.getOption(Contact.Options.FROM)) {
|
2014-03-07 19:36:04 +00:00
|
|
|
if (!send.isChecked()) {
|
2014-05-24 09:17:55 +00:00
|
|
|
if (online) {
|
2014-06-25 15:32:58 +00:00
|
|
|
contact.resetOption(Contact.Options.FROM);
|
2014-05-24 09:17:55 +00:00
|
|
|
contact.resetOption(Contact.Options.PREEMPTIVE_GRANT);
|
2014-07-12 01:44:23 +00:00
|
|
|
packet = xcs.getPresenceGenerator().stopPresenceUpdatesTo(contact);
|
2014-05-24 09:17:55 +00:00
|
|
|
}
|
2014-05-19 13:15:09 +00:00
|
|
|
updated = true;
|
2014-03-07 19:36:04 +00:00
|
|
|
}
|
|
|
|
} else {
|
2014-07-11 11:52:27 +00:00
|
|
|
if (contact.getOption(Contact.Options.PREEMPTIVE_GRANT)) {
|
2014-06-25 15:32:58 +00:00
|
|
|
if (!send.isChecked()) {
|
|
|
|
if (online) {
|
|
|
|
contact.resetOption(Contact.Options.PREEMPTIVE_GRANT);
|
|
|
|
}
|
|
|
|
updated = true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (send.isChecked()) {
|
|
|
|
if (online) {
|
2014-07-11 11:52:27 +00:00
|
|
|
if (contact.getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)) {
|
2014-07-12 01:44:23 +00:00
|
|
|
packet = xcs.getPresenceGenerator().sendPresenceUpdatesTo(contact);
|
2014-07-11 11:52:27 +00:00
|
|
|
} else {
|
|
|
|
contact.setOption(Contact.Options.PREEMPTIVE_GRANT);
|
|
|
|
}
|
2014-06-25 15:32:58 +00:00
|
|
|
}
|
|
|
|
updated = true;
|
2014-05-24 09:17:55 +00:00
|
|
|
}
|
|
|
|
}
|
2014-03-07 19:36:04 +00:00
|
|
|
}
|
2014-06-25 15:32:58 +00:00
|
|
|
if (contact.getOption(Contact.Options.TO)) {
|
2014-03-07 19:36:04 +00:00
|
|
|
if (!receive.isChecked()) {
|
2014-05-24 09:17:55 +00:00
|
|
|
if (online) {
|
2014-06-25 15:32:58 +00:00
|
|
|
contact.resetOption(Contact.Options.TO);
|
2014-07-12 01:44:23 +00:00
|
|
|
packet = xcs.getPresenceGenerator().stopPresenceUpdatesFrom(contact);
|
2014-05-24 09:17:55 +00:00
|
|
|
}
|
2014-05-19 13:15:09 +00:00
|
|
|
updated = true;
|
2014-03-07 19:36:04 +00:00
|
|
|
}
|
|
|
|
} else {
|
2014-06-25 15:32:58 +00:00
|
|
|
if (contact.getOption(Contact.Options.ASKING)) {
|
|
|
|
if (!receive.isChecked()) {
|
|
|
|
if (online) {
|
|
|
|
contact.resetOption(Contact.Options.ASKING);
|
2014-07-12 01:44:23 +00:00
|
|
|
packet = xcs.getPresenceGenerator().stopPresenceUpdatesFrom(contact);
|
2014-06-25 15:32:58 +00:00
|
|
|
}
|
|
|
|
updated = true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (receive.isChecked()) {
|
|
|
|
if (online) {
|
|
|
|
contact.setOption(Contact.Options.ASKING);
|
2014-07-12 01:44:23 +00:00
|
|
|
packet = xcs.getPresenceGenerator().requestPresenceUpdatesFrom(contact);
|
2014-06-25 15:32:58 +00:00
|
|
|
}
|
|
|
|
updated = true;
|
2014-05-24 09:17:55 +00:00
|
|
|
}
|
2014-03-07 19:36:04 +00:00
|
|
|
}
|
|
|
|
}
|
2014-06-25 15:32:58 +00:00
|
|
|
if (updated) {
|
|
|
|
if (online) {
|
2014-07-12 01:44:23 +00:00
|
|
|
if (packet!=null) {
|
|
|
|
xcs.sendPresencePacket(contact.getAccount(), packet);
|
|
|
|
}
|
2014-06-25 15:32:58 +00:00
|
|
|
Toast.makeText(getApplicationContext(), getString(R.string.subscription_updated), Toast.LENGTH_SHORT).show();
|
|
|
|
} else {
|
|
|
|
Toast.makeText(getApplicationContext(), getString(R.string.subscription_not_updated_offline), Toast.LENGTH_SHORT).show();
|
|
|
|
}
|
2014-05-24 09:17:55 +00:00
|
|
|
}
|
2014-03-07 19:36:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-05 14:41:14 +00:00
|
|
|
}
|