Make identicons round

This commit renames identicons to avatars in field names, and uses an ImageView
derivative to show the identicons, which should make implementing #214 easier.
This commit is contained in:
str4d
2016-01-26 20:21:35 +00:00
parent 9749eefb90
commit 90eded1421
14 changed files with 78 additions and 34 deletions

View File

@@ -9,13 +9,18 @@ import android.widget.ImageView;
import android.widget.TextView;
import org.briarproject.R;
import org.briarproject.api.crypto.CryptoComponent;
import org.briarproject.api.identity.Author;
import im.delight.android.identicons.IdenticonView;
import javax.inject.Inject;
import im.delight.android.identicons.IdenticonDrawable;
import roboguice.RoboGuice;
public class AuthorView extends FrameLayout {
private IdenticonView identiconView;
@Inject private CryptoComponent crypto;
private ImageView avatarView;
private TextView nameView;
private ImageView statusView;
@@ -39,13 +44,14 @@ public class AuthorView extends FrameLayout {
}
private void initViews() {
RoboGuice.injectMembers(getContext(), this);
if (isInEditMode())
return;
View v = LayoutInflater.from(getContext()).inflate(
R.layout.author_view, this, true);
identiconView = (IdenticonView) v.findViewById(R.id.identiconView);
avatarView = (ImageView) v.findViewById(R.id.avatarView);
nameView = (TextView) v.findViewById(R.id.nameView);
statusView = (ImageView) v.findViewById(R.id.statusView);
}
@@ -53,7 +59,8 @@ public class AuthorView extends FrameLayout {
public void init(Author author, Author.Status status) {
if (author == null) nameView.setText(R.string.anonymous);
else {
identiconView.show(author.getId().getBytes());
avatarView.setImageDrawable(
new IdenticonDrawable(crypto, author.getId().getBytes()));
nameView.setText(author.getName());
}