diff --git a/src/org/thoughtcrime/securesms/RecipientPreferenceActivity.java b/src/org/thoughtcrime/securesms/RecipientPreferenceActivity.java index 7723e51aea..a42ee799ca 100644 --- a/src/org/thoughtcrime/securesms/RecipientPreferenceActivity.java +++ b/src/org/thoughtcrime/securesms/RecipientPreferenceActivity.java @@ -359,7 +359,7 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi colorPreference.setColors(MaterialColors.CONVERSATION_PALETTE.asConversationColorArray(getActivity())); colorPreference.setColor(recipient.getColor().toActionBarColor(getActivity())); - aboutPreference.setTitle(PhoneNumberUtils.formatNumber(recipient.getAddress().toPhoneString())); + aboutPreference.setTitle(formatAddress(recipient.getAddress())); aboutPreference.setSummary(recipient.getCustomLabel()); aboutPreference.setSecure(recipient.getRegistered() == RecipientDatabase.RegisteredState.REGISTERED); @@ -388,6 +388,12 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi } } + private @NonNull String formatAddress(@NonNull Address address) { + if (address.isPhone()) return PhoneNumberUtils.formatNumber(address.toPhoneString()); + else if (address.isEmail()) return address.toEmailString(); + else return ""; + } + private @NonNull String getRingtoneSummary(@NonNull Context context, @Nullable Uri ringtone) { if (ringtone == null) { return context.getString(R.string.preferences__default);