Contact aliases: address review comments

This commit is contained in:
Torsten Grote
2018-10-31 12:05:33 -03:00
parent ecf417c93b
commit 3fe7aae97e
8 changed files with 44 additions and 24 deletions

View File

@@ -10,7 +10,6 @@ import org.briarproject.briar.android.threaded.BaseThreadItemViewHolder;
import org.briarproject.briar.android.threaded.ThreadItemAdapter.ThreadItemListener;
import static org.briarproject.bramble.api.identity.AuthorInfo.Status.OURSELVES;
import static org.briarproject.briar.android.util.UiUtils.getContactDisplayName;
@UiThread
@NotNullByDefault
@@ -37,8 +36,7 @@ class JoinMessageItemViewHolder
if (item.isInitial()) {
textView.setText(R.string.groups_member_created_you);
} else {
String name = getContactDisplayName(item.getAuthor(),
item.getAuthorInfo().getAlias());
String name = item.getAuthorName();
textView.setText(getContext()
.getString(R.string.groups_member_joined, name));
}
@@ -46,8 +44,7 @@ class JoinMessageItemViewHolder
private void bind(JoinMessageItem item) {
Context ctx = getContext();
String name = getContactDisplayName(item.getAuthor(),
item.getAuthorInfo().getAlias());
String name = item.getAuthorName();
if (item.isInitial()) {
textView.setText(

View File

@@ -10,6 +10,7 @@ import javax.annotation.Nullable;
import javax.annotation.concurrent.NotThreadSafe;
import static org.briarproject.briar.android.threaded.ThreadItemAdapter.UNDEFINED;
import static org.briarproject.briar.android.util.UiUtils.getContactDisplayName;
@NotThreadSafe
@NotNullByDefault
@@ -70,6 +71,13 @@ public abstract class ThreadItem implements MessageNode {
return authorInfo;
}
/**
* Returns the author's name, with an alias if one exists.
*/
public String getAuthorName() {
return getContactDisplayName(author, authorInfo.getAlias());
}
@Override
public void setLevel(int level) {
this.level = level;

View File

@@ -141,7 +141,7 @@ public class UiUtils {
}
public static Spanned getSpanned(@Nullable String s) {
// TODO move to HtmlCompat
// TODO move to HtmlCompat #1435
// https://commonsware.com/blog/2018/05/29/at-last-htmlcompat.html
return Html.fromHtml(s);
}