show proper avatar for 'self' contact. fixes #2138

This commit is contained in:
Daniel Gultsch 2016-11-22 12:34:16 +01:00
parent d76b0a3104
commit d2268c6a6f
2 changed files with 9 additions and 2 deletions

View file

@ -44,6 +44,9 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded {
} }
private Bitmap get(final Contact contact, final int size, boolean cachedOnly) { private Bitmap get(final Contact contact, final int size, boolean cachedOnly) {
if (contact.isSelf()) {
return get(contact.getAccount(),size,cachedOnly);
}
final String KEY = key(contact, size); final String KEY = key(contact, size);
Bitmap avatar = this.mXmppConnectionService.getBitmapCache().get(KEY); Bitmap avatar = this.mXmppConnectionService.getBitmapCache().get(KEY);
if (avatar != null || cachedOnly) { if (avatar != null || cachedOnly) {

View file

@ -1056,10 +1056,14 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
activity.conference_context_id = acmi.position; activity.conference_context_id = acmi.position;
} else if (mResContextMenu == R.menu.contact_context) { } else if (mResContextMenu == R.menu.contact_context) {
activity.contact_context_id = acmi.position; activity.contact_context_id = acmi.position;
final Blockable contact = (Contact) activity.contacts.get(acmi.position); final Contact contact = (Contact) activity.contacts.get(acmi.position);
final MenuItem blockUnblockItem = menu.findItem(R.id.context_contact_block_unblock); final MenuItem blockUnblockItem = menu.findItem(R.id.context_contact_block_unblock);
final MenuItem showContactDetailsItem = menu.findItem(R.id.context_contact_details);
if (contact.isSelf()) {
showContactDetailsItem.setVisible(false);
}
XmppConnection xmpp = contact.getAccount().getXmppConnection(); XmppConnection xmpp = contact.getAccount().getXmppConnection();
if (xmpp != null && xmpp.getFeatures().blocking()) { if (xmpp != null && xmpp.getFeatures().blocking() && !contact.isSelf()) {
if (contact.isBlocked()) { if (contact.isBlocked()) {
blockUnblockItem.setTitle(R.string.unblock_contact); blockUnblockItem.setTitle(R.string.unblock_contact);
} else { } else {