diff options
Diffstat (limited to 'app/src/main/java/ml/docilealligator/infinityforreddit')
11 files changed, 25 insertions, 191 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java index e88f9e22..bd2d6ed4 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java @@ -421,15 +421,6 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele } } - private void awardGiven(String awardsHTML, int awardCount, int position) { - if (sectionsPagerAdapter != null) { - ViewPostDetailFragment fragment = sectionsPagerAdapter.getCurrentFragment(); - if (fragment != null) { - fragment.awardGiven(awardsHTML, awardCount, position); - } - } - } - public void deleteComment(String fullName, int position) { if (sectionsPagerAdapter != null) { ViewPostDetailFragment fragment = sectionsPagerAdapter.getCurrentFragment(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java index d947a370..f9a445dd 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java @@ -240,11 +240,6 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment ((CommentBaseViewHolder) holder).commentTimeTextView.setText(Utils.getFormattedTime(mLocale, comment.getCommentTimeMillis(), mTimeFormatPattern)); } - if (comment.getAwards() != null && !comment.getAwards().equals("")) { - ((CommentBaseViewHolder) holder).awardsTextView.setVisibility(View.VISIBLE); - Utils.setHTMLWithImageToTextView(((CommentBaseViewHolder) holder).awardsTextView, comment.getAwards(), true); - } - mEmoteCloseBracketInlineProcessor.setMediaMetadataMap(comment.getMediaMetadataMap()); mImageAndGifPlugin.setMediaMetadataMap(comment.getMediaMetadataMap()); ((CommentBaseViewHolder) holder).markwonAdapter.setMarkdown(mMarkwon, comment.getCommentMarkdown()); @@ -301,8 +296,6 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment if (holder instanceof CommentBaseViewHolder) { ((CommentBaseViewHolder) holder).authorFlairTextView.setText(""); ((CommentBaseViewHolder) holder).authorFlairTextView.setVisibility(View.GONE); - ((CommentBaseViewHolder) holder).awardsTextView.setText(""); - ((CommentBaseViewHolder) holder).awardsTextView.setVisibility(View.GONE); ((CommentBaseViewHolder) holder).upvoteButton.setIconResource(R.drawable.ic_upvote_24dp); ((CommentBaseViewHolder) holder).upvoteButton.setIconTint(ColorStateList.valueOf(mCommentIconAndInfoColor)); ((CommentBaseViewHolder) holder).scoreTextView.setTextColor(mCommentIconAndInfoColor); @@ -378,7 +371,6 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment TextView authorTextView; TextView authorFlairTextView; TextView commentTimeTextView; - TextView awardsTextView; RecyclerView commentMarkdownView; ConstraintLayout bottomConstraintLayout; MaterialButton upvoteButton; @@ -399,7 +391,6 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment TextView authorTextView, TextView authorFlairTextView, TextView commentTimeTextView, - TextView awardsTextView, RecyclerView commentMarkdownView, ConstraintLayout bottomConstraintLayout, MaterialButton upvoteButton, @@ -416,7 +407,6 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment this.authorTextView = authorTextView; this.authorFlairTextView = authorFlairTextView; this.commentTimeTextView = commentTimeTextView; - this.awardsTextView = awardsTextView; this.commentMarkdownView = commentMarkdownView; this.bottomConstraintLayout = bottomConstraintLayout; this.upvoteButton = upvoteButton; @@ -481,14 +471,12 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment authorTextView.setTypeface(mActivity.typeface); authorFlairTextView.setTypeface(mActivity.typeface); commentTimeTextView.setTypeface(mActivity.typeface); - awardsTextView.setTypeface(mActivity.typeface); upvoteButton.setTypeface(mActivity.typeface); } itemView.setBackgroundColor(mCommentBackgroundColor); authorTextView.setTextColor(mUsernameColor); authorFlairTextView.setTextColor(mAuthorFlairColor); commentTimeTextView.setTextColor(mSecondaryTextColor); - awardsTextView.setTextColor(mSecondaryTextColor); upvoteButton.setIconTint(ColorStateList.valueOf(mCommentIconAndInfoColor)); scoreTextView.setTextColor(mCommentIconAndInfoColor); downvoteButton.setIconTint(ColorStateList.valueOf(mCommentIconAndInfoColor)); @@ -793,7 +781,6 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment binding.authorTextViewItemPostComment, binding.authorFlairTextViewItemPostComment, binding.commentTimeTextViewItemPostComment, - binding.awardsTextViewItemComment, binding.commentMarkdownViewItemPostComment, binding.bottomConstraintLayoutItemPostComment, binding.upvoteButtonItemPostComment, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java index 5202b4a1..aaafde55 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java @@ -123,7 +123,6 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi private boolean mShowAbsoluteNumberOfVotes; private boolean mFullyCollapseComment; private boolean mShowOnlyOneCommentLevelIndicator; - private boolean mHideCommentAwards; private boolean mShowAuthorAvatar; private boolean mAlwaysShowChildCommentCount; private boolean mHideTheNumberOfVotes; @@ -257,7 +256,6 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi mShowAbsoluteNumberOfVotes = sharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_ABSOLUTE_NUMBER_OF_VOTES, true); mFullyCollapseComment = sharedPreferences.getBoolean(SharedPreferencesUtils.FULLY_COLLAPSE_COMMENT, false); mShowOnlyOneCommentLevelIndicator = sharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_ONLY_ONE_COMMENT_LEVEL_INDICATOR, false); - mHideCommentAwards = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_COMMENT_AWARDS, false); mShowAuthorAvatar = sharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_AUTHOR_AVATAR, false); mAlwaysShowChildCommentCount = sharedPreferences.getBoolean(SharedPreferencesUtils.ALWAYS_SHOW_CHILD_COMMENT_COUNT, false); mHideTheNumberOfVotes = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_VOTES_IN_COMMENTS, false); @@ -465,11 +463,6 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi ((CommentBaseViewHolder) holder).topScoreTextView.setVisibility(View.GONE); } - if (!mHideCommentAwards && comment.getAwards() != null && !comment.getAwards().equals("")) { - ((CommentBaseViewHolder) holder).awardsTextView.setVisibility(View.VISIBLE); - Utils.setHTMLWithImageToTextView(((CommentBaseViewHolder) holder).awardsTextView, comment.getAwards(), true); - } - mEmoteCloseBracketInlineProcessor.setMediaMetadataMap(comment.getMediaMetadataMap()); mImageAndGifPlugin.setMediaMetadataMap(comment.getMediaMetadataMap()); ((CommentBaseViewHolder) holder).mMarkwonAdapter.setMarkdown(mCommentMarkwon, comment.getCommentMarkdown()); @@ -1122,15 +1115,6 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi } } - public void giveAward(String awardsHTML, int awardCount, int position) { - position = mIsSingleCommentThreadMode ? position + 1 : position; - Comment comment = getCurrentComment(position); - if (comment != null) { - comment.addAwards(awardsHTML); - notifyItemChanged(position); - } - } - public void setSaveComment(int position, boolean isSaved) { Comment comment = getCurrentComment(position); if (comment != null) { @@ -1159,8 +1143,6 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi ((CommentBaseViewHolder) holder).authorTextView.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null); mGlide.clear(((CommentBaseViewHolder) holder).authorIconImageView); ((CommentBaseViewHolder) holder).topScoreTextView.setTextColor(mSecondaryTextColor); - ((CommentBaseViewHolder) holder).awardsTextView.setText(""); - ((CommentBaseViewHolder) holder).awardsTextView.setVisibility(View.GONE); ((CommentBaseViewHolder) holder).expandButton.setVisibility(View.GONE); ((CommentBaseViewHolder) holder).upvoteButton.setIconResource(R.drawable.ic_upvote_24dp); ((CommentBaseViewHolder) holder).upvoteButton.setIconTint(ColorStateList.valueOf(mCommentIconAndInfoColor)); @@ -1214,7 +1196,6 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi TextView authorFlairTextView; TextView commentTimeTextView; TextView topScoreTextView; - TextView awardsTextView; RecyclerView commentMarkdownView; TextView editedTextView; ConstraintLayout bottomConstraintLayout; @@ -1240,7 +1221,6 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi TextView authorFlairTextView, TextView commentTimeTextView, TextView topScoreTextView, - TextView awardsTextView, RecyclerView commentMarkdownView, TextView editedTextView, ConstraintLayout bottomConstraintLayout, @@ -1260,7 +1240,6 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi this.authorFlairTextView = authorFlairTextView; this.commentTimeTextView = commentTimeTextView; this.topScoreTextView = topScoreTextView; - this.awardsTextView = awardsTextView; this.commentMarkdownView = commentMarkdownView; this.editedTextView = editedTextView; this.bottomConstraintLayout = bottomConstraintLayout; @@ -1328,7 +1307,6 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi authorFlairTextView.setTypeface(mActivity.typeface); topScoreTextView.setTypeface(mActivity.typeface); editedTextView.setTypeface(mActivity.typeface); - awardsTextView.setTypeface(mActivity.typeface); scoreTextView.setTypeface(mActivity.typeface); expandButton.setTypeface(mActivity.typeface); } @@ -1362,7 +1340,6 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi authorFlairTextView.setTextColor(mAuthorFlairTextColor); topScoreTextView.setTextColor(mSecondaryTextColor); editedTextView.setTextColor(mSecondaryTextColor); - awardsTextView.setTextColor(mSecondaryTextColor); commentDivider.setBackgroundColor(mDividerColor); upvoteButton.setIconTint(ColorStateList.valueOf(mCommentIconAndInfoColor)); scoreTextView.setTextColor(mCommentIconAndInfoColor); @@ -1809,7 +1786,6 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi binding.authorFlairTextViewItemPostComment, binding.commentTimeTextViewItemPostComment, binding.topScoreTextViewItemPostComment, - binding.awardsTextViewItemComment, binding.commentMarkdownViewItemPostComment, binding.editedTextViewItemPostComment, binding.bottomConstraintLayoutItemPostComment, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/comment/Comment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/comment/Comment.java index 12584a38..3d46c2f2 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/comment/Comment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/comment/Comment.java @@ -46,7 +46,6 @@ public class Comment implements Parcelable { private boolean isSubmitter; private String distinguished; private String permalink; - private String awards; private int depth; private int childCount; private boolean collapsed; @@ -68,7 +67,7 @@ public class Comment implements Parcelable { long commentTimeMillis, String commentMarkdown, String commentRawText, String linkId, String subredditName, String parentId, int score, int voteType, boolean isSubmitter, String distinguished, String permalink, - String awards, int depth, boolean collapsed, boolean hasReply, + int depth, boolean collapsed, boolean hasReply, boolean scoreHidden, boolean saved, long edited, Map<String, MediaMetadata> mediaMetadataMap) { this.id = id; this.fullName = fullName; @@ -87,7 +86,6 @@ public class Comment implements Parcelable { this.isSubmitter = isSubmitter; this.distinguished = distinguished; this.permalink = APIUtils.API_BASE_URI + permalink; - this.awards = awards; this.depth = depth; this.collapsed = collapsed; this.hasReply = hasReply; @@ -136,7 +134,6 @@ public class Comment implements Parcelable { isSubmitter = in.readByte() != 0; distinguished = in.readString(); permalink = in.readString(); - awards = in.readString(); depth = in.readInt(); childCount = in.readInt(); collapsed = in.readByte() != 0; @@ -258,14 +255,6 @@ public class Comment implements Parcelable { return permalink; } - public String getAwards() { - return awards; - } - - public void addAwards(String newAwardsHTML) { - awards += newAwardsHTML; - } - public int getDepth() { return depth; } @@ -440,7 +429,6 @@ public class Comment implements Parcelable { parcel.writeByte((byte) (isSubmitter ? 1 : 0)); parcel.writeString(distinguished); parcel.writeString(permalink); - parcel.writeString(awards); parcel.writeInt(depth); parcel.writeInt(childCount); parcel.writeByte((byte) (collapsed ? 1 : 0)); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/comment/ParseComment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/comment/ParseComment.java index d08bebd1..e37bf304 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/comment/ParseComment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/comment/ParseComment.java @@ -272,31 +272,12 @@ public class ParseComment { String commentMarkdown = ""; if (!singleCommentData.isNull(JSONUtils.BODY_KEY)) { commentMarkdown = Utils.parseInlineRedditImages( - Utils.parseInlineGifInComments( Utils.modifyMarkdown( - Utils.trimTrailingWhitespace(singleCommentData.getString(JSONUtils.BODY_KEY))))); - if (!singleCommentData.isNull(JSONUtils.MEDIA_METADATA_KEY)) { - JSONObject mediaMetadataObject = singleCommentData.getJSONObject(JSONUtils.MEDIA_METADATA_KEY); - commentMarkdown = Utils.parseInlineEmotes(commentMarkdown, mediaMetadataObject); - } + Utils.trimTrailingWhitespace(singleCommentData.getString(JSONUtils.BODY_KEY)))); } 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(Html.escapeHtml(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(Html.escapeHtml(iconUrl)).append("\"> ").append("x").append(count).append(" "); - } - } int score = singleCommentData.getInt(JSONUtils.SCORE_KEY); int voteType; if (singleCommentData.isNull(JSONUtils.LIKES_KEY)) { @@ -324,7 +305,7 @@ public class ParseComment { return new Comment(id, fullName, author, authorFlair, authorFlairHTMLBuilder.toString(), linkAuthor, submitTime, commentMarkdown, commentRawText, linkId, subredditName, parentId, score, voteType, isSubmitter, distinguished, - permalink, awardingsBuilder.toString(), depth, collapsed, hasReply, scoreHidden, saved, edited, + permalink, depth, collapsed, hasReply, scoreHidden, saved, edited, mediaMetadataMap); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java index 902bffca..1e1c32db 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java @@ -793,12 +793,6 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic } } - public void awardGiven(String awardsHTML, int awardCount, int position) { - if (mCommentsAdapter != null) { - mCommentsAdapter.giveAward(awardsHTML, awardCount, position); - } - } - public void changeFlair(Flair flair) { Map<String, String> params = new HashMap<>(); params.put(APIUtils.API_TYPE_KEY, APIUtils.API_TYPE_JSON); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/post/ParsePost.java b/app/src/main/java/ml/docilealligator/infinityforreddit/post/ParsePost.java index 81e95c0c..31a1f139 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/post/ParsePost.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/post/ParsePost.java @@ -187,23 +187,6 @@ public class ParsePost { if (flair.equals("") && data.has(JSONUtils.LINK_FLAIR_TEXT_KEY) && !data.isNull(JSONUtils.LINK_FLAIR_TEXT_KEY)) { flair = data.getString(JSONUtils.LINK_FLAIR_TEXT_KEY); } - - StringBuilder awardingsBuilder = new StringBuilder(); - JSONArray awardingsArray = data.getJSONArray(JSONUtils.ALL_AWARDINGS_KEY); - int nAwards = 0; - for (int i = 0; i < awardingsArray.length(); i++) { - JSONObject award = awardingsArray.getJSONObject(i); - int count = award.getInt(JSONUtils.COUNT_KEY); - nAwards += count; - 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(Html.escapeHtml(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(Html.escapeHtml(iconUrl)).append("\"> ").append("x").append(count).append(" "); - } - } if (data.isNull(JSONUtils.LIKES_KEY)) { voteType = 0; @@ -242,7 +225,7 @@ public class ParsePost { Post post = parseData(data, permalink, id, fullName, subredditName, subredditNamePrefixed, author, authorFlair, authorFlairHTMLBuilder.toString(), postTime, title, previews, mediaMetadataMap, - score, voteType, nComments, upvoteRatio, flair, awardingsBuilder.toString(), nAwards, hidden, + score, voteType, nComments, upvoteRatio, flair, hidden, spoiler, nsfw, stickied, archived, locked, saved, deleted, removed, true, distinguished, suggestedSort); post.setCrosspostParentId(crosspostParent.getId()); @@ -251,7 +234,7 @@ public class ParsePost { return parseData(data, permalink, id, fullName, subredditName, subredditNamePrefixed, author, authorFlair, authorFlairHTMLBuilder.toString(), postTime, title, previews, mediaMetadataMap, - score, voteType, nComments, upvoteRatio, flair, awardingsBuilder.toString(), nAwards, hidden, + score, voteType, nComments, upvoteRatio, flair, hidden, spoiler, nsfw, stickied, archived, locked, saved, deleted, removed, false, distinguished, suggestedSort); } @@ -302,7 +285,7 @@ public class ParsePost { String authorFlair, String authorFlairHTML, long postTimeMillis, String title, ArrayList<Post.Preview> previews, Map<String, MediaMetadata> mediaMetadataMap, int score, int voteType, int nComments, int upvoteRatio, String flair, - String awards, int nAwards, boolean hidden, boolean spoiler, boolean nsfw, + boolean hidden, boolean spoiler, boolean nsfw, boolean stickied, boolean archived, boolean locked, boolean saved, boolean deleted, boolean removed, boolean isCrosspost, String distinguished, String suggestedSort) throws JSONException { @@ -319,7 +302,7 @@ public class ParsePost { int postType = Post.TEXT_TYPE; post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFlair, authorFlairHTML, postTimeMillis, title, permalink, score, postType, - voteType, nComments, upvoteRatio, flair, awards, nAwards, hidden, spoiler, nsfw, + voteType, nComments, upvoteRatio, flair, hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost, distinguished, suggestedSort); } else { if (path.endsWith(".jpg") || path.endsWith(".png") || path.endsWith(".jpeg")) { @@ -328,7 +311,7 @@ public class ParsePost { post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score, - postType, voteType, nComments, upvoteRatio, flair, awards, nAwards, hidden, + postType, voteType, nComments, upvoteRatio, flair, hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost, distinguished, suggestedSort); if (previews.isEmpty()) { @@ -352,7 +335,7 @@ public class ParsePost { post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFlair, authorFlairHTML, postTimeMillis, title, permalink, score, postType, voteType, - nComments, upvoteRatio, flair, awards, nAwards, hidden, spoiler, nsfw, stickied, + nComments, upvoteRatio, flair, hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost, distinguished, suggestedSort); post.setVideoUrl(videoUrl); @@ -362,7 +345,7 @@ public class ParsePost { int postType = Post.NO_PREVIEW_LINK_TYPE; post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score, - postType, voteType, nComments, upvoteRatio, flair, awards, nAwards, hidden, + postType, voteType, nComments, upvoteRatio, flair, hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost, distinguished, suggestedSort); if (data.isNull(JSONUtils.SELFTEXT_KEY)) { post.setSelfText(""); @@ -426,7 +409,7 @@ public class ParsePost { post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFlair, authorFlairHTML, postTimeMillis, title, permalink, score, postType, voteType, - nComments, upvoteRatio, flair, awards, nAwards, hidden, spoiler, nsfw, stickied, + nComments, upvoteRatio, flair, hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost, distinguished, suggestedSort); post.setPreviews(previews); @@ -444,7 +427,7 @@ public class ParsePost { post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFlair, authorFlairHTML, postTimeMillis, title, permalink, score, postType, voteType, - nComments, upvoteRatio, flair, awards, nAwards, hidden, spoiler, nsfw, stickied, + nComments, upvoteRatio, flair, hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost, distinguished, suggestedSort); post.setPreviews(previews); post.setVideoUrl(url); @@ -460,7 +443,7 @@ public class ParsePost { post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFlair, authorFlairHTML, postTimeMillis, title, permalink, score, postType, voteType, - nComments, upvoteRatio, flair, awards, nAwards, hidden, spoiler, nsfw, stickied, + nComments, upvoteRatio, flair, hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost, distinguished, suggestedSort); post.setPreviews(previews); post.setVideoUrl(videoUrl); @@ -473,7 +456,7 @@ public class ParsePost { post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score, - postType, voteType, nComments, upvoteRatio, flair, awards, nAwards, + postType, voteType, nComments, upvoteRatio, flair, hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost, distinguished, suggestedSort); @@ -493,7 +476,7 @@ public class ParsePost { int postType = Post.GIF_TYPE; post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score, - postType, voteType, nComments, upvoteRatio, flair, awards, nAwards, + postType, voteType, nComments, upvoteRatio, flair, hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost, distinguished, suggestedSort); @@ -509,7 +492,7 @@ public class ParsePost { post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score, - postType, voteType, nComments, upvoteRatio, flair, awards, nAwards, + postType, voteType, nComments, upvoteRatio, flair, hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost, distinguished, suggestedSort); post.setPreviews(previews); @@ -522,7 +505,7 @@ public class ParsePost { post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score, - postType, voteType, nComments, upvoteRatio, flair, awards, nAwards, + postType, voteType, nComments, upvoteRatio, flair, hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost, distinguished, suggestedSort); post.setPreviews(previews); @@ -535,7 +518,7 @@ public class ParsePost { post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFlair, authorFlairHTML, postTimeMillis, title, permalink, score, - postType, voteType, nComments, upvoteRatio, flair, awards, nAwards, + postType, voteType, nComments, upvoteRatio, flair, hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost, distinguished, suggestedSort); @@ -547,7 +530,7 @@ public class ParsePost { post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score, - postType, voteType, nComments, upvoteRatio, flair, awards, nAwards, + postType, voteType, nComments, upvoteRatio, flair, hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost, distinguished, suggestedSort); if (data.isNull(JSONUtils.SELFTEXT_KEY)) { @@ -591,7 +574,7 @@ public class ParsePost { post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score, - postType, voteType, nComments, upvoteRatio, flair, awards, nAwards, hidden, + postType, voteType, nComments, upvoteRatio, flair, hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost, distinguished, suggestedSort); if (previews.isEmpty()) { @@ -611,7 +594,7 @@ public class ParsePost { post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score, - postType, voteType, nComments, upvoteRatio, flair, awards, nAwards, hidden, + postType, voteType, nComments, upvoteRatio, flair, hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost, distinguished, suggestedSort); post.setPreviews(previews); post.setVideoUrl(url); @@ -622,7 +605,7 @@ public class ParsePost { post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score, - postType, voteType, nComments, upvoteRatio, flair, awards, nAwards, hidden, + postType, voteType, nComments, upvoteRatio, flair, hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost, distinguished, suggestedSort); //Need attention if (data.isNull(JSONUtils.SELFTEXT_KEY)) { 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 930f7225..bdf1ef27 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/post/Post.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/post/Post.java @@ -79,7 +79,7 @@ public class Post implements Parcelable { public Post(String id, String fullName, String subredditName, String subredditNamePrefixed, String author, String authorFlair, String authorFlairHTML, long postTimeMillis, String title, String permalink, int score, int postType, int voteType, int nComments, - int upvoteRatio, String flair, String awards, int nAwards, boolean hidden, boolean spoiler, + int upvoteRatio, String flair, boolean hidden, boolean spoiler, boolean nsfw, boolean stickied, boolean archived, boolean locked, boolean saved, boolean isCrosspost, String distinguished, String suggestedSort) { this.id = id; @@ -115,7 +115,7 @@ public class Post implements Parcelable { public Post(String id, String fullName, String subredditName, String subredditNamePrefixed, String author, String authorFlair, String authorFlairHTML, long postTimeMillis, String title, String url, String permalink, int score, int postType, int voteType, int nComments, - int upvoteRatio, String flair, String awards, int nAwards, boolean hidden, boolean spoiler, + int upvoteRatio, String flair, boolean hidden, boolean spoiler, boolean nsfw, boolean stickied, boolean archived, boolean locked, boolean saved, boolean isCrosspost, String distinguished, String suggestedSort) { this.id = id; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/JSONUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/JSONUtils.java index c43608be..79182378 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/JSONUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/JSONUtils.java @@ -109,7 +109,6 @@ public class JSONUtils { public static final String IS_FAVORITED_KEY = "is_favorited"; public static final String SUBREDDITS_KEY = "subreddits"; public static final String PATH_KEY = "path"; - public static final String ALL_AWARDINGS_KEY = "all_awardings"; public static final String RESIZED_ICONS_KEY = "resized_icons"; public static final String GFY_ITEM_KEY = "gfyItem"; public static final String MP4_URL_KEY = "mp4Url"; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java index 684d9468..de2e72d4 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java @@ -205,7 +205,6 @@ public class SharedPreferencesUtils { public static final String PINCH_TO_ZOOM_VIDEO = "pinch_to_zoom_video"; public static final String FIXED_HEIGHT_PREVIEW_IN_CARD = "fixed_height_preview_in_card"; public static final String HIDE_TEXT_POST_CONTENT = "hide_text_post_content"; - public static final String HIDE_COMMENT_AWARDS = "hide_comment_awards"; public static final String SHOW_FEWER_TOOLBAR_OPTIONS_THRESHOLD = "show_fewer_toolbar_options_threshold"; public static final String SHOW_AUTHOR_AVATAR = "show_author_avatar"; public static final String ALWAYS_SHOW_CHILD_COMMENT_COUNT = "always_show_child_comment_count"; @@ -395,4 +394,5 @@ public class SharedPreferencesUtils { public static final String DO_NOT_SHOW_REDDIT_API_INFO_AGAIN_LEGACY = "do_not_show_reddit_api_info_again"; public static final String HIDE_THE_NUMBER_OF_AWARDS_LEGACY = "hide_the_number_of_awards"; + public static final String HIDE_COMMENT_AWARDS_LEGACY = "hide_comment_awards"; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java index d6b3ed6c..2fb4cfb0 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java @@ -39,7 +39,6 @@ import com.google.android.material.tabs.TabLayout; import com.google.android.material.textfield.TextInputLayout; import org.json.JSONException; -import org.json.JSONObject; import org.xmlpull.v1.XmlPullParserException; import java.io.IOException; @@ -86,70 +85,6 @@ public final class Utils { return regexed; } - public static String parseInlineGifInComments(String markdown) { - /*StringBuilder markdownStringBuilder = new StringBuilder(markdown); - Pattern inlineGifPattern = REGEX_PATTERNS[3]; - Matcher matcher = inlineGifPattern.matcher(markdownStringBuilder); - while (matcher.find()) { - markdownStringBuilder.replace(matcher.start(), matcher.end(), "![gif](https://i.giphy.com/media/" + markdownStringBuilder.substring(matcher.start() + "![gif](giphy|".length(), matcher.end() - 1) + "/giphy.mp4)"); - matcher = inlineGifPattern.matcher(markdownStringBuilder); - } - - Pattern inlineGifPattern2 = REGEX_PATTERNS[4]; - Matcher matcher2 = inlineGifPattern2.matcher(markdownStringBuilder); - while (matcher2.find()) { - markdownStringBuilder.replace(matcher2.start(), matcher2.end(), "![gif](https://i.giphy.com/media/" + markdownStringBuilder.substring(matcher2.start() + "![gif](giphy|".length(), matcher2.end() - "|downsized\\)".length() + 1) + "/giphy.mp4)"); - matcher2 = inlineGifPattern2.matcher(markdownStringBuilder); - } - - Pattern inlineGifPattern3 = REGEX_PATTERNS[5]; - Matcher matcher3 = inlineGifPattern3.matcher(markdownStringBuilder); - while (matcher3.find()) { - markdownStringBuilder.replace(matcher3.start(), matcher3.end(), - "![emote](https://reddit-meta-production.s3.amazonaws.com/public/fortnitebr/emotes/snoomoji_emotes/" - + markdownStringBuilder.substring( - matcher3.start() + "![emote](emote|".length(), matcher3.end() - 1).replace('|', '/') + ".gif)"); - matcher3 = inlineGifPattern3.matcher(markdownStringBuilder); - } - - return markdownStringBuilder.toString();*/ - return markdown; - } - - public static String parseInlineEmotes(String markdown, JSONObject mediaMetadataObject) throws JSONException { - /*JSONArray mediaMetadataNames = mediaMetadataObject.names(); - if (mediaMetadataNames != null) { - for (int i = 0; i < mediaMetadataNames.length(); i++) { - if (!mediaMetadataNames.isNull(i)) { - String mediaMetadataKey = mediaMetadataNames.getString(i); - if (mediaMetadataObject.isNull(mediaMetadataKey)) { - continue; - } - JSONObject item = mediaMetadataObject.getJSONObject(mediaMetadataKey); - if (item.isNull(JSONUtils.STATUS_KEY) - || !item.getString(JSONUtils.STATUS_KEY).equals("valid") - || item.isNull(JSONUtils.ID_KEY) - || item.isNull(JSONUtils.T_KEY) - || item.isNull(JSONUtils.S_KEY)) { - continue; - } - String emote_type = item.getString(JSONUtils.T_KEY); - String emote_id = item.getString(JSONUtils.ID_KEY); - - JSONObject s_key = item.getJSONObject(JSONUtils.S_KEY); - if (s_key.isNull(JSONUtils.U_KEY)) { - continue; - } - String emote_url = s_key.getString(JSONUtils.U_KEY); - - markdown = markdown.replace("![img](" + emote_id + ")", "[" + emote_type + "](" + emote_url + ") "); - } - } - } - return markdown;*/ - return markdown; - } - public static String parseInlineRedditImages(String markdown) { StringBuilder markdownStringBuilder = new StringBuilder(markdown); Pattern inlineRedditImagePattern = REGEX_PATTERNS[6]; |