added confirm dialog before contact and bookmark removal
This commit is contained in:
parent
ed4d0d38e3
commit
fc5143734e
|
@ -37,7 +37,8 @@
|
||||||
<string name="participant">Participant</string>
|
<string name="participant">Participant</string>
|
||||||
<string name="visitor">Visitor</string>
|
<string name="visitor">Visitor</string>
|
||||||
<string name="enter_new_name">Enter a new name:</string>
|
<string name="enter_new_name">Enter a new name:</string>
|
||||||
<string name="remove_contact_text">Do you want to delete %s from your roster? The conversation associated with this account will not be removed.</string>
|
<string name="remove_contact_text">Would you like to remove %s from your roster? The conversation associated with this contact will not be removed.</string>
|
||||||
|
<string name="remove_bookmark_text">Would you like to remove %s as a bookmark? The conversation associated with this bookmark will not be removed.</string>
|
||||||
<string name="untrusted_cert_hint">The server %s presented you with an untrusted, possible self signed, certificate.</string>
|
<string name="untrusted_cert_hint">The server %s presented you with an untrusted, possible self signed, certificate.</string>
|
||||||
<string name="account_info">Server Info</string>
|
<string name="account_info">Server Info</string>
|
||||||
<string name="register_account">Register new account on server</string>
|
<string name="register_account">Register new account on server</string>
|
||||||
|
|
|
@ -953,7 +953,6 @@ public class XmppConnectionService extends Service {
|
||||||
mDateFormat.format(date));
|
mDateFormat.format(date));
|
||||||
}
|
}
|
||||||
packet.addChild(x);
|
packet.addChild(x);
|
||||||
Log.d(LOGTAG,packet.toString());
|
|
||||||
sendPresencePacket(account, packet);
|
sendPresencePacket(account, packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,8 @@ import android.app.Fragment;
|
||||||
import android.app.FragmentTransaction;
|
import android.app.FragmentTransaction;
|
||||||
import android.app.ListFragment;
|
import android.app.ListFragment;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.DialogInterface.OnClickListener;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v13.app.FragmentPagerAdapter;
|
import android.support.v13.app.FragmentPagerAdapter;
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
|
@ -225,7 +227,9 @@ public class StartConversation extends XmppActivity {
|
||||||
.findOrCreateConversation(bookmark.getAccount(),
|
.findOrCreateConversation(bookmark.getAccount(),
|
||||||
bookmark.getJid(), true);
|
bookmark.getJid(), true);
|
||||||
conversation.setBookmark(bookmark);
|
conversation.setBookmark(bookmark);
|
||||||
xmppConnectionService.joinMuc(conversation);
|
if (!conversation.getMucOptions().online()) {
|
||||||
|
xmppConnectionService.joinMuc(conversation);
|
||||||
|
}
|
||||||
if (!bookmark.autojoin()) {
|
if (!bookmark.autojoin()) {
|
||||||
bookmark.setAutojoin(true);
|
bookmark.setAutojoin(true);
|
||||||
xmppConnectionService.pushBookmarks(bookmark.getAccount());
|
xmppConnectionService.pushBookmarks(bookmark.getAccount());
|
||||||
|
@ -241,18 +245,47 @@ public class StartConversation extends XmppActivity {
|
||||||
|
|
||||||
protected void deleteContact() {
|
protected void deleteContact() {
|
||||||
int position = contact_context_id;
|
int position = contact_context_id;
|
||||||
Contact contact = (Contact) contacts.get(position);
|
final Contact contact = (Contact) contacts.get(position);
|
||||||
xmppConnectionService.deleteContactOnServer(contact);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
filter(mSearchEditText.getText().toString());
|
builder.setNegativeButton(R.string.cancel, null);
|
||||||
|
builder.setTitle(R.string.action_delete_contact);
|
||||||
|
builder.setMessage(
|
||||||
|
getString(R.string.remove_contact_text,
|
||||||
|
contact.getJid()));
|
||||||
|
builder.setPositiveButton(R.string.delete,new OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
xmppConnectionService.deleteContactOnServer(contact);
|
||||||
|
filter(mSearchEditText.getText().toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
builder.create().show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void deleteConference() {
|
protected void deleteConference() {
|
||||||
int position = conference_context_id;
|
int position = conference_context_id;
|
||||||
Bookmark bookmark = (Bookmark) conferences.get(position);
|
final Bookmark bookmark = (Bookmark) conferences.get(position);
|
||||||
Account account = bookmark.getAccount();
|
|
||||||
account.getBookmarks().remove(bookmark);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
xmppConnectionService.pushBookmarks(account);
|
builder.setNegativeButton(R.string.cancel, null);
|
||||||
filter(mSearchEditText.getText().toString());
|
builder.setTitle(R.string.delete_bookmark);
|
||||||
|
builder.setMessage(
|
||||||
|
getString(R.string.remove_bookmark_text,
|
||||||
|
bookmark.getJid()));
|
||||||
|
builder.setPositiveButton(R.string.delete,new OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
Account account = bookmark.getAccount();
|
||||||
|
account.getBookmarks().remove(bookmark);
|
||||||
|
xmppConnectionService.pushBookmarks(account);
|
||||||
|
filter(mSearchEditText.getText().toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
builder.create().show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void showCreateContactDialog() {
|
protected void showCreateContactDialog() {
|
||||||
|
@ -342,13 +375,18 @@ public class StartConversation extends XmppActivity {
|
||||||
.findOrCreateConversation(account,
|
.findOrCreateConversation(account,
|
||||||
conferenceJid, true);
|
conferenceJid, true);
|
||||||
conversation.setBookmark(bookmark);
|
conversation.setBookmark(bookmark);
|
||||||
xmppConnectionService.joinMuc(conversation);
|
if (!conversation.getMucOptions().online()) {
|
||||||
|
xmppConnectionService.joinMuc(conversation);
|
||||||
|
}
|
||||||
switchToConversation(conversation);
|
switchToConversation(conversation);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Conversation conversation = xmppConnectionService
|
Conversation conversation = xmppConnectionService
|
||||||
.findOrCreateConversation(account,
|
.findOrCreateConversation(account,
|
||||||
conferenceJid, true);
|
conferenceJid, true);
|
||||||
|
if (!conversation.getMucOptions().online()) {
|
||||||
|
xmppConnectionService.joinMuc(conversation);
|
||||||
|
}
|
||||||
switchToConversation(conversation);
|
switchToConversation(conversation);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue