mirror of
https://github.com/oxen-io/session-android.git
synced 2025-06-09 16:18:34 +00:00
Refactor AvatarImageView#setAvatarClickHandler.
This triggered a call to Recipient#isGroup when rendering a view, which itself could trigger a DB read. This delays the call to #isGroup to lower the possibility of doing DB reads on the main thread.
This commit is contained in:
parent
d7c350f987
commit
848101a783
@ -136,17 +136,17 @@ public final class AvatarImageView extends AppCompatImageView {
|
||||
}
|
||||
|
||||
private void setAvatarClickHandler(final Recipient recipient, boolean quickContactEnabled) {
|
||||
if (!recipient.isGroup() && quickContactEnabled) {
|
||||
super.setOnClickListener(v -> {
|
||||
super.setOnClickListener(v -> {
|
||||
if (!recipient.isGroup() && quickContactEnabled) {
|
||||
if (recipient.getContactUri() != null) {
|
||||
ContactsContract.QuickContact.showQuickContact(getContext(), AvatarImageView.this, recipient.getContactUri(), ContactsContract.QuickContact.MODE_LARGE, null);
|
||||
} else {
|
||||
getContext().startActivity(RecipientExporter.export(recipient).asAddContactIntent());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
super.setOnClickListener(listener);
|
||||
}
|
||||
} else {
|
||||
listener.onClick(v);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static class RecipientContactPhoto {
|
||||
|
Loading…
x
Reference in New Issue
Block a user