diff --git a/briar-android/res/layout/list_item_available_forum.xml b/briar-android/res/layout/list_item_available_forum.xml index 0129b9d6bfd84809d74ddedcfe219c0cd6149c02..ca9158af1b6c9e13ce67eadf78023c75d4a7c703 100644 --- a/briar-android/res/layout/list_item_available_forum.xml +++ b/briar-android/res/layout/list_item_available_forum.xml @@ -9,10 +9,21 @@ android:paddingTop="@dimen/listitem_horizontal_margin" android:background="?attr/selectableItemBackground"> + <org.briarproject.android.util.TextAvatarView + android:id="@+id/avatarView" + android:layout_width="@dimen/avatar_forum_size" + android:layout_height="@dimen/avatar_forum_size" + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" + android:layout_marginRight="@dimen/listitem_horizontal_margin" + /> + <TextView android:id="@+id/forumNameView" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_toEndOf="@+id/avatarView" + android:layout_toRightOf="@+id/avatarView" android:maxLines="2" android:textColor="@android:color/primary_text_light" android:textSize="@dimen/text_size_medium" @@ -22,10 +33,10 @@ android:id="@+id/sharedByView" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentLeft="true" - android:layout_alignParentStart="true" android:layout_below="@+id/forumNameView" android:layout_marginBottom="-8dp" + android:layout_toEndOf="@+id/avatarView" + android:layout_toRightOf="@+id/avatarView" android:paddingTop="@dimen/margin_medium" android:textColor="@android:color/secondary_text_light" android:textSize="@dimen/text_size_small" diff --git a/briar-android/src/org/briarproject/android/forum/AvailableForumsAdapter.java b/briar-android/src/org/briarproject/android/forum/AvailableForumsAdapter.java index 409cbaa75ce081b9f25bc5faca2a8ade202fb471..8fc9caa399613d34f212fdf362fe7293ff0456ec 100644 --- a/briar-android/src/org/briarproject/android/forum/AvailableForumsAdapter.java +++ b/briar-android/src/org/briarproject/android/forum/AvailableForumsAdapter.java @@ -10,6 +10,7 @@ import android.widget.Button; import android.widget.TextView; import org.briarproject.R; +import org.briarproject.android.util.TextAvatarView; import org.briarproject.api.contact.Contact; import org.briarproject.util.StringUtils; @@ -43,6 +44,9 @@ class AvailableForumsAdapter extends public void onBindViewHolder(AvailableForumViewHolder ui, int position) { final AvailableForumsItem item = getItem(position); + ui.avatar.setText(item.getForum().getName().substring(0, 1)); + ui.avatar.setBackgroundBytes(item.getForum().getId().getBytes()); + ui.name.setText(item.getForum().getName()); Collection<String> names = new ArrayList<>(); @@ -88,6 +92,7 @@ class AvailableForumsAdapter extends protected static class AvailableForumViewHolder extends RecyclerView.ViewHolder { + private final TextAvatarView avatar; private final TextView name; private final TextView sharedBy; private final Button accept; @@ -96,6 +101,7 @@ class AvailableForumsAdapter extends public AvailableForumViewHolder(View v) { super(v); + avatar = (TextAvatarView) v.findViewById(R.id.avatarView); name = (TextView) v.findViewById(R.id.forumNameView); sharedBy = (TextView) v.findViewById(R.id.sharedByView); accept = (Button) v.findViewById(R.id.acceptButton); diff --git a/briar-android/src/org/briarproject/android/forum/ForumListAdapter.java b/briar-android/src/org/briarproject/android/forum/ForumListAdapter.java index d6bb184541af7428786109681a50c535a55faef6..de53aab8dafb0520d9be2fee004cec26745d7ff1 100644 --- a/briar-android/src/org/briarproject/android/forum/ForumListAdapter.java +++ b/briar-android/src/org/briarproject/android/forum/ForumListAdapter.java @@ -91,7 +91,7 @@ public class ForumListAdapter extends public void onBindViewHolder(ForumViewHolder ui, int position) { final ForumListItem item = getItem(position); - // TODO add avatar. See #337 + // Avatar ui.avatar.setText(item.getForum().getName().substring(0, 1)); ui.avatar.setBackgroundBytes(item.getForum().getId().getBytes());