mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 03:39:05 +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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
25
briar-android/src/main/res/drawable/ic_rss_feed.xml
Normal file
25
briar-android/src/main/res/drawable/ic_rss_feed.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="30dp"
|
||||
android:height="30dp"
|
||||
android:viewportHeight="30"
|
||||
android:viewportWidth="30">
|
||||
|
||||
<path
|
||||
android:fillColor="#ffa500"
|
||||
android:pathData="M0,8.88178e-16 L30,8.88178e-16 L30,30 L0,30 L0,8.88178e-16 Z"/>
|
||||
<path
|
||||
android:fillColor="#ffffff"
|
||||
android:pathData="M8.9322,18.0339 C10.6078,18.0339,11.9661,19.3922,11.9661,21.0678
|
||||
C11.9661,22.7434,10.6078,24.1017,8.9322,24.1017
|
||||
C7.25663,24.1017,5.8983,22.7434,5.8983,21.0678
|
||||
C5.8983,19.3922,7.25663,18.0339,8.9322,18.0339 Z"/>
|
||||
<path
|
||||
android:fillColor="#ffffff"
|
||||
android:pathData="M5.8983,15 A9.1016949,9.1016949,0,0,1,15,24.1017 L18.0339,24.1017
|
||||
A12.135593,12.135593,0,0,0,5.8983,11.9661 Z"/>
|
||||
<path
|
||||
android:fillColor="#ffffff"
|
||||
android:pathData="M5.8983,8.9322 A15.169492,15.169492,0,0,1,21.0678,24.1017 L24.1017,24.1017
|
||||
A18.20339,18.20339,0,0,0,5.8983,5.8983 Z"/>
|
||||
</vector>
|
||||
@@ -12,6 +12,8 @@
|
||||
<enum name="reblogger" value="1"/>
|
||||
<enum name="commenter" value="2"/>
|
||||
<enum name="list" value="3"/>
|
||||
<enum name="rss_feed" value="4"/>
|
||||
<enum name="rss_feed_reblogged" value="5"/>
|
||||
</attr>
|
||||
</declare-styleable>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user