mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-02-27 12:53:57 +01:00
This commit is contained in:
parent
c1190c0d87
commit
9db90a0431
@ -22,7 +22,6 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.content.res.AppCompatResources;
|
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||||
import androidx.constraintlayout.widget.ConstraintSet;
|
import androidx.constraintlayout.widget.ConstraintSet;
|
||||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||||
@ -1908,7 +1907,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
|||||||
mIsSingleCommentThreadMode = false;
|
mIsSingleCommentThreadMode = false;
|
||||||
mSingleCommentId = null;
|
mSingleCommentId = null;
|
||||||
notifyItemRemoved(0);
|
notifyItemRemoved(0);
|
||||||
mFragment.changeToNomalThreadMode();
|
mFragment.changeToNormalThreadMode();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -813,10 +813,10 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
|||||||
children.clear();
|
children.clear();
|
||||||
}
|
}
|
||||||
this.sortType = sortType.getType();
|
this.sortType = sortType.getType();
|
||||||
if (!mSharedPreferences.getBoolean(SharedPreferencesUtils.RESPECT_SUBREDDIT_RECOMMENDED_COMMENT_SORT_TYPE, false)
|
if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SAVE_SORT_TYPE, true)) {
|
||||||
&& mSharedPreferences.getBoolean(SharedPreferencesUtils.SAVE_SORT_TYPE, true)) {
|
|
||||||
mSortTypeSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TYPE_POST_COMMENT, sortType.getType().name()).apply();
|
mSortTypeSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TYPE_POST_COMMENT, sortType.getType().name()).apply();
|
||||||
}
|
}
|
||||||
|
mRespectSubredditRecommendedSortType = false;
|
||||||
fetchCommentsRespectRecommendedSort(false, sortType.getType());
|
fetchCommentsRespectRecommendedSort(false, sortType.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1425,6 +1425,17 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
|||||||
|
|
||||||
private void fetchCommentsRespectRecommendedSort(boolean changeRefreshState, SortType.Type sortType) {
|
private void fetchCommentsRespectRecommendedSort(boolean changeRefreshState, SortType.Type sortType) {
|
||||||
if (mRespectSubredditRecommendedSortType && mPost != null) {
|
if (mRespectSubredditRecommendedSortType && mPost != null) {
|
||||||
|
if (mPost.getSuggestedSort() != null && !mPost.getSuggestedSort().equals("null") && !mPost.getSuggestedSort().equals("")) {
|
||||||
|
try {
|
||||||
|
SortType.Type sortTypeType = SortType.Type.valueOf(mPost.getSuggestedSort().toUpperCase(Locale.US));
|
||||||
|
activity.setTitle(sortTypeType.fullName);
|
||||||
|
ViewPostDetailFragment.this.sortType = sortTypeType;
|
||||||
|
fetchComments(changeRefreshState, ViewPostDetailFragment.this.sortType);
|
||||||
|
return;
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
FetchSubredditData.fetchSubredditData(mOauthRetrofit, mRetrofit, mPost.getSubredditName(), mAccessToken,
|
FetchSubredditData.fetchSubredditData(mOauthRetrofit, mRetrofit, mPost.getSubredditName(), mAccessToken,
|
||||||
new FetchSubredditData.FetchSubredditDataListener() {
|
new FetchSubredditData.FetchSubredditDataListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -1586,8 +1597,8 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
|||||||
mFetchPostInfoLinearLayout.setVisibility(View.GONE);
|
mFetchPostInfoLinearLayout.setVisibility(View.GONE);
|
||||||
mGlide.clear(mFetchPostInfoImageView);
|
mGlide.clear(mFetchPostInfoImageView);
|
||||||
|
|
||||||
if (fetchComments) {
|
if (!fetchPost && fetchComments) {
|
||||||
fetchCommentsRespectRecommendedSort(!fetchPost);
|
fetchCommentsRespectRecommendedSort(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fetchPost) {
|
if (fetchPost) {
|
||||||
@ -1605,9 +1616,14 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
|||||||
mPost = post;
|
mPost = post;
|
||||||
mPostAdapter.updatePost(mPost);
|
mPostAdapter.updatePost(mPost);
|
||||||
EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition));
|
EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition));
|
||||||
isRefreshing = false;
|
|
||||||
setupMenu();
|
setupMenu();
|
||||||
mSwipeRefreshLayout.setRefreshing(false);
|
mSwipeRefreshLayout.setRefreshing(false);
|
||||||
|
|
||||||
|
if (fetchComments) {
|
||||||
|
fetchCommentsRespectRecommendedSort(true);
|
||||||
|
} else {
|
||||||
|
isRefreshing = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1842,7 +1858,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void changeToNomalThreadMode() {
|
public void changeToNormalThreadMode() {
|
||||||
isSingleCommentThreadMode = false;
|
isSingleCommentThreadMode = false;
|
||||||
mSingleCommentId = null;
|
mSingleCommentId = null;
|
||||||
mRespectSubredditRecommendedSortType = mSharedPreferences.getBoolean(SharedPreferencesUtils.RESPECT_SUBREDDIT_RECOMMENDED_COMMENT_SORT_TYPE, false);
|
mRespectSubredditRecommendedSortType = mSharedPreferences.getBoolean(SharedPreferencesUtils.RESPECT_SUBREDDIT_RECOMMENDED_COMMENT_SORT_TYPE, false);
|
||||||
|
@ -13,7 +13,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
@ -147,6 +146,7 @@ public class ParsePost {
|
|||||||
}
|
}
|
||||||
String authorFlair = data.isNull(JSONUtils.AUTHOR_FLAIR_TEXT_KEY) ? "" : data.getString(JSONUtils.AUTHOR_FLAIR_TEXT_KEY);
|
String authorFlair = data.isNull(JSONUtils.AUTHOR_FLAIR_TEXT_KEY) ? "" : data.getString(JSONUtils.AUTHOR_FLAIR_TEXT_KEY);
|
||||||
String distinguished = data.getString(JSONUtils.DISTINGUISHED_KEY);
|
String distinguished = data.getString(JSONUtils.DISTINGUISHED_KEY);
|
||||||
|
String suggestedSort = data.has(JSONUtils.SUGGESTED_SORT_KEY) ? data.getString(JSONUtils.SUGGESTED_SORT_KEY) : null;
|
||||||
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);
|
||||||
@ -236,7 +236,7 @@ public class ParsePost {
|
|||||||
postTime, title, previews,
|
postTime, title, previews,
|
||||||
score, voteType, nComments, upvoteRatio, flair, awardingsBuilder.toString(), nAwards, hidden,
|
score, voteType, nComments, upvoteRatio, flair, awardingsBuilder.toString(), nAwards, hidden,
|
||||||
spoiler, nsfw, stickied, archived, locked, saved, deleted, removed, true,
|
spoiler, nsfw, stickied, archived, locked, saved, deleted, removed, true,
|
||||||
distinguished);
|
distinguished, suggestedSort);
|
||||||
post.setCrosspostParentId(crosspostParent.getId());
|
post.setCrosspostParentId(crosspostParent.getId());
|
||||||
return post;
|
return post;
|
||||||
} else {
|
} else {
|
||||||
@ -245,7 +245,7 @@ public class ParsePost {
|
|||||||
postTime, title, previews,
|
postTime, title, previews,
|
||||||
score, voteType, nComments, upvoteRatio, flair, awardingsBuilder.toString(), nAwards, hidden,
|
score, voteType, nComments, upvoteRatio, flair, awardingsBuilder.toString(), nAwards, hidden,
|
||||||
spoiler, nsfw, stickied, archived, locked, saved, deleted, removed, false,
|
spoiler, nsfw, stickied, archived, locked, saved, deleted, removed, false,
|
||||||
distinguished);
|
distinguished, suggestedSort);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,7 +257,7 @@ public class ParsePost {
|
|||||||
String awards, int nAwards, boolean hidden, boolean spoiler,
|
String awards, int nAwards, boolean hidden, boolean spoiler,
|
||||||
boolean nsfw, boolean stickied, boolean archived, boolean locked,
|
boolean nsfw, boolean stickied, boolean archived, boolean locked,
|
||||||
boolean saved, boolean deleted, boolean removed, boolean isCrosspost,
|
boolean saved, boolean deleted, boolean removed, boolean isCrosspost,
|
||||||
String distinguished) throws JSONException {
|
String distinguished, String suggestedSort) throws JSONException {
|
||||||
Post post;
|
Post post;
|
||||||
|
|
||||||
boolean isVideo = data.getBoolean(JSONUtils.IS_VIDEO_KEY);
|
boolean isVideo = data.getBoolean(JSONUtils.IS_VIDEO_KEY);
|
||||||
@ -272,7 +272,7 @@ public class ParsePost {
|
|||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
|
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
|
||||||
authorFlair, authorFlairHTML, postTimeMillis, title, permalink, score, postType,
|
authorFlair, authorFlairHTML, postTimeMillis, title, permalink, score, postType,
|
||||||
voteType, nComments, upvoteRatio, flair, awards, nAwards, hidden, spoiler, nsfw,
|
voteType, nComments, upvoteRatio, flair, awards, nAwards, hidden, spoiler, nsfw,
|
||||||
stickied, archived, locked, saved, isCrosspost, distinguished);
|
stickied, archived, locked, saved, isCrosspost, distinguished, suggestedSort);
|
||||||
} else {
|
} else {
|
||||||
if (path.endsWith(".jpg") || path.endsWith(".png") || path.endsWith(".jpeg")) {
|
if (path.endsWith(".jpg") || path.endsWith(".png") || path.endsWith(".jpeg")) {
|
||||||
//Image post
|
//Image post
|
||||||
@ -281,7 +281,7 @@ public class ParsePost {
|
|||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
|
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
|
||||||
authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score,
|
authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score,
|
||||||
postType, voteType, nComments, upvoteRatio, flair, awards, nAwards, hidden,
|
postType, voteType, nComments, upvoteRatio, flair, awards, nAwards, hidden,
|
||||||
spoiler, nsfw, stickied, archived, locked, saved, isCrosspost, distinguished);
|
spoiler, nsfw, stickied, archived, locked, saved, isCrosspost, distinguished, suggestedSort);
|
||||||
|
|
||||||
if (previews.isEmpty()) {
|
if (previews.isEmpty()) {
|
||||||
previews.add(new Post.Preview(url, 0, 0, "", ""));
|
previews.add(new Post.Preview(url, 0, 0, "", ""));
|
||||||
@ -298,7 +298,7 @@ public class ParsePost {
|
|||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFlair,
|
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFlair,
|
||||||
authorFlairHTML, postTimeMillis, title, permalink, score, postType, voteType,
|
authorFlairHTML, postTimeMillis, title, permalink, score, postType, voteType,
|
||||||
nComments, upvoteRatio, flair, awards, nAwards, hidden, spoiler, nsfw, stickied,
|
nComments, upvoteRatio, flair, awards, nAwards, hidden, spoiler, nsfw, stickied,
|
||||||
archived, locked, saved, isCrosspost, distinguished);
|
archived, locked, saved, isCrosspost, distinguished, suggestedSort);
|
||||||
|
|
||||||
post.setVideoUrl(videoUrl);
|
post.setVideoUrl(videoUrl);
|
||||||
post.setVideoDownloadUrl(videoDownloadUrl);
|
post.setVideoDownloadUrl(videoDownloadUrl);
|
||||||
@ -308,7 +308,7 @@ public class ParsePost {
|
|||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
|
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
|
||||||
authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score,
|
authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score,
|
||||||
postType, voteType, nComments, upvoteRatio, flair, awards, nAwards, hidden,
|
postType, voteType, nComments, upvoteRatio, flair, awards, nAwards, hidden,
|
||||||
spoiler, nsfw, stickied, archived, locked, saved, isCrosspost, distinguished);
|
spoiler, nsfw, stickied, archived, locked, saved, isCrosspost, distinguished, suggestedSort);
|
||||||
if (data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
if (data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
||||||
post.setSelfText("");
|
post.setSelfText("");
|
||||||
} else {
|
} else {
|
||||||
@ -372,7 +372,7 @@ public class ParsePost {
|
|||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFlair,
|
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFlair,
|
||||||
authorFlairHTML, postTimeMillis, title, permalink, score, postType, voteType,
|
authorFlairHTML, postTimeMillis, title, permalink, score, postType, voteType,
|
||||||
nComments, upvoteRatio, flair, awards, nAwards, hidden, spoiler, nsfw, stickied,
|
nComments, upvoteRatio, flair, awards, nAwards, hidden, spoiler, nsfw, stickied,
|
||||||
archived, locked, saved, isCrosspost, distinguished);
|
archived, locked, saved, isCrosspost, distinguished, suggestedSort);
|
||||||
|
|
||||||
post.setPreviews(previews);
|
post.setPreviews(previews);
|
||||||
post.setVideoUrl(videoUrl);
|
post.setVideoUrl(videoUrl);
|
||||||
@ -390,7 +390,7 @@ public class ParsePost {
|
|||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFlair,
|
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFlair,
|
||||||
authorFlairHTML, postTimeMillis, title, permalink, score, postType, voteType,
|
authorFlairHTML, postTimeMillis, title, permalink, score, postType, voteType,
|
||||||
nComments, upvoteRatio, flair, awards, nAwards, hidden, spoiler, nsfw, stickied,
|
nComments, upvoteRatio, flair, awards, nAwards, hidden, spoiler, nsfw, stickied,
|
||||||
archived, locked, saved, isCrosspost, distinguished);
|
archived, locked, saved, isCrosspost, distinguished, suggestedSort);
|
||||||
post.setPreviews(previews);
|
post.setPreviews(previews);
|
||||||
post.setVideoUrl(url);
|
post.setVideoUrl(url);
|
||||||
post.setVideoDownloadUrl(url);
|
post.setVideoDownloadUrl(url);
|
||||||
@ -406,7 +406,7 @@ public class ParsePost {
|
|||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFlair,
|
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFlair,
|
||||||
authorFlairHTML, postTimeMillis, title, permalink, score, postType, voteType,
|
authorFlairHTML, postTimeMillis, title, permalink, score, postType, voteType,
|
||||||
nComments, upvoteRatio, flair, awards, nAwards, hidden, spoiler, nsfw, stickied,
|
nComments, upvoteRatio, flair, awards, nAwards, hidden, spoiler, nsfw, stickied,
|
||||||
archived, locked, saved, isCrosspost, distinguished);
|
archived, locked, saved, isCrosspost, distinguished, suggestedSort);
|
||||||
post.setPreviews(previews);
|
post.setPreviews(previews);
|
||||||
post.setVideoUrl(videoUrl);
|
post.setVideoUrl(videoUrl);
|
||||||
post.setVideoDownloadUrl(videoDownloadUrl);
|
post.setVideoDownloadUrl(videoDownloadUrl);
|
||||||
@ -420,7 +420,7 @@ public class ParsePost {
|
|||||||
authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score,
|
authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score,
|
||||||
postType, voteType, nComments, upvoteRatio, flair, awards, nAwards,
|
postType, voteType, nComments, upvoteRatio, flair, awards, nAwards,
|
||||||
hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost,
|
hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost,
|
||||||
distinguished);
|
distinguished, suggestedSort);
|
||||||
|
|
||||||
if (previews.isEmpty()) {
|
if (previews.isEmpty()) {
|
||||||
previews.add(new Post.Preview(url, 0, 0, "", ""));
|
previews.add(new Post.Preview(url, 0, 0, "", ""));
|
||||||
@ -433,7 +433,7 @@ public class ParsePost {
|
|||||||
authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score,
|
authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score,
|
||||||
postType, voteType, nComments, upvoteRatio, flair, awards, nAwards,
|
postType, voteType, nComments, upvoteRatio, flair, awards, nAwards,
|
||||||
hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost,
|
hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost,
|
||||||
distinguished);
|
distinguished, suggestedSort);
|
||||||
|
|
||||||
post.setPreviews(previews);
|
post.setPreviews(previews);
|
||||||
post.setVideoUrl(url);
|
post.setVideoUrl(url);
|
||||||
@ -449,7 +449,7 @@ public class ParsePost {
|
|||||||
authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score,
|
authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score,
|
||||||
postType, voteType, nComments, upvoteRatio, flair, awards, nAwards,
|
postType, voteType, nComments, upvoteRatio, flair, awards, nAwards,
|
||||||
hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost,
|
hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost,
|
||||||
distinguished);
|
distinguished, suggestedSort);
|
||||||
post.setPreviews(previews);
|
post.setPreviews(previews);
|
||||||
post.setVideoUrl(url);
|
post.setVideoUrl(url);
|
||||||
post.setVideoDownloadUrl(url);
|
post.setVideoDownloadUrl(url);
|
||||||
@ -462,7 +462,7 @@ public class ParsePost {
|
|||||||
authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score,
|
authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score,
|
||||||
postType, voteType, nComments, upvoteRatio, flair, awards, nAwards,
|
postType, voteType, nComments, upvoteRatio, flair, awards, nAwards,
|
||||||
hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost,
|
hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost,
|
||||||
distinguished);
|
distinguished, suggestedSort);
|
||||||
post.setPreviews(previews);
|
post.setPreviews(previews);
|
||||||
post.setVideoUrl(url);
|
post.setVideoUrl(url);
|
||||||
post.setVideoDownloadUrl(url);
|
post.setVideoDownloadUrl(url);
|
||||||
@ -475,7 +475,7 @@ public class ParsePost {
|
|||||||
authorFlair, authorFlairHTML, postTimeMillis, title, permalink, score,
|
authorFlair, authorFlairHTML, postTimeMillis, title, permalink, score,
|
||||||
postType, voteType, nComments, upvoteRatio, flair, awards, nAwards,
|
postType, voteType, nComments, upvoteRatio, flair, awards, nAwards,
|
||||||
hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost,
|
hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost,
|
||||||
distinguished);
|
distinguished, suggestedSort);
|
||||||
|
|
||||||
//Need attention
|
//Need attention
|
||||||
post.setPreviews(previews);
|
post.setPreviews(previews);
|
||||||
@ -487,7 +487,7 @@ public class ParsePost {
|
|||||||
authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score,
|
authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score,
|
||||||
postType, voteType, nComments, upvoteRatio, flair, awards, nAwards,
|
postType, voteType, nComments, upvoteRatio, flair, awards, nAwards,
|
||||||
hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost,
|
hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost,
|
||||||
distinguished);
|
distinguished, suggestedSort);
|
||||||
if (data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
if (data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
||||||
post.setSelfText("");
|
post.setSelfText("");
|
||||||
} else {
|
} else {
|
||||||
@ -530,7 +530,7 @@ public class ParsePost {
|
|||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
|
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
|
||||||
authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score,
|
authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score,
|
||||||
postType, voteType, nComments, upvoteRatio, flair, awards, nAwards, hidden,
|
postType, voteType, nComments, upvoteRatio, flair, awards, nAwards, hidden,
|
||||||
spoiler, nsfw, stickied, archived, locked, saved, isCrosspost, distinguished);
|
spoiler, nsfw, stickied, archived, locked, saved, isCrosspost, distinguished, suggestedSort);
|
||||||
|
|
||||||
if (previews.isEmpty()) {
|
if (previews.isEmpty()) {
|
||||||
previews.add(new Post.Preview(url, 0, 0, "", ""));
|
previews.add(new Post.Preview(url, 0, 0, "", ""));
|
||||||
@ -543,7 +543,7 @@ public class ParsePost {
|
|||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
|
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
|
||||||
authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score,
|
authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score,
|
||||||
postType, voteType, nComments, upvoteRatio, flair, awards, nAwards, hidden,
|
postType, voteType, nComments, upvoteRatio, flair, awards, nAwards, hidden,
|
||||||
spoiler, nsfw, stickied, archived, locked, saved, isCrosspost, distinguished);
|
spoiler, nsfw, stickied, archived, locked, saved, isCrosspost, distinguished, suggestedSort);
|
||||||
post.setPreviews(previews);
|
post.setPreviews(previews);
|
||||||
post.setVideoUrl(url);
|
post.setVideoUrl(url);
|
||||||
post.setVideoDownloadUrl(url);
|
post.setVideoDownloadUrl(url);
|
||||||
@ -554,7 +554,7 @@ public class ParsePost {
|
|||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
|
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
|
||||||
authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score,
|
authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score,
|
||||||
postType, voteType, nComments, upvoteRatio, flair, awards, nAwards, hidden,
|
postType, voteType, nComments, upvoteRatio, flair, awards, nAwards, hidden,
|
||||||
spoiler, nsfw, stickied, archived, locked, saved, isCrosspost, distinguished);
|
spoiler, nsfw, stickied, archived, locked, saved, isCrosspost, distinguished, suggestedSort);
|
||||||
//Need attention
|
//Need attention
|
||||||
if (data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
if (data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
||||||
post.setSelfText("");
|
post.setSelfText("");
|
||||||
|
@ -78,6 +78,7 @@ public class Post implements Parcelable {
|
|||||||
private boolean isRead;
|
private boolean isRead;
|
||||||
private String crosspostParentId;
|
private String crosspostParentId;
|
||||||
private String distinguished;
|
private String distinguished;
|
||||||
|
private String suggestedSort;
|
||||||
private ArrayList<Preview> previews = new ArrayList<>();
|
private ArrayList<Preview> previews = new ArrayList<>();
|
||||||
private ArrayList<Gallery> gallery = new ArrayList<>();
|
private ArrayList<Gallery> gallery = new ArrayList<>();
|
||||||
|
|
||||||
@ -86,7 +87,7 @@ public class Post implements Parcelable {
|
|||||||
String title, String permalink, int score, int postType, int voteType, int nComments,
|
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, String awards, int nAwards, boolean hidden, boolean spoiler,
|
||||||
boolean nsfw, boolean stickied, boolean archived, boolean locked, boolean saved,
|
boolean nsfw, boolean stickied, boolean archived, boolean locked, boolean saved,
|
||||||
boolean isCrosspost, String distinguished) {
|
boolean isCrosspost, String distinguished, String suggestedSort) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.fullName = fullName;
|
this.fullName = fullName;
|
||||||
this.subredditName = subredditName;
|
this.subredditName = subredditName;
|
||||||
@ -115,6 +116,7 @@ public class Post implements Parcelable {
|
|||||||
this.saved = saved;
|
this.saved = saved;
|
||||||
this.isCrosspost = isCrosspost;
|
this.isCrosspost = isCrosspost;
|
||||||
this.distinguished = distinguished;
|
this.distinguished = distinguished;
|
||||||
|
this.suggestedSort = suggestedSort;
|
||||||
isRead = false;
|
isRead = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +125,7 @@ public class Post implements Parcelable {
|
|||||||
String url, String permalink, int score, int postType, int voteType, int nComments,
|
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, String awards, int nAwards, boolean hidden, boolean spoiler,
|
||||||
boolean nsfw, boolean stickied, boolean archived, boolean locked, boolean saved,
|
boolean nsfw, boolean stickied, boolean archived, boolean locked, boolean saved,
|
||||||
boolean isCrosspost, String distinguished) {
|
boolean isCrosspost, String distinguished, String suggestedSort) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.fullName = fullName;
|
this.fullName = fullName;
|
||||||
this.subredditName = subredditName;
|
this.subredditName = subredditName;
|
||||||
@ -153,6 +155,7 @@ public class Post implements Parcelable {
|
|||||||
this.saved = saved;
|
this.saved = saved;
|
||||||
this.isCrosspost = isCrosspost;
|
this.isCrosspost = isCrosspost;
|
||||||
this.distinguished = distinguished;
|
this.distinguished = distinguished;
|
||||||
|
this.suggestedSort = suggestedSort;
|
||||||
isRead = false;
|
isRead = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,6 +205,7 @@ public class Post implements Parcelable {
|
|||||||
isRead = in.readByte() != 0;
|
isRead = in.readByte() != 0;
|
||||||
crosspostParentId = in.readString();
|
crosspostParentId = in.readString();
|
||||||
distinguished = in.readString();
|
distinguished = in.readString();
|
||||||
|
suggestedSort = in.readString();
|
||||||
in.readTypedList(previews, Preview.CREATOR);
|
in.readTypedList(previews, Preview.CREATOR);
|
||||||
in.readTypedList(gallery, Gallery.CREATOR);
|
in.readTypedList(gallery, Gallery.CREATOR);
|
||||||
}
|
}
|
||||||
@ -399,6 +403,10 @@ public class Post implements Parcelable {
|
|||||||
return distinguished != null && distinguished.equals("admin");
|
return distinguished != null && distinguished.equals("admin");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSuggestedSort() {
|
||||||
|
return suggestedSort;
|
||||||
|
}
|
||||||
|
|
||||||
public String getAwards() {
|
public String getAwards() {
|
||||||
return awards;
|
return awards;
|
||||||
}
|
}
|
||||||
@ -587,6 +595,7 @@ public class Post implements Parcelable {
|
|||||||
parcel.writeByte((byte) (isRead ? 1 : 0));
|
parcel.writeByte((byte) (isRead ? 1 : 0));
|
||||||
parcel.writeString(crosspostParentId);
|
parcel.writeString(crosspostParentId);
|
||||||
parcel.writeString(distinguished);
|
parcel.writeString(distinguished);
|
||||||
|
parcel.writeString(suggestedSort);
|
||||||
parcel.writeTypedList(previews);
|
parcel.writeTypedList(previews);
|
||||||
parcel.writeTypedList(gallery);
|
parcel.writeTypedList(gallery);
|
||||||
}
|
}
|
||||||
|
@ -180,4 +180,5 @@ public class JSONUtils {
|
|||||||
public static final String STATUS_KEY = "status";
|
public static final String STATUS_KEY = "status";
|
||||||
public static final String URLS_KEY = "urls";
|
public static final String URLS_KEY = "urls";
|
||||||
public static final String HD_KEY = "hd";
|
public static final String HD_KEY = "hd";
|
||||||
|
public static final String SUGGESTED_SORT_KEY = "suggested_sort";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user