aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2020-04-16 13:50:25 +0000
committerAlex Ning <chineseperson5@gmail.com>2020-04-16 13:50:25 +0000
commit504b005cf7b9d9881b6780ede5f75b7bcf2c6cd2 (patch)
treeac780db880c054fb70970a156b37ebb10619df62 /app/src/main/java/ml
parentf0125edd233bb433c2d59cc04144be1e4a65bd0e (diff)
downloadinfinity-for-reddit-504b005cf7b9d9881b6780ede5f75b7bcf2c6cd2.tar
infinity-for-reddit-504b005cf7b9d9881b6780ede5f75b7bcf2c6cd2.tar.gz
infinity-for-reddit-504b005cf7b9d9881b6780ede5f75b7bcf2c6cd2.tar.bz2
infinity-for-reddit-504b005cf7b9d9881b6780ede5f75b7bcf2c6cd2.tar.lz
infinity-for-reddit-504b005cf7b9d9881b6780ede5f75b7bcf2c6cd2.tar.xz
infinity-for-reddit-504b005cf7b9d9881b6780ede5f75b7bcf2c6cd2.tar.zst
infinity-for-reddit-504b005cf7b9d9881b6780ede5f75b7bcf2c6cd2.zip
Show awards for comments.
Diffstat (limited to 'app/src/main/java/ml')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java17
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/CommentData.java15
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/ParseComment.java22
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/ParsePost.java108
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Post/Post.java49
5 files changed, 150 insertions, 61 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java
index 49bc1f3e..250d17d3 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java
@@ -871,6 +871,18 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
((CommentViewHolder) holder).topScoreTextView.setVisibility(View.GONE);
}
+ if (comment.getAwards() != null && !comment.getAwards().equals("")) {
+ ((CommentViewHolder) holder).awardsTextView.setVisibility(View.VISIBLE);
+ Spannable awardsHTML;
+ GlideImageGetter glideImageGetter = new GlideImageGetter(((CommentViewHolder) holder).awardsTextView);
+ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
+ awardsHTML = (Spannable) Html.fromHtml(comment.getAwards(), Html.FROM_HTML_MODE_LEGACY, glideImageGetter, null);
+ } else {
+ awardsHTML = (Spannable) Html.fromHtml(comment.getAwards(), glideImageGetter, null);
+ }
+ ((CommentViewHolder) holder).awardsTextView.setText(awardsHTML);
+ }
+
mCommentMarkwon.setMarkdown(((CommentViewHolder) holder).commentMarkdownView, comment.getCommentMarkdown());
((CommentViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
comment.getScore() + comment.getVoteType()));
@@ -1749,6 +1761,8 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
mGlide.clear(((CommentViewHolder) holder).authorTypeImageView);
((CommentViewHolder) holder).authorFlairTextView.setVisibility(View.GONE);
((CommentViewHolder) holder).authorTypeImageView.setVisibility(View.GONE);
+ ((CommentViewHolder) holder).awardsTextView.setText("");
+ ((CommentViewHolder) holder).awardsTextView.setVisibility(View.GONE);
((CommentViewHolder) holder).expandButton.setVisibility(View.GONE);
((CommentViewHolder) holder).upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((CommentViewHolder) holder).scoreTextView.setTextColor(mCommentIconAndInfoColor);
@@ -2124,6 +2138,8 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
TextView commentTimeTextView;
@BindView(R.id.top_score_text_view_item_post_comment)
TextView topScoreTextView;
+ @BindView(R.id.awards_text_view_item_comment)
+ TextView awardsTextView;
@BindView(R.id.comment_markdown_view_item_post_comment)
TextView commentMarkdownView;
@BindView(R.id.bottom_constraint_layout_item_post_comment)
@@ -2182,6 +2198,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
commentMarkdownView.setTextColor(mCommentTextColor);
authorFlairTextView.setTextColor(mAuthorFlairTextColor);
topScoreTextView.setTextColor(mSecondaryTextColor);
+ awardsTextView.setTextColor(mCommentTextColor);
commentDivider.setBackgroundColor(mDividerColor);
upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
scoreTextView.setTextColor(mCommentIconAndInfoColor);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentData.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentData.java
index 0b37ed83..3cfa8a27 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentData.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentData.java
@@ -40,6 +40,7 @@ public class CommentData implements Parcelable {
private boolean isSubmitter;
private String distinguished;
private String permalink;
+ private String awards;
private int depth;
private boolean collapsed;
private boolean hasReply;
@@ -56,9 +57,10 @@ public class CommentData implements Parcelable {
public CommentData(String id, String fullName, String author, String authorFlair,
String authorFlairHTML, String linkAuthor, String commentTime,
long commentTimeMillis, String commentMarkdown, String commentRawText,
- String linkId, String subredditName, String parentId, int score, int voteType,
- boolean isSubmitter, String distinguished, String permalink, int depth,
- boolean collapsed, boolean hasReply, boolean scoreHidden, boolean saved) {
+ String linkId, String subredditName, String parentId, int score,
+ int voteType, boolean isSubmitter, String distinguished, String permalink,
+ String awards, int depth, boolean collapsed, boolean hasReply,
+ boolean scoreHidden, boolean saved) {
this.id = id;
this.fullName = fullName;
this.author = author;
@@ -77,6 +79,7 @@ public class CommentData implements Parcelable {
this.isSubmitter = isSubmitter;
this.distinguished = distinguished;
this.permalink = RedditUtils.API_BASE_URI + permalink;
+ this.awards = awards;
this.depth = depth;
this.collapsed = collapsed;
this.hasReply = hasReply;
@@ -114,6 +117,7 @@ public class CommentData implements Parcelable {
isSubmitter = in.readByte() != 0;
distinguished = in.readString();
permalink = in.readString();
+ awards = in.readString();
depth = in.readInt();
collapsed = in.readByte() != 0;
hasReply = in.readByte() != 0;
@@ -215,6 +219,10 @@ public class CommentData implements Parcelable {
return permalink;
}
+ public String getAwards() {
+ return awards;
+ }
+
public int getDepth() {
return depth;
}
@@ -359,6 +367,7 @@ public class CommentData implements Parcelable {
parcel.writeByte((byte) (isSubmitter ? 1 : 0));
parcel.writeString(distinguished);
parcel.writeString(permalink);
+ parcel.writeString(awards);
parcel.writeInt(depth);
parcel.writeByte((byte) (collapsed ? 1 : 0));
parcel.writeByte((byte) (hasReply ? 1 : 0));
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ParseComment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ParseComment.java
index fc5b829c..b8f4bfd4 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ParseComment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ParseComment.java
@@ -145,6 +145,20 @@ public class ParseComment {
String commentRawText = Utils.trimTrailingWhitespace(
Html.fromHtml(singleCommentData.getString(JSONUtils.BODY_HTML_KEY))).toString();
String permalink = Html.fromHtml(singleCommentData.getString(JSONUtils.PERMALINK_KEY)).toString();
+ StringBuilder awardingsBuilder = new StringBuilder();
+ JSONArray awardingsArray = singleCommentData.getJSONArray(JSONUtils.ALL_AWARDINGS_KEY);
+ for (int i = 0; i < awardingsArray.length(); i++) {
+ JSONObject award = awardingsArray.getJSONObject(i);
+ int count = award.getInt(JSONUtils.COUNT_KEY);
+ JSONArray icons = award.getJSONArray(JSONUtils.RESIZED_ICONS_KEY);
+ if (icons.length() > 4) {
+ String iconUrl = icons.getJSONObject(3).getString(JSONUtils.URL_KEY);
+ awardingsBuilder.append("<img src=\"").append(iconUrl).append("\"> ").append("x").append(count).append(" ");
+ } else if (icons.length() > 0) {
+ String iconUrl = icons.getJSONObject(icons.length() - 1).getString(JSONUtils.URL_KEY);
+ awardingsBuilder.append("<img src=\"").append(iconUrl).append("\"> ").append("x").append(count).append(" ");
+ }
+ }
int score = singleCommentData.getInt(JSONUtils.SCORE_KEY);
int voteType;
if (singleCommentData.isNull(JSONUtils.LIKES_KEY)) {
@@ -169,10 +183,10 @@ public class ParseComment {
boolean collapsed = singleCommentData.getBoolean(JSONUtils.COLLAPSED_KEY);
boolean hasReply = !(singleCommentData.get(JSONUtils.REPLIES_KEY) instanceof String);
- return new CommentData(id, fullName, author, authorFlair, authorFlairHTMLBuilder.toString(), linkAuthor,
- formattedSubmitTime, submitTime, commentMarkdown, commentRawText, linkId, subredditName,
- parentId, score, voteType, isSubmitter, distinguished, permalink, depth, collapsed,
- hasReply, scoreHidden, saved);
+ return new CommentData(id, fullName, author, authorFlair, authorFlairHTMLBuilder.toString(),
+ linkAuthor, formattedSubmitTime, submitTime, commentMarkdown, commentRawText,
+ linkId, subredditName, parentId, score, voteType, isSubmitter, distinguished,
+ permalink, awardingsBuilder.toString(),depth, collapsed, hasReply, scoreHidden, saved);
}
@Nullable
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ParsePost.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ParsePost.java
index 3874de35..49329844 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ParsePost.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ParsePost.java
@@ -37,6 +37,20 @@ public class ParsePost {
String subredditName = data.getString(JSONUtils.SUBREDDIT_KEY);
String subredditNamePrefixed = data.getString(JSONUtils.SUBREDDIT_NAME_PREFIX_KEY);
String author = data.getString(JSONUtils.AUTHOR_KEY);
+ StringBuilder authorFlairHTMLBuilder = new StringBuilder();
+ if (data.has(JSONUtils.AUTHOR_FLAIR_RICHTEXT_KEY)) {
+ JSONArray flairArray = data.getJSONArray(JSONUtils.AUTHOR_FLAIR_RICHTEXT_KEY);
+ for (int i = 0; i < flairArray.length(); i++) {
+ JSONObject flairObject = flairArray.getJSONObject(i);
+ String e = flairObject.getString(JSONUtils.E_KEY);
+ if (e.equals("text")) {
+ authorFlairHTMLBuilder.append(flairObject.getString(JSONUtils.T_KEY));
+ } else if (e.equals("emoji")) {
+ authorFlairHTMLBuilder.append("<img src=\"").append(flairObject.getString(JSONUtils.U_KEY)).append("\">");
+ }
+ }
+ }
+ String authorFlair = data.isNull(JSONUtils.AUTHOR_FLAIR_TEXT_KEY) ? "" : data.getString(JSONUtils.AUTHOR_FLAIR_TEXT_KEY);
long postTime = data.getLong(JSONUtils.CREATED_UTC_KEY) * 1000;
String title = data.getString(JSONUtils.TITLE_KEY);
int score = data.getInt(JSONUtils.SCORE_KEY);
@@ -71,10 +85,10 @@ public class ParsePost {
JSONArray icons = award.getJSONArray(JSONUtils.RESIZED_ICONS_KEY);
if (icons.length() > 4) {
String iconUrl = icons.getJSONObject(3).getString(JSONUtils.URL_KEY);
- awardingsBuilder.append("<img src=\"").append(iconUrl).append("\">").append("x").append(count).append(" ");
+ awardingsBuilder.append("<img src=\"").append(iconUrl).append("\"> ").append("x").append(count).append(" ");
} else if (icons.length() > 0) {
String iconUrl = icons.getJSONObject(icons.length() - 1).getString(JSONUtils.URL_KEY);
- awardingsBuilder.append("<img src=\"").append(iconUrl).append("\">").append("x").append(count).append(" ");
+ awardingsBuilder.append("<img src=\"").append(iconUrl).append("\"> ").append("x").append(count).append(" ");
}
}
@@ -115,24 +129,25 @@ public class ParsePost {
data = data.getJSONArray(JSONUtils.CROSSPOST_PARENT_LIST).getJSONObject(0);
Post crosspostParent = parseBasicData(data, locale);
Post post = parseData(data, permalink, id, fullName, subredditName, subredditNamePrefixed,
- author, formattedPostTime, postTime, title, previewUrl, thumbnailPreviewUrl,
- previewWidth, previewHeight, score, voteType, nComments, flair,
- awardingsBuilder.toString(), hidden, spoiler, nsfw, stickied, archived, locked,
- saved, true);
+ author, authorFlair, authorFlairHTMLBuilder.toString(), formattedPostTime,
+ postTime, title, previewUrl, thumbnailPreviewUrl, previewWidth, previewHeight,
+ score, voteType, nComments, flair, awardingsBuilder.toString(), hidden, spoiler,
+ nsfw, stickied, archived, locked, saved, true);
post.setCrosspostParentId(crosspostParent.getId());
return post;
} else {
return parseData(data, permalink, id, fullName, subredditName, subredditNamePrefixed,
- author, formattedPostTime, postTime, title, previewUrl, thumbnailPreviewUrl,
- previewWidth, previewHeight, score, voteType, nComments, flair,
- awardingsBuilder.toString(), hidden, spoiler, nsfw, stickied, archived, locked,
- saved, false);
+ author, authorFlair, authorFlairHTMLBuilder.toString(), formattedPostTime,
+ postTime, title, previewUrl, thumbnailPreviewUrl, previewWidth, previewHeight,
+ score, voteType, nComments, flair, awardingsBuilder.toString(), hidden, spoiler,
+ nsfw, stickied, archived, locked, saved, false);
}
}
private static Post parseData(JSONObject data, String permalink, String id, String fullName,
String subredditName, String subredditNamePrefixed, String author,
- String formattedPostTime, long postTimeMillis, String title, String previewUrl,
+ String authorFlair, String authorFlairHTML, String formattedPostTime,
+ long postTimeMillis, String title, String previewUrl,
String thumbnailPreviewUrl, int previewWidth, int previewHeight,
int score, int voteType, int nComments, String flair,
String awards, boolean hidden, boolean spoiler, boolean nsfw, boolean stickied,
@@ -146,7 +161,8 @@ public class ParsePost {
if (url.contains(permalink)) {
//Text post
int postType = Post.TEXT_TYPE;
- post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, formattedPostTime, postTimeMillis,
+ post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
+ authorFlair, authorFlairHTML, formattedPostTime, postTimeMillis,
title, permalink, score, postType, voteType, nComments, flair, awards,
hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost);
if (data.isNull(JSONUtils.SELFTEXT_KEY)) {
@@ -171,18 +187,21 @@ public class ParsePost {
int postType = Post.IMAGE_TYPE;
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
- formattedPostTime, postTimeMillis, title, url, thumbnailPreviewUrl, url, permalink,
- score, postType, voteType, nComments, flair, awards, hidden, spoiler,
- nsfw, stickied, archived, locked, saved, isCrosspost);
+ authorFlair, authorFlairHTML, formattedPostTime, postTimeMillis, title,
+ url, thumbnailPreviewUrl, url, permalink, score, postType, voteType,
+ nComments, flair, awards, hidden, spoiler, nsfw, stickied, archived,
+ locked, saved, isCrosspost);
post.setPreviewWidth(previewWidth);
post.setPreviewHeight(previewHeight);
} else {
//No preview link post
int postType = Post.NO_PREVIEW_LINK_TYPE;
- post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, formattedPostTime, postTimeMillis,
- title, previewUrl, thumbnailPreviewUrl, url, permalink, score, postType, voteType,
- nComments, flair, awards, hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost);
+ post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
+ authorFlair, authorFlairHTML, formattedPostTime, postTimeMillis,
+ title, previewUrl, thumbnailPreviewUrl, url, permalink, score, postType,
+ voteType, nComments, flair, awards, hidden, spoiler, nsfw, stickied,
+ archived, locked, saved, isCrosspost);
if (data.isNull(JSONUtils.SELFTEXT_KEY)) {
post.setSelfText("");
} else {
@@ -203,9 +222,11 @@ public class ParsePost {
String videoUrl = Html.fromHtml(redditVideoObject.getString(JSONUtils.HLS_URL_KEY)).toString();
String videoDownloadUrl = redditVideoObject.getString(JSONUtils.FALLBACK_URL_KEY);
- post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, formattedPostTime, postTimeMillis,
- title, previewUrl, thumbnailPreviewUrl, permalink, score, postType, voteType,
- nComments, flair, awards, hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost);
+ post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
+ authorFlair, authorFlairHTML, formattedPostTime, postTimeMillis, title,
+ previewUrl, thumbnailPreviewUrl, permalink, score, postType, voteType,
+ nComments, flair, awards, hidden, spoiler, nsfw, stickied, archived, locked,
+ saved, isCrosspost);
post.setPreviewWidth(previewWidth);
post.setPreviewHeight(previewHeight);
@@ -221,9 +242,10 @@ public class ParsePost {
.getJSONObject(JSONUtils.REDDIT_VIDEO_PREVIEW_KEY).getString(JSONUtils.FALLBACK_URL_KEY);
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
- formattedPostTime, postTimeMillis, title, previewUrl, thumbnailPreviewUrl, permalink, score,
- postType, voteType, nComments, flair, awards, hidden, spoiler, nsfw,
- stickied, archived, locked, saved, isCrosspost);
+ authorFlair, authorFlairHTML, formattedPostTime, postTimeMillis, title,
+ previewUrl, thumbnailPreviewUrl, permalink, score, postType, voteType,
+ nComments, flair, awards, hidden, spoiler, nsfw, stickied, archived,
+ locked, saved, isCrosspost);
post.setPreviewWidth(previewWidth);
post.setPreviewHeight(previewHeight);
post.setVideoUrl(videoUrl);
@@ -234,9 +256,10 @@ public class ParsePost {
int postType = Post.IMAGE_TYPE;
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
- formattedPostTime, postTimeMillis, title, url, thumbnailPreviewUrl, url, permalink,
- score, postType, voteType, nComments, flair, awards, hidden, spoiler,
- nsfw, stickied, archived, locked, saved, isCrosspost);
+ authorFlair, authorFlairHTML, formattedPostTime, postTimeMillis,
+ title, url, thumbnailPreviewUrl, url, permalink, score, postType,
+ voteType, nComments, flair, awards, hidden, spoiler, nsfw, stickied,
+ archived, locked, saved, isCrosspost);
post.setPreviewWidth(previewWidth);
post.setPreviewHeight(previewHeight);
@@ -244,8 +267,9 @@ public class ParsePost {
//Gif post
int postType = Post.GIF_TYPE;
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
- formattedPostTime, postTimeMillis, title, previewUrl, thumbnailPreviewUrl, url, permalink,
- score, postType, voteType, nComments, flair, awards, hidden, spoiler,
+ authorFlair, authorFlairHTML, formattedPostTime, postTimeMillis,
+ title, previewUrl, thumbnailPreviewUrl, url, permalink, score,
+ postType, voteType, nComments, flair, awards, hidden, spoiler,
nsfw, stickied, archived, locked, saved, isCrosspost);
post.setPreviewWidth(previewWidth);
@@ -257,9 +281,10 @@ public class ParsePost {
int postType = Post.TEXT_TYPE;
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
- formattedPostTime, postTimeMillis, title, permalink, score, postType,
- voteType, nComments, flair, awards, hidden, spoiler, nsfw, stickied,
- archived, locked, saved, isCrosspost);
+ authorFlair, authorFlairHTML, formattedPostTime, postTimeMillis,
+ title, permalink, score, postType, voteType, nComments, flair,
+ awards, hidden, spoiler, nsfw, stickied, archived, locked, saved,
+ isCrosspost);
post.setPreviewWidth(previewWidth);
post.setPreviewHeight(previewHeight);
@@ -285,8 +310,9 @@ public class ParsePost {
int postType = Post.LINK_TYPE;
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
- formattedPostTime, postTimeMillis, title, previewUrl, thumbnailPreviewUrl, url, permalink,
- score, postType, voteType, nComments, flair, awards, hidden, spoiler,
+ authorFlair, authorFlairHTML, formattedPostTime, postTimeMillis,
+ title, previewUrl, thumbnailPreviewUrl, url, permalink, score,
+ postType, voteType, nComments, flair, awards, hidden, spoiler,
nsfw, stickied, archived, locked, saved, isCrosspost);
if (data.isNull(JSONUtils.SELFTEXT_KEY)) {
post.setSelfText("");
@@ -305,9 +331,10 @@ public class ParsePost {
int postType = Post.IMAGE_TYPE;
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
- formattedPostTime, postTimeMillis, title, previewUrl, thumbnailPreviewUrl, url, permalink,
- score, postType, voteType, nComments, flair, awards, hidden, spoiler,
- nsfw, stickied, archived, locked, saved, isCrosspost);
+ authorFlair, authorFlairHTML, formattedPostTime, postTimeMillis, title,
+ previewUrl, thumbnailPreviewUrl, url, permalink, score, postType,
+ voteType, nComments, flair, awards, hidden, spoiler, nsfw, stickied,
+ archived, locked, saved, isCrosspost);
post.setPreviewWidth(previewWidth);
post.setPreviewHeight(previewHeight);
} else {
@@ -315,9 +342,10 @@ public class ParsePost {
int postType = Post.NO_PREVIEW_LINK_TYPE;
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
- formattedPostTime, postTimeMillis, title, url, thumbnailPreviewUrl, url, permalink, score,
- postType, voteType, nComments, flair, awards, hidden, spoiler, nsfw, stickied,
- archived, locked, saved, isCrosspost);
+ authorFlair, authorFlairHTML, formattedPostTime, postTimeMillis, title,
+ url, thumbnailPreviewUrl, url, permalink, score, postType, voteType,
+ nComments, flair, awards, hidden, spoiler, nsfw, stickied, archived,
+ locked, saved, isCrosspost);
}
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Post/Post.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Post/Post.java
index a224ee24..d16a19a1 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Post/Post.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Post/Post.java
@@ -36,6 +36,8 @@ public class Post implements Parcelable {
private String author;
private String authorNamePrefixed;
private String authorIconUrl;
+ private String authorFlair;
+ private String authorFlairHTML;
private String postTime;
private String title;
private String selfText;
@@ -67,17 +69,19 @@ public class Post implements Parcelable {
private String crosspostParentId;
public Post(String id, String fullName, String subredditName, String subredditNamePrefixed,
- String author, String postTime, long postTimeMillis, String title, String previewUrl,
- String thumbnailPreviewUrl, String permalink, int score, int postType,
- int voteType, int nComments, String flair, String awards, boolean hidden,
- boolean spoiler, boolean nsfw, boolean stickied, boolean archived, boolean locked,
- boolean saved, boolean isCrosspost) {
+ String author, String authorFlair, String authorFlairHTML, String postTime,
+ long postTimeMillis, String title, String previewUrl, String thumbnailPreviewUrl,
+ String permalink, int score, int postType, int voteType, int nComments, String flair,
+ String awards, boolean hidden, boolean spoiler, boolean nsfw, boolean stickied,
+ boolean archived, boolean locked, boolean saved, boolean isCrosspost) {
this.id = id;
this.fullName = fullName;
this.subredditName = subredditName;
this.subredditNamePrefixed = subredditNamePrefixed;
this.author = author;
this.authorNamePrefixed = "u/" + author;
+ this.authorFlair = authorFlair;
+ this.authorFlairHTML = authorFlairHTML;
this.postTime = postTime;
this.postTimeMillis = postTimeMillis;
this.title = title;
@@ -101,17 +105,19 @@ public class Post implements Parcelable {
}
public Post(String id, String fullName, String subredditName, String subredditNamePrefixed,
- String author, String postTime, long postTimeMillis, String title, String previewUrl,
- String thumbnailPreviewUrl, String url, String permalink, int score,
- int postType, int voteType, int nComments, String flair, String awards,
- boolean hidden, boolean spoiler, boolean nsfw, boolean stickied, boolean archived,
- boolean locked, boolean saved, boolean isCrosspost) {
+ String author, String authorFlair, String authorFlairHTML, String postTime,
+ long postTimeMillis, String title, String previewUrl, String thumbnailPreviewUrl,
+ String url, String permalink, int score, int postType, int voteType, int nComments,
+ String flair, String awards, boolean hidden, boolean spoiler, boolean nsfw,
+ boolean stickied, boolean archived, boolean locked, boolean saved, boolean isCrosspost) {
this.id = id;
this.fullName = fullName;
this.subredditName = subredditName;
this.subredditNamePrefixed = subredditNamePrefixed;
this.author = author;
this.authorNamePrefixed = "u/" + author;
+ this.authorFlair = authorFlair;
+ this.authorFlairHTML = authorFlairHTML;
this.postTime = postTime;
this.postTimeMillis = postTimeMillis;
this.title = title;
@@ -136,16 +142,19 @@ public class Post implements Parcelable {
}
public Post(String id, String fullName, String subredditName, String subredditNamePrefixed,
- String author, String postTime, long postTimeMillis, String title, String permalink,
- int score, int postType, int voteType, int nComments, String flair,
- String awards, boolean hidden, boolean spoiler, boolean nsfw, boolean stickied,
- boolean archived, boolean locked, boolean saved, boolean isCrosspost) {
+ String author, String authorFlair, String authorFlairHTML, String postTime,
+ long postTimeMillis, String title, String permalink, int score, int postType,
+ int voteType, int nComments, String flair, String awards, boolean hidden,
+ boolean spoiler, boolean nsfw, boolean stickied, boolean archived, boolean locked,
+ boolean saved, boolean isCrosspost) {
this.id = id;
this.fullName = fullName;
this.subredditName = subredditName;
this.subredditNamePrefixed = subredditNamePrefixed;
this.author = author;
this.authorNamePrefixed = "u/" + author;
+ this.authorFlair = authorFlair;
+ this.authorFlairHTML = authorFlairHTML;
this.postTime = postTime;
this.postTimeMillis = postTimeMillis;
this.title = title;
@@ -174,6 +183,8 @@ public class Post implements Parcelable {
subredditIconUrl = in.readString();
author = in.readString();
authorNamePrefixed = in.readString();
+ authorFlair = in.readString();
+ authorFlairHTML = in.readString();
authorIconUrl = in.readString();
postTime = in.readString();
postTimeMillis = in.readLong();
@@ -238,6 +249,14 @@ public class Post implements Parcelable {
return authorNamePrefixed;
}
+ public String getAuthorFlair() {
+ return authorFlair;
+ }
+
+ public String getAuthorFlairHTML() {
+ return authorFlairHTML;
+ }
+
public String getAuthorIconUrl() {
return authorIconUrl;
}
@@ -444,6 +463,8 @@ public class Post implements Parcelable {
parcel.writeString(subredditIconUrl);
parcel.writeString(author);
parcel.writeString(authorNamePrefixed);
+ parcel.writeString(authorFlair);
+ parcel.writeString(authorFlairHTML);
parcel.writeString(authorIconUrl);
parcel.writeString(postTime);
parcel.writeLong(postTimeMillis);