Search in sources :

Example 1 with Blockable

use of de.pixart.messenger.entities.Blockable in project Pix-Art-Messenger by kriztan.

the class ConversationFragment method showBlockSubmenu.

private boolean showBlockSubmenu(View view) {
    final Jid jid = conversation.getJid();
    if (jid.isDomainJid()) {
        BlockContactDialog.show(activity, conversation);
    } else {
        PopupMenu popupMenu = new PopupMenu(getActivity(), view);
        popupMenu.inflate(R.menu.block);
        popupMenu.setOnMenuItemClickListener(menuItem -> {
            Blockable blockable;
            switch(menuItem.getItemId()) {
                case R.id.block_domain:
                    blockable = conversation.getAccount().getRoster().getContact(jid.toDomainJid());
                    break;
                default:
                    blockable = conversation;
            }
            BlockContactDialog.show(activity, blockable);
            return true;
        });
        popupMenu.show();
    }
    return true;
}
Also used : Jid(de.pixart.messenger.xmpp.jid.Jid) PopupMenu(android.widget.PopupMenu) Blockable(de.pixart.messenger.entities.Blockable)

Aggregations

PopupMenu (android.widget.PopupMenu)1 Blockable (de.pixart.messenger.entities.Blockable)1 Jid (de.pixart.messenger.xmpp.jid.Jid)1