mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-29 05:04:54 +01:00
Show username in all display name locations if only option.
This commit is contained in:
committed by
Alex Hart
parent
c10c64a6a6
commit
5b2c458bcf
@@ -544,10 +544,6 @@ public class Recipient {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasName() {
|
||||
return groupName != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* False iff it {@link #getDisplayName} would fall back to e164, email or unknown.
|
||||
*/
|
||||
@@ -560,6 +556,10 @@ public class Recipient {
|
||||
public @NonNull String getDisplayName(@NonNull Context context) {
|
||||
String name = getNameFromLocalData(context);
|
||||
|
||||
if (Util.isEmpty(name)) {
|
||||
name = username;
|
||||
}
|
||||
|
||||
if (Util.isEmpty(name)) {
|
||||
name = getUnknownDisplayName(context);
|
||||
}
|
||||
@@ -567,20 +567,6 @@ public class Recipient {
|
||||
return StringUtil.isolateBidi(name);
|
||||
}
|
||||
|
||||
public @NonNull String getDisplayNameOrUsername(@NonNull Context context) {
|
||||
String name = getNameFromLocalData(context);
|
||||
|
||||
if (Util.isEmpty(name)) {
|
||||
name = StringUtil.isolateBidi(username);
|
||||
}
|
||||
|
||||
if (Util.isEmpty(name)) {
|
||||
name = StringUtil.isolateBidi(getUnknownDisplayName(context));
|
||||
}
|
||||
|
||||
return StringUtil.isolateBidi(name);
|
||||
}
|
||||
|
||||
public boolean hasNonUsernameDisplayName(@NonNull Context context) {
|
||||
return getNameFromLocalData(context) != null;
|
||||
}
|
||||
@@ -643,16 +629,6 @@ public class Recipient {
|
||||
String name = Util.getFirstNonEmpty(getGroupName(context),
|
||||
getSystemProfileName().getGivenName(),
|
||||
getProfileName().getGivenName(),
|
||||
getDisplayName(context));
|
||||
|
||||
return StringUtil.isolateBidi(name);
|
||||
}
|
||||
|
||||
public @NonNull String getShortDisplayNameIncludingUsername(@NonNull Context context) {
|
||||
String name = Util.getFirstNonEmpty(getGroupName(context),
|
||||
getSystemProfileName().getGivenName(),
|
||||
getProfileName().getGivenName(),
|
||||
shouldShowE164() ? getE164().orElse(null) : null,
|
||||
getUsername().orElse(null),
|
||||
getDisplayName(context));
|
||||
|
||||
|
||||
@@ -89,8 +89,8 @@ class AboutSheet : ComposeBottomSheetDialogFragment() {
|
||||
model = AboutModel(
|
||||
isSelf = recipient.get().isSelf,
|
||||
hasAvatar = recipient.get().profileAvatarFileDetails.hasFile(),
|
||||
displayName = recipient.get().getDisplayNameOrUsername(requireContext()),
|
||||
shortName = recipient.get().getShortDisplayNameIncludingUsername(requireContext()),
|
||||
displayName = recipient.get().getDisplayName(requireContext()),
|
||||
shortName = recipient.get().getShortDisplayName(requireContext()),
|
||||
about = recipient.get().about,
|
||||
verified = verified,
|
||||
recipientForAvatar = recipient.get(),
|
||||
|
||||
@@ -184,7 +184,7 @@ public final class RecipientBottomSheetDialogFragment extends BottomSheetDialogF
|
||||
}
|
||||
|
||||
String name = recipient.isSelf() ? requireContext().getString(R.string.note_to_self)
|
||||
: recipient.getDisplayNameOrUsername(requireContext());
|
||||
: recipient.getDisplayName(requireContext());
|
||||
fullName.setVisibility(TextUtils.isEmpty(name) ? View.GONE : View.VISIBLE);
|
||||
SpannableStringBuilder nameBuilder = new SpannableStringBuilder(name);
|
||||
if (recipient.showVerified()) {
|
||||
|
||||
Reference in New Issue
Block a user