use of eu.siacs.conversations.entities.Blockable in project Conversations by siacs.
the class ConversationFragment method showBlockSubmenu.
private boolean showBlockSubmenu(View view) {
final Jid jid = conversation.getJid();
final boolean showReject = !conversation.isWithStranger() && conversation.getContact().getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST);
PopupMenu popupMenu = new PopupMenu(getActivity(), view);
popupMenu.inflate(R.menu.block);
popupMenu.getMenu().findItem(R.id.block_contact).setVisible(jid.getLocal() != null);
popupMenu.getMenu().findItem(R.id.reject).setVisible(showReject);
popupMenu.setOnMenuItemClickListener(menuItem -> {
Blockable blockable;
switch(menuItem.getItemId()) {
case R.id.reject:
activity.xmppConnectionService.stopPresenceUpdatesTo(conversation.getContact());
updateSnackBar(conversation);
return true;
case R.id.block_domain:
blockable = conversation.getAccount().getRoster().getContact(jid.getDomain());
break;
default:
blockable = conversation;
}
BlockContactDialog.show(activity, blockable);
return true;
});
popupMenu.show();
return true;
}
use of eu.siacs.conversations.entities.Blockable in project Conversations by siacs.
the class BlocklistActivity method showEnterJidDialog.
protected void showEnterJidDialog() {
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
Fragment prev = getSupportFragmentManager().findFragmentByTag("dialog");
if (prev != null) {
ft.remove(prev);
}
ft.addToBackStack(null);
EnterJidDialog dialog = EnterJidDialog.newInstance(null, getString(R.string.block_jabber_id), getString(R.string.block), null, account.getJid().asBareJid().toEscapedString(), true, false);
dialog.setOnEnterJidDialogPositiveListener((accountJid, contactJid) -> {
Blockable blockable = new RawBlockable(account, contactJid);
if (xmppConnectionService.sendBlockRequest(blockable, false)) {
Toast.makeText(BlocklistActivity.this, R.string.corresponding_conversations_closed, Toast.LENGTH_SHORT).show();
}
return true;
});
dialog.show(ft, "dialog");
}
Aggregations