Search in sources :

Example 1 with ContactActivity

use of com.xabber.android.ui.activity.ContactActivity in project xabber-android by redsolution.

the class ContactDeleteDialogFragment method onClick.

@Override
public void onClick(DialogInterface dialog, int which) {
    if (which == Dialog.BUTTON_POSITIVE) {
        MessageManager.getInstance().closeChat(account, user);
        try {
            // discard subscription
            PresenceManager.getInstance().discardSubscription(account, user);
        } catch (NetworkException e) {
            Application.getInstance().onError(R.string.CONNECTION_FAILED);
        }
        // delete chat
        AbstractChat chat = MessageManager.getInstance().getChat(account, user);
        if (chat != null)
            MessageManager.getInstance().removeChat(chat);
        // remove roster contact
        RosterManager.getInstance().removeContact(account, user);
        if (getActivity() instanceof ContactActivity) {
            startActivity(ContactListActivity.createIntent(getActivity()));
        }
    }
}
Also used : ContactActivity(com.xabber.android.ui.activity.ContactActivity) AbstractChat(com.xabber.android.data.message.AbstractChat) NetworkException(com.xabber.android.data.NetworkException)

Aggregations

NetworkException (com.xabber.android.data.NetworkException)1 AbstractChat (com.xabber.android.data.message.AbstractChat)1 ContactActivity (com.xabber.android.ui.activity.ContactActivity)1