use of eu.siacs.conversations.entities.RawBlockable in project Conversations by siacs.
the class AvatarService method get.
public Bitmap get(ListItem item, int size, boolean cachedOnly) {
if (item instanceof RawBlockable) {
return get(item.getDisplayName(), item.getJid().toEscapedString(), size, cachedOnly);
} else if (item instanceof Contact) {
return get((Contact) item, size, cachedOnly);
} else if (item instanceof Bookmark) {
Bookmark bookmark = (Bookmark) item;
if (bookmark.getConversation() != null) {
return get(bookmark.getConversation(), size, cachedOnly);
} else {
Jid jid = bookmark.getJid();
Account account = bookmark.getAccount();
Contact contact = jid == null ? null : account.getRoster().getContact(jid);
if (contact != null && contact.getAvatarFilename() != null) {
return get(contact, size, cachedOnly);
}
String seed = jid != null ? jid.asBareJid().toString() : null;
return get(bookmark.getDisplayName(), seed, size, cachedOnly);
}
} else {
String seed = item.getJid() != null ? item.getJid().asBareJid().toString() : null;
return get(item.getDisplayName(), seed, size, cachedOnly);
}
}
use of eu.siacs.conversations.entities.RawBlockable 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");
}
use of eu.siacs.conversations.entities.RawBlockable in project Conversations by siacs.
the class BlocklistActivity method filterContacts.
@Override
protected void filterContacts(final String needle) {
getListItems().clear();
if (account != null) {
for (final Jid jid : account.getBlocklist()) {
ListItem item;
if (jid.isFullJid()) {
item = new RawBlockable(account, jid);
} else {
item = account.getRoster().getContact(jid);
}
if (item.match(this, needle)) {
getListItems().add(item);
}
}
Collections.sort(getListItems());
}
getListItemAdapter().notifyDataSetChanged();
}
Aggregations