diff --git a/src/org/thoughtcrime/securesms/ConversationListActivity.java b/src/org/thoughtcrime/securesms/ConversationListActivity.java index 93dadd0035..82cd2899c5 100644 --- a/src/org/thoughtcrime/securesms/ConversationListActivity.java +++ b/src/org/thoughtcrime/securesms/ConversationListActivity.java @@ -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; } diff --git a/src/org/thoughtcrime/securesms/preferences/widgets/ProfilePreference.java b/src/org/thoughtcrime/securesms/preferences/widgets/ProfilePreference.java index 78e50e293b..c67d6c0d1e 100644 --- a/src/org/thoughtcrime/securesms/preferences/widgets/ProfilePreference.java +++ b/src/org/thoughtcrime/securesms/preferences/widgets/ProfilePreference.java @@ -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; }