mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 11:19:04 +01:00
Show blog posts from RSS feeds with a dedicated icon
This adds a field to the post headers and some more tests.
This commit is contained in:
@@ -48,6 +48,10 @@ public class BlogPostItem implements Comparable<BlogPostItem> {
|
||||
return body;
|
||||
}
|
||||
|
||||
public boolean isRssFeed() {
|
||||
return header.isRssFeed();
|
||||
}
|
||||
|
||||
public boolean isRead() {
|
||||
return read;
|
||||
}
|
||||
|
||||
@@ -108,7 +108,8 @@ class BlogPostViewHolder extends RecyclerView.ViewHolder {
|
||||
author.setAuthor(a);
|
||||
author.setAuthorStatus(post.getAuthorStatus());
|
||||
author.setDate(post.getTimestamp());
|
||||
author.setPersona(AuthorView.NORMAL);
|
||||
author.setPersona(
|
||||
item.isRssFeed() ? AuthorView.RSS_FEED : AuthorView.NORMAL);
|
||||
// TODO make author clickable more often #624
|
||||
if (item.getHeader().getType() == POST) {
|
||||
author.setBlogLink(post.getGroupId());
|
||||
@@ -168,7 +169,9 @@ class BlogPostViewHolder extends RecyclerView.ViewHolder {
|
||||
reblogger.setVisibility(VISIBLE);
|
||||
reblogger.setPersona(AuthorView.REBLOGGER);
|
||||
|
||||
author.setPersona(AuthorView.COMMENTER);
|
||||
author.setPersona(item.getHeader().getParent().isRssFeed() ?
|
||||
AuthorView.RSS_FEED_REBLOGGED :
|
||||
AuthorView.COMMENTER);
|
||||
|
||||
// comments
|
||||
for (BlogCommentHeader c : item.getComments()) {
|
||||
|
||||
@@ -40,6 +40,8 @@ public class AuthorView extends RelativeLayout {
|
||||
public static final int REBLOGGER = 1;
|
||||
public static final int COMMENTER = 2;
|
||||
public static final int LIST = 3;
|
||||
public static final int RSS_FEED = 4;
|
||||
public static final int RSS_FEED_REBLOGGED = 5;
|
||||
|
||||
private final CircleImageView avatar;
|
||||
private final ImageView avatarIcon;
|
||||
@@ -124,6 +126,12 @@ public class AuthorView extends RelativeLayout {
|
||||
setOnClickListener(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Styles this view for a different persona.
|
||||
*
|
||||
* Attention: If used in a RecyclerView with RSS_FEED,
|
||||
* call this after setAuthor()
|
||||
*/
|
||||
public void setPersona(int persona) {
|
||||
switch (persona) {
|
||||
case NORMAL:
|
||||
@@ -158,6 +166,24 @@ public class AuthorView extends RelativeLayout {
|
||||
setCenterVertical(authorName, true);
|
||||
setCenterVertical(trustIndicator, true);
|
||||
break;
|
||||
case RSS_FEED:
|
||||
avatarIcon.setVisibility(INVISIBLE);
|
||||
date.setVisibility(VISIBLE);
|
||||
avatar.setImageResource(R.drawable.ic_rss_feed);
|
||||
setAvatarSize(R.dimen.blogs_avatar_normal_size);
|
||||
setTextSize(authorName, R.dimen.text_size_small);
|
||||
setCenterVertical(authorName, false);
|
||||
setCenterVertical(trustIndicator, false);
|
||||
break;
|
||||
case RSS_FEED_REBLOGGED:
|
||||
avatarIcon.setVisibility(INVISIBLE);
|
||||
date.setVisibility(VISIBLE);
|
||||
avatar.setImageResource(R.drawable.ic_rss_feed);
|
||||
setAvatarSize(R.dimen.blogs_avatar_comment_size);
|
||||
setTextSize(authorName, R.dimen.text_size_tiny);
|
||||
setCenterVertical(authorName, false);
|
||||
setCenterVertical(trustIndicator, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user