From 5786ac028d7ba2c5cdd98dc67db34036abb13e1b Mon Sep 17 00:00:00 2001 From: cmp Date: Fri, 23 Dec 2022 16:25:14 -0600 Subject: Show moderator author/user colors in more places, such as post lists and history. Show moderator badging in post details as well as color. (#1288) --- .../adapters/HistoryPostRecyclerViewAdapter.java | 8 +++- .../adapters/PostDetailRecyclerViewAdapter.java | 9 ++++ .../adapters/PostRecyclerViewAdapter.java | 9 +++- .../infinityforreddit/comment/Comment.java | 4 ++ .../infinityforreddit/post/ParsePost.java | 48 +++++++++++++--------- .../infinityforreddit/post/Post.java | 17 +++++++- 6 files changed, 72 insertions(+), 23 deletions(-) (limited to 'app/src/main/java') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java index db7abf03..c9b5af10 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java @@ -164,6 +164,7 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter previews = new ArrayList<>(); private ArrayList gallery = new ArrayList<>(); @@ -85,7 +86,7 @@ public class Post implements Parcelable { String title, String permalink, int score, int postType, int voteType, int nComments, int upvoteRatio, String flair, String awards, int nAwards, boolean hidden, boolean spoiler, boolean nsfw, boolean stickied, boolean archived, boolean locked, boolean saved, - boolean isCrosspost) { + boolean isCrosspost, String distinguished) { this.id = id; this.fullName = fullName; this.subredditName = subredditName; @@ -113,6 +114,7 @@ public class Post implements Parcelable { this.locked = locked; this.saved = saved; this.isCrosspost = isCrosspost; + this.distinguished = distinguished; isRead = false; } @@ -121,7 +123,7 @@ public class Post implements Parcelable { String url, String permalink, int score, int postType, int voteType, int nComments, int upvoteRatio, String flair, String awards, int nAwards, boolean hidden, boolean spoiler, boolean nsfw, boolean stickied, boolean archived, boolean locked, boolean saved, - boolean isCrosspost) { + boolean isCrosspost, String distinguished) { this.id = id; this.fullName = fullName; this.subredditName = subredditName; @@ -150,6 +152,7 @@ public class Post implements Parcelable { this.locked = locked; this.saved = saved; this.isCrosspost = isCrosspost; + this.distinguished = distinguished; isRead = false; } @@ -198,6 +201,7 @@ public class Post implements Parcelable { isCrosspost = in.readByte() != 0; isRead = in.readByte() != 0; crosspostParentId = in.readString(); + distinguished = in.readString(); in.readTypedList(previews, Preview.CREATOR); in.readTypedList(gallery, Gallery.CREATOR); } @@ -387,6 +391,14 @@ public class Post implements Parcelable { this.flair = flair; } + public boolean isModerator() { + return distinguished != null && distinguished.equals("moderator"); + } + + public boolean isAdmin() { + return distinguished != null && distinguished.equals("admin"); + } + public String getAwards() { return awards; } @@ -574,6 +586,7 @@ public class Post implements Parcelable { parcel.writeByte((byte) (isCrosspost ? 1 : 0)); parcel.writeByte((byte) (isRead ? 1 : 0)); parcel.writeString(crosspostParentId); + parcel.writeString(distinguished); parcel.writeTypedList(previews); parcel.writeTypedList(gallery); } -- cgit v1.2.3