format phone number with narrow non-breaking space

This commit is contained in:
Daniel Gultsch 2019-01-11 18:06:11 +01:00
parent 6ecf6f1149
commit 91db13b01b
2 changed files with 2 additions and 2 deletions

View File

@ -151,7 +151,7 @@ public class EnterPhoneNumberActivity extends XmppActivity implements QuickConve
this.binding.countryCode.setText(String.valueOf(phoneNumber.getCountryCode()));
number.clear();
number.append(String.valueOf(phoneNumber.getNationalNumber()));
final String formattedPhoneNumber = PhoneNumberUtilWrapper.getInstance(this).format(phoneNumber, PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL);
final String formattedPhoneNumber = PhoneNumberUtilWrapper.getInstance(this).format(phoneNumber, PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL).replace(' ','\u202F');
if (PhoneNumberUtilWrapper.getInstance(this).isValidNumber(phoneNumber)) {
builder.setMessage(Html.fromHtml(getString(R.string.we_will_be_verifying, formattedPhoneNumber)));

View File

@ -24,7 +24,7 @@ public class PhoneNumberUtilWrapper {
public static String toFormattedPhoneNumber(Context context, Jid jid) {
try {
return getInstance(context).format(toPhoneNumber(context, jid), PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL);
return getInstance(context).format(toPhoneNumber(context, jid), PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL).replace(' ','\u202F');
} catch (Exception e) {
return jid.getEscapedLocal();
}