mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-02-26 20:43:58 +01:00
Show awards for comments.
This commit is contained in:
parent
f0125edd23
commit
504b005cf7
@ -871,6 +871,18 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
((CommentViewHolder) holder).topScoreTextView.setVisibility(View.GONE);
|
((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());
|
mCommentMarkwon.setMarkdown(((CommentViewHolder) holder).commentMarkdownView, comment.getCommentMarkdown());
|
||||||
((CommentViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
|
((CommentViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes,
|
||||||
comment.getScore() + comment.getVoteType()));
|
comment.getScore() + comment.getVoteType()));
|
||||||
@ -1749,6 +1761,8 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
mGlide.clear(((CommentViewHolder) holder).authorTypeImageView);
|
mGlide.clear(((CommentViewHolder) holder).authorTypeImageView);
|
||||||
((CommentViewHolder) holder).authorFlairTextView.setVisibility(View.GONE);
|
((CommentViewHolder) holder).authorFlairTextView.setVisibility(View.GONE);
|
||||||
((CommentViewHolder) holder).authorTypeImageView.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).expandButton.setVisibility(View.GONE);
|
||||||
((CommentViewHolder) holder).upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
((CommentViewHolder) holder).upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||||
((CommentViewHolder) holder).scoreTextView.setTextColor(mCommentIconAndInfoColor);
|
((CommentViewHolder) holder).scoreTextView.setTextColor(mCommentIconAndInfoColor);
|
||||||
@ -2124,6 +2138,8 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
TextView commentTimeTextView;
|
TextView commentTimeTextView;
|
||||||
@BindView(R.id.top_score_text_view_item_post_comment)
|
@BindView(R.id.top_score_text_view_item_post_comment)
|
||||||
TextView topScoreTextView;
|
TextView topScoreTextView;
|
||||||
|
@BindView(R.id.awards_text_view_item_comment)
|
||||||
|
TextView awardsTextView;
|
||||||
@BindView(R.id.comment_markdown_view_item_post_comment)
|
@BindView(R.id.comment_markdown_view_item_post_comment)
|
||||||
TextView commentMarkdownView;
|
TextView commentMarkdownView;
|
||||||
@BindView(R.id.bottom_constraint_layout_item_post_comment)
|
@BindView(R.id.bottom_constraint_layout_item_post_comment)
|
||||||
@ -2182,6 +2198,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
commentMarkdownView.setTextColor(mCommentTextColor);
|
commentMarkdownView.setTextColor(mCommentTextColor);
|
||||||
authorFlairTextView.setTextColor(mAuthorFlairTextColor);
|
authorFlairTextView.setTextColor(mAuthorFlairTextColor);
|
||||||
topScoreTextView.setTextColor(mSecondaryTextColor);
|
topScoreTextView.setTextColor(mSecondaryTextColor);
|
||||||
|
awardsTextView.setTextColor(mCommentTextColor);
|
||||||
commentDivider.setBackgroundColor(mDividerColor);
|
commentDivider.setBackgroundColor(mDividerColor);
|
||||||
upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||||
scoreTextView.setTextColor(mCommentIconAndInfoColor);
|
scoreTextView.setTextColor(mCommentIconAndInfoColor);
|
||||||
|
@ -40,6 +40,7 @@ public class CommentData implements Parcelable {
|
|||||||
private boolean isSubmitter;
|
private boolean isSubmitter;
|
||||||
private String distinguished;
|
private String distinguished;
|
||||||
private String permalink;
|
private String permalink;
|
||||||
|
private String awards;
|
||||||
private int depth;
|
private int depth;
|
||||||
private boolean collapsed;
|
private boolean collapsed;
|
||||||
private boolean hasReply;
|
private boolean hasReply;
|
||||||
@ -56,9 +57,10 @@ public class CommentData implements Parcelable {
|
|||||||
public CommentData(String id, String fullName, String author, String authorFlair,
|
public CommentData(String id, String fullName, String author, String authorFlair,
|
||||||
String authorFlairHTML, String linkAuthor, String commentTime,
|
String authorFlairHTML, String linkAuthor, String commentTime,
|
||||||
long commentTimeMillis, String commentMarkdown, String commentRawText,
|
long commentTimeMillis, String commentMarkdown, String commentRawText,
|
||||||
String linkId, String subredditName, String parentId, int score, int voteType,
|
String linkId, String subredditName, String parentId, int score,
|
||||||
boolean isSubmitter, String distinguished, String permalink, int depth,
|
int voteType, boolean isSubmitter, String distinguished, String permalink,
|
||||||
boolean collapsed, boolean hasReply, boolean scoreHidden, boolean saved) {
|
String awards, int depth, boolean collapsed, boolean hasReply,
|
||||||
|
boolean scoreHidden, boolean saved) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.fullName = fullName;
|
this.fullName = fullName;
|
||||||
this.author = author;
|
this.author = author;
|
||||||
@ -77,6 +79,7 @@ public class CommentData implements Parcelable {
|
|||||||
this.isSubmitter = isSubmitter;
|
this.isSubmitter = isSubmitter;
|
||||||
this.distinguished = distinguished;
|
this.distinguished = distinguished;
|
||||||
this.permalink = RedditUtils.API_BASE_URI + permalink;
|
this.permalink = RedditUtils.API_BASE_URI + permalink;
|
||||||
|
this.awards = awards;
|
||||||
this.depth = depth;
|
this.depth = depth;
|
||||||
this.collapsed = collapsed;
|
this.collapsed = collapsed;
|
||||||
this.hasReply = hasReply;
|
this.hasReply = hasReply;
|
||||||
@ -114,6 +117,7 @@ public class CommentData implements Parcelable {
|
|||||||
isSubmitter = in.readByte() != 0;
|
isSubmitter = in.readByte() != 0;
|
||||||
distinguished = in.readString();
|
distinguished = in.readString();
|
||||||
permalink = in.readString();
|
permalink = in.readString();
|
||||||
|
awards = in.readString();
|
||||||
depth = in.readInt();
|
depth = in.readInt();
|
||||||
collapsed = in.readByte() != 0;
|
collapsed = in.readByte() != 0;
|
||||||
hasReply = in.readByte() != 0;
|
hasReply = in.readByte() != 0;
|
||||||
@ -215,6 +219,10 @@ public class CommentData implements Parcelable {
|
|||||||
return permalink;
|
return permalink;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getAwards() {
|
||||||
|
return awards;
|
||||||
|
}
|
||||||
|
|
||||||
public int getDepth() {
|
public int getDepth() {
|
||||||
return depth;
|
return depth;
|
||||||
}
|
}
|
||||||
@ -359,6 +367,7 @@ public class CommentData implements Parcelable {
|
|||||||
parcel.writeByte((byte) (isSubmitter ? 1 : 0));
|
parcel.writeByte((byte) (isSubmitter ? 1 : 0));
|
||||||
parcel.writeString(distinguished);
|
parcel.writeString(distinguished);
|
||||||
parcel.writeString(permalink);
|
parcel.writeString(permalink);
|
||||||
|
parcel.writeString(awards);
|
||||||
parcel.writeInt(depth);
|
parcel.writeInt(depth);
|
||||||
parcel.writeByte((byte) (collapsed ? 1 : 0));
|
parcel.writeByte((byte) (collapsed ? 1 : 0));
|
||||||
parcel.writeByte((byte) (hasReply ? 1 : 0));
|
parcel.writeByte((byte) (hasReply ? 1 : 0));
|
||||||
|
@ -145,6 +145,20 @@ public class ParseComment {
|
|||||||
String commentRawText = Utils.trimTrailingWhitespace(
|
String commentRawText = Utils.trimTrailingWhitespace(
|
||||||
Html.fromHtml(singleCommentData.getString(JSONUtils.BODY_HTML_KEY))).toString();
|
Html.fromHtml(singleCommentData.getString(JSONUtils.BODY_HTML_KEY))).toString();
|
||||||
String permalink = Html.fromHtml(singleCommentData.getString(JSONUtils.PERMALINK_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 score = singleCommentData.getInt(JSONUtils.SCORE_KEY);
|
||||||
int voteType;
|
int voteType;
|
||||||
if (singleCommentData.isNull(JSONUtils.LIKES_KEY)) {
|
if (singleCommentData.isNull(JSONUtils.LIKES_KEY)) {
|
||||||
@ -169,10 +183,10 @@ public class ParseComment {
|
|||||||
boolean collapsed = singleCommentData.getBoolean(JSONUtils.COLLAPSED_KEY);
|
boolean collapsed = singleCommentData.getBoolean(JSONUtils.COLLAPSED_KEY);
|
||||||
boolean hasReply = !(singleCommentData.get(JSONUtils.REPLIES_KEY) instanceof String);
|
boolean hasReply = !(singleCommentData.get(JSONUtils.REPLIES_KEY) instanceof String);
|
||||||
|
|
||||||
return new CommentData(id, fullName, author, authorFlair, authorFlairHTMLBuilder.toString(), linkAuthor,
|
return new CommentData(id, fullName, author, authorFlair, authorFlairHTMLBuilder.toString(),
|
||||||
formattedSubmitTime, submitTime, commentMarkdown, commentRawText, linkId, subredditName,
|
linkAuthor, formattedSubmitTime, submitTime, commentMarkdown, commentRawText,
|
||||||
parentId, score, voteType, isSubmitter, distinguished, permalink, depth, collapsed,
|
linkId, subredditName, parentId, score, voteType, isSubmitter, distinguished,
|
||||||
hasReply, scoreHidden, saved);
|
permalink, awardingsBuilder.toString(),depth, collapsed, hasReply, scoreHidden, saved);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -37,6 +37,20 @@ public class ParsePost {
|
|||||||
String subredditName = data.getString(JSONUtils.SUBREDDIT_KEY);
|
String subredditName = data.getString(JSONUtils.SUBREDDIT_KEY);
|
||||||
String subredditNamePrefixed = data.getString(JSONUtils.SUBREDDIT_NAME_PREFIX_KEY);
|
String subredditNamePrefixed = data.getString(JSONUtils.SUBREDDIT_NAME_PREFIX_KEY);
|
||||||
String author = data.getString(JSONUtils.AUTHOR_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;
|
long postTime = data.getLong(JSONUtils.CREATED_UTC_KEY) * 1000;
|
||||||
String title = data.getString(JSONUtils.TITLE_KEY);
|
String title = data.getString(JSONUtils.TITLE_KEY);
|
||||||
int score = data.getInt(JSONUtils.SCORE_KEY);
|
int score = data.getInt(JSONUtils.SCORE_KEY);
|
||||||
@ -71,10 +85,10 @@ public class ParsePost {
|
|||||||
JSONArray icons = award.getJSONArray(JSONUtils.RESIZED_ICONS_KEY);
|
JSONArray icons = award.getJSONArray(JSONUtils.RESIZED_ICONS_KEY);
|
||||||
if (icons.length() > 4) {
|
if (icons.length() > 4) {
|
||||||
String iconUrl = icons.getJSONObject(3).getString(JSONUtils.URL_KEY);
|
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) {
|
} else if (icons.length() > 0) {
|
||||||
String iconUrl = icons.getJSONObject(icons.length() - 1).getString(JSONUtils.URL_KEY);
|
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);
|
data = data.getJSONArray(JSONUtils.CROSSPOST_PARENT_LIST).getJSONObject(0);
|
||||||
Post crosspostParent = parseBasicData(data, locale);
|
Post crosspostParent = parseBasicData(data, locale);
|
||||||
Post post = parseData(data, permalink, id, fullName, subredditName, subredditNamePrefixed,
|
Post post = parseData(data, permalink, id, fullName, subredditName, subredditNamePrefixed,
|
||||||
author, formattedPostTime, postTime, title, previewUrl, thumbnailPreviewUrl,
|
author, authorFlair, authorFlairHTMLBuilder.toString(), formattedPostTime,
|
||||||
previewWidth, previewHeight, score, voteType, nComments, flair,
|
postTime, title, previewUrl, thumbnailPreviewUrl, previewWidth, previewHeight,
|
||||||
awardingsBuilder.toString(), hidden, spoiler, nsfw, stickied, archived, locked,
|
score, voteType, nComments, flair, awardingsBuilder.toString(), hidden, spoiler,
|
||||||
saved, true);
|
nsfw, stickied, archived, locked, saved, true);
|
||||||
post.setCrosspostParentId(crosspostParent.getId());
|
post.setCrosspostParentId(crosspostParent.getId());
|
||||||
return post;
|
return post;
|
||||||
} else {
|
} else {
|
||||||
return parseData(data, permalink, id, fullName, subredditName, subredditNamePrefixed,
|
return parseData(data, permalink, id, fullName, subredditName, subredditNamePrefixed,
|
||||||
author, formattedPostTime, postTime, title, previewUrl, thumbnailPreviewUrl,
|
author, authorFlair, authorFlairHTMLBuilder.toString(), formattedPostTime,
|
||||||
previewWidth, previewHeight, score, voteType, nComments, flair,
|
postTime, title, previewUrl, thumbnailPreviewUrl, previewWidth, previewHeight,
|
||||||
awardingsBuilder.toString(), hidden, spoiler, nsfw, stickied, archived, locked,
|
score, voteType, nComments, flair, awardingsBuilder.toString(), hidden, spoiler,
|
||||||
saved, false);
|
nsfw, stickied, archived, locked, saved, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Post parseData(JSONObject data, String permalink, String id, String fullName,
|
private static Post parseData(JSONObject data, String permalink, String id, String fullName,
|
||||||
String subredditName, String subredditNamePrefixed, String author,
|
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,
|
String thumbnailPreviewUrl, int previewWidth, int previewHeight,
|
||||||
int score, int voteType, int nComments, String flair,
|
int score, int voteType, int nComments, String flair,
|
||||||
String awards, boolean hidden, boolean spoiler, boolean nsfw, boolean stickied,
|
String awards, boolean hidden, boolean spoiler, boolean nsfw, boolean stickied,
|
||||||
@ -146,7 +161,8 @@ public class ParsePost {
|
|||||||
if (url.contains(permalink)) {
|
if (url.contains(permalink)) {
|
||||||
//Text post
|
//Text post
|
||||||
int postType = Post.TEXT_TYPE;
|
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,
|
title, permalink, score, postType, voteType, nComments, flair, awards,
|
||||||
hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost);
|
hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost);
|
||||||
if (data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
if (data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
||||||
@ -171,18 +187,21 @@ public class ParsePost {
|
|||||||
int postType = Post.IMAGE_TYPE;
|
int postType = Post.IMAGE_TYPE;
|
||||||
|
|
||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
|
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
|
||||||
formattedPostTime, postTimeMillis, title, url, thumbnailPreviewUrl, url, permalink,
|
authorFlair, authorFlairHTML, formattedPostTime, postTimeMillis, title,
|
||||||
score, postType, voteType, nComments, flair, awards, hidden, spoiler,
|
url, thumbnailPreviewUrl, url, permalink, score, postType, voteType,
|
||||||
nsfw, stickied, archived, locked, saved, isCrosspost);
|
nComments, flair, awards, hidden, spoiler, nsfw, stickied, archived,
|
||||||
|
locked, saved, isCrosspost);
|
||||||
|
|
||||||
post.setPreviewWidth(previewWidth);
|
post.setPreviewWidth(previewWidth);
|
||||||
post.setPreviewHeight(previewHeight);
|
post.setPreviewHeight(previewHeight);
|
||||||
} else {
|
} else {
|
||||||
//No preview link post
|
//No preview link post
|
||||||
int postType = Post.NO_PREVIEW_LINK_TYPE;
|
int postType = Post.NO_PREVIEW_LINK_TYPE;
|
||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, formattedPostTime, postTimeMillis,
|
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
|
||||||
title, previewUrl, thumbnailPreviewUrl, url, permalink, score, postType, voteType,
|
authorFlair, authorFlairHTML, formattedPostTime, postTimeMillis,
|
||||||
nComments, flair, awards, hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost);
|
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)) {
|
if (data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
||||||
post.setSelfText("");
|
post.setSelfText("");
|
||||||
} else {
|
} else {
|
||||||
@ -203,9 +222,11 @@ public class ParsePost {
|
|||||||
String videoUrl = Html.fromHtml(redditVideoObject.getString(JSONUtils.HLS_URL_KEY)).toString();
|
String videoUrl = Html.fromHtml(redditVideoObject.getString(JSONUtils.HLS_URL_KEY)).toString();
|
||||||
String videoDownloadUrl = redditVideoObject.getString(JSONUtils.FALLBACK_URL_KEY);
|
String videoDownloadUrl = redditVideoObject.getString(JSONUtils.FALLBACK_URL_KEY);
|
||||||
|
|
||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, formattedPostTime, postTimeMillis,
|
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
|
||||||
title, previewUrl, thumbnailPreviewUrl, permalink, score, postType, voteType,
|
authorFlair, authorFlairHTML, formattedPostTime, postTimeMillis, title,
|
||||||
nComments, flair, awards, hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost);
|
previewUrl, thumbnailPreviewUrl, permalink, score, postType, voteType,
|
||||||
|
nComments, flair, awards, hidden, spoiler, nsfw, stickied, archived, locked,
|
||||||
|
saved, isCrosspost);
|
||||||
|
|
||||||
post.setPreviewWidth(previewWidth);
|
post.setPreviewWidth(previewWidth);
|
||||||
post.setPreviewHeight(previewHeight);
|
post.setPreviewHeight(previewHeight);
|
||||||
@ -221,9 +242,10 @@ public class ParsePost {
|
|||||||
.getJSONObject(JSONUtils.REDDIT_VIDEO_PREVIEW_KEY).getString(JSONUtils.FALLBACK_URL_KEY);
|
.getJSONObject(JSONUtils.REDDIT_VIDEO_PREVIEW_KEY).getString(JSONUtils.FALLBACK_URL_KEY);
|
||||||
|
|
||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
|
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
|
||||||
formattedPostTime, postTimeMillis, title, previewUrl, thumbnailPreviewUrl, permalink, score,
|
authorFlair, authorFlairHTML, formattedPostTime, postTimeMillis, title,
|
||||||
postType, voteType, nComments, flair, awards, hidden, spoiler, nsfw,
|
previewUrl, thumbnailPreviewUrl, permalink, score, postType, voteType,
|
||||||
stickied, archived, locked, saved, isCrosspost);
|
nComments, flair, awards, hidden, spoiler, nsfw, stickied, archived,
|
||||||
|
locked, saved, isCrosspost);
|
||||||
post.setPreviewWidth(previewWidth);
|
post.setPreviewWidth(previewWidth);
|
||||||
post.setPreviewHeight(previewHeight);
|
post.setPreviewHeight(previewHeight);
|
||||||
post.setVideoUrl(videoUrl);
|
post.setVideoUrl(videoUrl);
|
||||||
@ -234,9 +256,10 @@ public class ParsePost {
|
|||||||
int postType = Post.IMAGE_TYPE;
|
int postType = Post.IMAGE_TYPE;
|
||||||
|
|
||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
|
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
|
||||||
formattedPostTime, postTimeMillis, title, url, thumbnailPreviewUrl, url, permalink,
|
authorFlair, authorFlairHTML, formattedPostTime, postTimeMillis,
|
||||||
score, postType, voteType, nComments, flair, awards, hidden, spoiler,
|
title, url, thumbnailPreviewUrl, url, permalink, score, postType,
|
||||||
nsfw, stickied, archived, locked, saved, isCrosspost);
|
voteType, nComments, flair, awards, hidden, spoiler, nsfw, stickied,
|
||||||
|
archived, locked, saved, isCrosspost);
|
||||||
|
|
||||||
post.setPreviewWidth(previewWidth);
|
post.setPreviewWidth(previewWidth);
|
||||||
post.setPreviewHeight(previewHeight);
|
post.setPreviewHeight(previewHeight);
|
||||||
@ -244,8 +267,9 @@ public class ParsePost {
|
|||||||
//Gif post
|
//Gif post
|
||||||
int postType = Post.GIF_TYPE;
|
int postType = Post.GIF_TYPE;
|
||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
|
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
|
||||||
formattedPostTime, postTimeMillis, title, previewUrl, thumbnailPreviewUrl, url, permalink,
|
authorFlair, authorFlairHTML, formattedPostTime, postTimeMillis,
|
||||||
score, postType, voteType, nComments, flair, awards, hidden, spoiler,
|
title, previewUrl, thumbnailPreviewUrl, url, permalink, score,
|
||||||
|
postType, voteType, nComments, flair, awards, hidden, spoiler,
|
||||||
nsfw, stickied, archived, locked, saved, isCrosspost);
|
nsfw, stickied, archived, locked, saved, isCrosspost);
|
||||||
|
|
||||||
post.setPreviewWidth(previewWidth);
|
post.setPreviewWidth(previewWidth);
|
||||||
@ -257,9 +281,10 @@ public class ParsePost {
|
|||||||
int postType = Post.TEXT_TYPE;
|
int postType = Post.TEXT_TYPE;
|
||||||
|
|
||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
|
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
|
||||||
formattedPostTime, postTimeMillis, title, permalink, score, postType,
|
authorFlair, authorFlairHTML, formattedPostTime, postTimeMillis,
|
||||||
voteType, nComments, flair, awards, hidden, spoiler, nsfw, stickied,
|
title, permalink, score, postType, voteType, nComments, flair,
|
||||||
archived, locked, saved, isCrosspost);
|
awards, hidden, spoiler, nsfw, stickied, archived, locked, saved,
|
||||||
|
isCrosspost);
|
||||||
|
|
||||||
post.setPreviewWidth(previewWidth);
|
post.setPreviewWidth(previewWidth);
|
||||||
post.setPreviewHeight(previewHeight);
|
post.setPreviewHeight(previewHeight);
|
||||||
@ -285,8 +310,9 @@ public class ParsePost {
|
|||||||
int postType = Post.LINK_TYPE;
|
int postType = Post.LINK_TYPE;
|
||||||
|
|
||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
|
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
|
||||||
formattedPostTime, postTimeMillis, title, previewUrl, thumbnailPreviewUrl, url, permalink,
|
authorFlair, authorFlairHTML, formattedPostTime, postTimeMillis,
|
||||||
score, postType, voteType, nComments, flair, awards, hidden, spoiler,
|
title, previewUrl, thumbnailPreviewUrl, url, permalink, score,
|
||||||
|
postType, voteType, nComments, flair, awards, hidden, spoiler,
|
||||||
nsfw, stickied, archived, locked, saved, isCrosspost);
|
nsfw, stickied, archived, locked, saved, isCrosspost);
|
||||||
if (data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
if (data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
||||||
post.setSelfText("");
|
post.setSelfText("");
|
||||||
@ -305,9 +331,10 @@ public class ParsePost {
|
|||||||
int postType = Post.IMAGE_TYPE;
|
int postType = Post.IMAGE_TYPE;
|
||||||
|
|
||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
|
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
|
||||||
formattedPostTime, postTimeMillis, title, previewUrl, thumbnailPreviewUrl, url, permalink,
|
authorFlair, authorFlairHTML, formattedPostTime, postTimeMillis, title,
|
||||||
score, postType, voteType, nComments, flair, awards, hidden, spoiler,
|
previewUrl, thumbnailPreviewUrl, url, permalink, score, postType,
|
||||||
nsfw, stickied, archived, locked, saved, isCrosspost);
|
voteType, nComments, flair, awards, hidden, spoiler, nsfw, stickied,
|
||||||
|
archived, locked, saved, isCrosspost);
|
||||||
post.setPreviewWidth(previewWidth);
|
post.setPreviewWidth(previewWidth);
|
||||||
post.setPreviewHeight(previewHeight);
|
post.setPreviewHeight(previewHeight);
|
||||||
} else {
|
} else {
|
||||||
@ -315,9 +342,10 @@ public class ParsePost {
|
|||||||
int postType = Post.NO_PREVIEW_LINK_TYPE;
|
int postType = Post.NO_PREVIEW_LINK_TYPE;
|
||||||
|
|
||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
|
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
|
||||||
formattedPostTime, postTimeMillis, title, url, thumbnailPreviewUrl, url, permalink, score,
|
authorFlair, authorFlairHTML, formattedPostTime, postTimeMillis, title,
|
||||||
postType, voteType, nComments, flair, awards, hidden, spoiler, nsfw, stickied,
|
url, thumbnailPreviewUrl, url, permalink, score, postType, voteType,
|
||||||
archived, locked, saved, isCrosspost);
|
nComments, flair, awards, hidden, spoiler, nsfw, stickied, archived,
|
||||||
|
locked, saved, isCrosspost);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,8 @@ public class Post implements Parcelable {
|
|||||||
private String author;
|
private String author;
|
||||||
private String authorNamePrefixed;
|
private String authorNamePrefixed;
|
||||||
private String authorIconUrl;
|
private String authorIconUrl;
|
||||||
|
private String authorFlair;
|
||||||
|
private String authorFlairHTML;
|
||||||
private String postTime;
|
private String postTime;
|
||||||
private String title;
|
private String title;
|
||||||
private String selfText;
|
private String selfText;
|
||||||
@ -67,17 +69,19 @@ public class Post implements Parcelable {
|
|||||||
private String crosspostParentId;
|
private String crosspostParentId;
|
||||||
|
|
||||||
public Post(String id, String fullName, String subredditName, String subredditNamePrefixed,
|
public Post(String id, String fullName, String subredditName, String subredditNamePrefixed,
|
||||||
String author, String postTime, long postTimeMillis, String title, String previewUrl,
|
String author, String authorFlair, String authorFlairHTML, String postTime,
|
||||||
String thumbnailPreviewUrl, String permalink, int score, int postType,
|
long postTimeMillis, String title, String previewUrl, String thumbnailPreviewUrl,
|
||||||
int voteType, int nComments, String flair, String awards, boolean hidden,
|
String permalink, int score, int postType, int voteType, int nComments, String flair,
|
||||||
boolean spoiler, boolean nsfw, boolean stickied, boolean archived, boolean locked,
|
String awards, boolean hidden, boolean spoiler, boolean nsfw, boolean stickied,
|
||||||
boolean saved, boolean isCrosspost) {
|
boolean archived, boolean locked, boolean saved, boolean isCrosspost) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.fullName = fullName;
|
this.fullName = fullName;
|
||||||
this.subredditName = subredditName;
|
this.subredditName = subredditName;
|
||||||
this.subredditNamePrefixed = subredditNamePrefixed;
|
this.subredditNamePrefixed = subredditNamePrefixed;
|
||||||
this.author = author;
|
this.author = author;
|
||||||
this.authorNamePrefixed = "u/" + author;
|
this.authorNamePrefixed = "u/" + author;
|
||||||
|
this.authorFlair = authorFlair;
|
||||||
|
this.authorFlairHTML = authorFlairHTML;
|
||||||
this.postTime = postTime;
|
this.postTime = postTime;
|
||||||
this.postTimeMillis = postTimeMillis;
|
this.postTimeMillis = postTimeMillis;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
@ -101,17 +105,19 @@ public class Post implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Post(String id, String fullName, String subredditName, String subredditNamePrefixed,
|
public Post(String id, String fullName, String subredditName, String subredditNamePrefixed,
|
||||||
String author, String postTime, long postTimeMillis, String title, String previewUrl,
|
String author, String authorFlair, String authorFlairHTML, String postTime,
|
||||||
String thumbnailPreviewUrl, String url, String permalink, int score,
|
long postTimeMillis, String title, String previewUrl, String thumbnailPreviewUrl,
|
||||||
int postType, int voteType, int nComments, String flair, String awards,
|
String url, String permalink, int score, int postType, int voteType, int nComments,
|
||||||
boolean hidden, boolean spoiler, boolean nsfw, boolean stickied, boolean archived,
|
String flair, String awards, boolean hidden, boolean spoiler, boolean nsfw,
|
||||||
boolean locked, boolean saved, boolean isCrosspost) {
|
boolean stickied, boolean archived, boolean locked, boolean saved, boolean isCrosspost) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.fullName = fullName;
|
this.fullName = fullName;
|
||||||
this.subredditName = subredditName;
|
this.subredditName = subredditName;
|
||||||
this.subredditNamePrefixed = subredditNamePrefixed;
|
this.subredditNamePrefixed = subredditNamePrefixed;
|
||||||
this.author = author;
|
this.author = author;
|
||||||
this.authorNamePrefixed = "u/" + author;
|
this.authorNamePrefixed = "u/" + author;
|
||||||
|
this.authorFlair = authorFlair;
|
||||||
|
this.authorFlairHTML = authorFlairHTML;
|
||||||
this.postTime = postTime;
|
this.postTime = postTime;
|
||||||
this.postTimeMillis = postTimeMillis;
|
this.postTimeMillis = postTimeMillis;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
@ -136,16 +142,19 @@ public class Post implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Post(String id, String fullName, String subredditName, String subredditNamePrefixed,
|
public Post(String id, String fullName, String subredditName, String subredditNamePrefixed,
|
||||||
String author, String postTime, long postTimeMillis, String title, String permalink,
|
String author, String authorFlair, String authorFlairHTML, String postTime,
|
||||||
int score, int postType, int voteType, int nComments, String flair,
|
long postTimeMillis, String title, String permalink, int score, int postType,
|
||||||
String awards, boolean hidden, boolean spoiler, boolean nsfw, boolean stickied,
|
int voteType, int nComments, String flair, String awards, boolean hidden,
|
||||||
boolean archived, boolean locked, boolean saved, boolean isCrosspost) {
|
boolean spoiler, boolean nsfw, boolean stickied, boolean archived, boolean locked,
|
||||||
|
boolean saved, boolean isCrosspost) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.fullName = fullName;
|
this.fullName = fullName;
|
||||||
this.subredditName = subredditName;
|
this.subredditName = subredditName;
|
||||||
this.subredditNamePrefixed = subredditNamePrefixed;
|
this.subredditNamePrefixed = subredditNamePrefixed;
|
||||||
this.author = author;
|
this.author = author;
|
||||||
this.authorNamePrefixed = "u/" + author;
|
this.authorNamePrefixed = "u/" + author;
|
||||||
|
this.authorFlair = authorFlair;
|
||||||
|
this.authorFlairHTML = authorFlairHTML;
|
||||||
this.postTime = postTime;
|
this.postTime = postTime;
|
||||||
this.postTimeMillis = postTimeMillis;
|
this.postTimeMillis = postTimeMillis;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
@ -174,6 +183,8 @@ public class Post implements Parcelable {
|
|||||||
subredditIconUrl = in.readString();
|
subredditIconUrl = in.readString();
|
||||||
author = in.readString();
|
author = in.readString();
|
||||||
authorNamePrefixed = in.readString();
|
authorNamePrefixed = in.readString();
|
||||||
|
authorFlair = in.readString();
|
||||||
|
authorFlairHTML = in.readString();
|
||||||
authorIconUrl = in.readString();
|
authorIconUrl = in.readString();
|
||||||
postTime = in.readString();
|
postTime = in.readString();
|
||||||
postTimeMillis = in.readLong();
|
postTimeMillis = in.readLong();
|
||||||
@ -238,6 +249,14 @@ public class Post implements Parcelable {
|
|||||||
return authorNamePrefixed;
|
return authorNamePrefixed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getAuthorFlair() {
|
||||||
|
return authorFlair;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAuthorFlairHTML() {
|
||||||
|
return authorFlairHTML;
|
||||||
|
}
|
||||||
|
|
||||||
public String getAuthorIconUrl() {
|
public String getAuthorIconUrl() {
|
||||||
return authorIconUrl;
|
return authorIconUrl;
|
||||||
}
|
}
|
||||||
@ -444,6 +463,8 @@ public class Post implements Parcelable {
|
|||||||
parcel.writeString(subredditIconUrl);
|
parcel.writeString(subredditIconUrl);
|
||||||
parcel.writeString(author);
|
parcel.writeString(author);
|
||||||
parcel.writeString(authorNamePrefixed);
|
parcel.writeString(authorNamePrefixed);
|
||||||
|
parcel.writeString(authorFlair);
|
||||||
|
parcel.writeString(authorFlairHTML);
|
||||||
parcel.writeString(authorIconUrl);
|
parcel.writeString(authorIconUrl);
|
||||||
parcel.writeString(postTime);
|
parcel.writeString(postTime);
|
||||||
parcel.writeLong(postTimeMillis);
|
parcel.writeLong(postTimeMillis);
|
||||||
|
@ -99,6 +99,15 @@
|
|||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/awards_text_view_item_comment"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:paddingStart="16dp"
|
||||||
|
android:paddingEnd="16dp"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/comment_markdown_view_item_post_comment"
|
android:id="@+id/comment_markdown_view_item_post_comment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user