Sort contacts without names after contacts with names.

This commit is contained in:
Alan Evans
2020-06-07 23:04:41 -03:00
committed by Greyson Parrelli
parent dc70bfabaf
commit a3aed96757
2 changed files with 17 additions and 6 deletions

View File

@@ -418,6 +418,15 @@ public class Recipient {
else return Optional.fromNullable(getName(context)).or(getSmsAddress()).or("");
}
/**
* False iff it {@link #getDisplayName} would fall back to e164, email or unknown.
*/
public boolean hasAUserSetDisplayName(@NonNull Context context) {
return !TextUtils.isEmpty(getName(context)) ||
!TextUtils.isEmpty(getProfileName().toString()) ||
!TextUtils.isEmpty(getDisplayUsername());
}
public @NonNull String getDisplayName(@NonNull Context context) {
return Util.getFirstNonEmpty(getName(context),
getProfileName().toString(),