Add support for setting empty profile names

// FREEBIE
This commit is contained in:
Moxie Marlinspike
2017-10-01 15:36:15 -07:00
parent 285947eb66
commit 893cf9c01d
4 changed files with 8 additions and 6 deletions

View File

@@ -539,7 +539,7 @@ public class ConversationItem extends LinearLayout
if (groupThread && !messageRecord.isOutgoing()) {
this.groupSender.setText(recipient.toShortString());
if (recipient.getName() == null && recipient.getProfileName() != null) {
if (recipient.getName() == null && !TextUtils.isEmpty(recipient.getProfileName())) {
this.groupSenderProfileName.setText("~" + recipient.getProfileName());
this.groupSenderProfileName.setVisibility(View.VISIBLE);
} else {

View File

@@ -7,6 +7,7 @@ import android.graphics.Rect;
import android.os.AsyncTask;
import android.provider.ContactsContract;
import android.support.v7.app.AlertDialog;
import android.text.TextUtils;
import org.thoughtcrime.securesms.database.DatabaseFactory;
import org.thoughtcrime.securesms.recipients.Recipient;
@@ -113,7 +114,7 @@ public class GroupMembersDialog extends AsyncTask<Void, Void, List<Recipient>> {
} else {
String name = recipient.toShortString();
if (recipient.getName() == null && recipient.getProfileName() != null) {
if (recipient.getName() == null && !TextUtils.isEmpty(recipient.getProfileName())) {
name += " ~" + recipient.getProfileName();
}

View File

@@ -8,6 +8,7 @@ import android.text.Spannable;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.style.AbsoluteSizeSpan;
import android.text.style.ForegroundColorSpan;
import android.text.style.StyleSpan;
@@ -56,7 +57,7 @@ public class FromTextView extends EmojiTextView {
fromSpan.setSpan(new StyleSpan(typeface), 0, builder.length(),
Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
if (recipient.getName() == null && recipient.getProfileName() != null) {
if (recipient.getName() == null && !TextUtils.isEmpty(recipient.getProfileName())) {
SpannableString profileName = new SpannableString(" (~" + recipient.getProfileName() + ") ");
profileName.setSpan(new CenterAlignedRelativeSizeSpan(0.75f), 0, profileName.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
profileName.setSpan(new TypefaceSpan("sans-serif-light"), 0, profileName.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);