Fix identicon crash

pull/13/head
Niels Andriesse 5 years ago
parent 21fc47d7bf
commit 342bd797b8

@ -199,8 +199,11 @@ public class ConversationListActivity extends PassphraseRequiredActionBarActivit
@Override
public boolean onPreDraw() {
int width = profilePictureImageView.getWidth();
int height = profilePictureImageView.getHeight();
if (width == 0 || height == 0) return true;
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);
return true;
}

@ -97,8 +97,11 @@ public class ProfilePreference extends Preference {
@Override
public boolean onPreDraw() {
int width = avatarView.getWidth();
int height = avatarView.getHeight();
if (width == 0 || height == 0) return true;
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);
return true;
}

Loading…
Cancel
Save