mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-28 04:25:18 +00:00
Fix identicon crash
This commit is contained in:
parent
21fc47d7bf
commit
342bd797b8
@ -199,8 +199,11 @@ public class ConversationListActivity extends PassphraseRequiredActionBarActivit
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreDraw() {
|
public boolean onPreDraw() {
|
||||||
|
int width = profilePictureImageView.getWidth();
|
||||||
|
int height = profilePictureImageView.getHeight();
|
||||||
|
if (width == 0 || height == 0) return true;
|
||||||
profilePictureImageView.getViewTreeObserver().removeOnPreDrawListener(this);
|
profilePictureImageView.getViewTreeObserver().removeOnPreDrawListener(this);
|
||||||
ClassicIdenticonDrawable identicon = new ClassicIdenticonDrawable(profilePictureImageView.getWidth(), profilePictureImageView.getHeight(), recipient.getAddress().serialize().hashCode());
|
ClassicIdenticonDrawable identicon = new ClassicIdenticonDrawable(width, height, recipient.getAddress().serialize().hashCode());
|
||||||
profilePictureImageView.setImageDrawable(identicon);
|
profilePictureImageView.setImageDrawable(identicon);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -97,8 +97,11 @@ public class ProfilePreference extends Preference {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreDraw() {
|
public boolean onPreDraw() {
|
||||||
|
int width = avatarView.getWidth();
|
||||||
|
int height = avatarView.getHeight();
|
||||||
|
if (width == 0 || height == 0) return true;
|
||||||
avatarView.getViewTreeObserver().removeOnPreDrawListener(this);
|
avatarView.getViewTreeObserver().removeOnPreDrawListener(this);
|
||||||
ClassicIdenticonDrawable identicon = new ClassicIdenticonDrawable(avatarView.getWidth(), avatarView.getHeight(), userHexEncodedPublicKey.hashCode());
|
ClassicIdenticonDrawable identicon = new ClassicIdenticonDrawable(width, height, userHexEncodedPublicKey.hashCode());
|
||||||
avatarView.setImageDrawable(identicon);
|
avatarView.setImageDrawable(identicon);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user