mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-01-01 05:47:10 +01:00
parent
a7c2a67d0c
commit
2704ff0ecf
@ -554,9 +554,6 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
|
|||||||
.into(((PostBaseViewHolder) holder).iconGifImageView);
|
.into(((PostBaseViewHolder) holder).iconGifImageView);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (holder.getBindingAdapterPosition() >= 0) {
|
|
||||||
post.setSubredditIconUrl(iconUrl);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (!post.getSubredditIconUrl().equals("")) {
|
} else if (!post.getSubredditIconUrl().equals("")) {
|
||||||
@ -1082,9 +1079,6 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
|
|||||||
.into(((PostCompactBaseViewHolder) holder).iconGifImageView);
|
.into(((PostCompactBaseViewHolder) holder).iconGifImageView);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (holder.getBindingAdapterPosition() >= 0) {
|
|
||||||
post.setSubredditIconUrl(iconUrl);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (!post.getSubredditIconUrl().equals("")) {
|
} else if (!post.getSubredditIconUrl().equals("")) {
|
||||||
|
@ -172,6 +172,8 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
private boolean mHideUpvoteRatio;
|
private boolean mHideUpvoteRatio;
|
||||||
private boolean mHideTheNumberOfAwards;
|
private boolean mHideTheNumberOfAwards;
|
||||||
private boolean mHideSubredditAndUserPrefix;
|
private boolean mHideSubredditAndUserPrefix;
|
||||||
|
|
||||||
|
private boolean mShowDisplayNames;
|
||||||
private boolean mHideTheNumberOfVotes;
|
private boolean mHideTheNumberOfVotes;
|
||||||
|
|
||||||
private boolean mSeperateUpvoteAndDownvote;
|
private boolean mSeperateUpvoteAndDownvote;
|
||||||
@ -345,6 +347,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
mHideUpvoteRatio = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_UPVOTE_RATIO, false);
|
mHideUpvoteRatio = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_UPVOTE_RATIO, false);
|
||||||
mHideTheNumberOfAwards = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_AWARDS, false);
|
mHideTheNumberOfAwards = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_AWARDS, false);
|
||||||
mHideSubredditAndUserPrefix = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_SUBREDDIT_AND_USER_PREFIX, false);
|
mHideSubredditAndUserPrefix = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_SUBREDDIT_AND_USER_PREFIX, false);
|
||||||
|
mShowDisplayNames = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.POST_DETAIL_DISPLAY_NAME_INSTEAD_OF_USERNAME, true);
|
||||||
mHideTheNumberOfVotes = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_VOTES, false);
|
mHideTheNumberOfVotes = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_VOTES, false);
|
||||||
mHideDownvotes = !currentAccountSharedPreferences.getBoolean(SharedPreferencesUtils.CAN_DOWNVOTE, true);
|
mHideDownvotes = !currentAccountSharedPreferences.getBoolean(SharedPreferencesUtils.CAN_DOWNVOTE, true);
|
||||||
mSeperateUpvoteAndDownvote = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.POST_DETAIL_SEPARATE_UP_AND_DOWN_VOTES, true) && !mHideDownvotes;
|
mSeperateUpvoteAndDownvote = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.POST_DETAIL_SEPARATE_UP_AND_DOWN_VOTES, true) && !mHideDownvotes;
|
||||||
@ -528,8 +531,6 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
|
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
|
||||||
.into(((PostDetailBaseViewHolder) holder).mIconGifImageView);
|
.into(((PostDetailBaseViewHolder) holder).mIconGifImageView);
|
||||||
}
|
}
|
||||||
|
|
||||||
mPost.setSubredditIconUrl(iconImageUrl);
|
|
||||||
});
|
});
|
||||||
} else if (!mPost.getSubredditIconUrl().equals("")) {
|
} else if (!mPost.getSubredditIconUrl().equals("")) {
|
||||||
mGlide.load(mPost.getSubredditIconUrl())
|
mGlide.load(mPost.getSubredditIconUrl())
|
||||||
@ -580,13 +581,14 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
((PostDetailBaseViewHolder) holder).mCrosspostImageView.setVisibility(View.VISIBLE);
|
((PostDetailBaseViewHolder) holder).mCrosspostImageView.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
((PostDetailBaseViewHolder) holder).mUserTextView.setText((mShowDisplayNames) ? mPost.getAuthor() : mPost.getAuthorInfo().getUsername());
|
||||||
|
((PostDetailBaseViewHolder) holder).mSubredditTextView.setText((mShowDisplayNames) ? mPost.getSubredditName() : mPost.getCommunityInfo().getName());
|
||||||
if (mHideSubredditAndUserPrefix) {
|
if (mHideSubredditAndUserPrefix) {
|
||||||
((PostDetailBaseViewHolder) holder).mSubredditTextView.setText(mPost.getSubredditName());
|
((PostDetailBaseViewHolder) holder).mUserTextView.setText((mShowDisplayNames) ? mPost.getAuthor() : mPost.getAuthorInfo().getUsername());
|
||||||
((PostDetailBaseViewHolder) holder).mUserTextView.setText(mPost.getAuthor());
|
|
||||||
} else {
|
} else {
|
||||||
((PostDetailBaseViewHolder) holder).mSubredditTextView.setText(mPost.getSubredditName());
|
((PostDetailBaseViewHolder) holder).mSubredditTextView.setText((mShowDisplayNames) ? mPost.getSubredditName() : mPost.getCommunityInfo().getName());
|
||||||
((PostDetailBaseViewHolder) holder).mCommunityInstanceTextView.setText('@' + mPost.getSubredditNamePrefixed().split(Pattern.quote("@"))[1]);
|
((PostDetailBaseViewHolder) holder).mCommunityInstanceTextView.setText('@' + mPost.getSubredditNamePrefixed().split(Pattern.quote("@"))[1]);
|
||||||
((PostDetailBaseViewHolder) holder).mUserTextView.setText(mPost.getAuthor());
|
|
||||||
((PostDetailBaseViewHolder) holder).mUserInstanceTextView.setText('@' + mPost.getAuthorNamePrefixed().split(Pattern.quote("@"))[1]);
|
((PostDetailBaseViewHolder) holder).mUserInstanceTextView.setText('@' + mPost.getAuthorNamePrefixed().split(Pattern.quote("@"))[1]);
|
||||||
((PostDetailBaseViewHolder) holder).mCommunityInstanceTextView.setTextColor(CustomThemeWrapper.darkenColor(mSubredditColor, 0.7f));
|
((PostDetailBaseViewHolder) holder).mCommunityInstanceTextView.setTextColor(CustomThemeWrapper.darkenColor(mSubredditColor, 0.7f));
|
||||||
((PostDetailBaseViewHolder) holder).mUserInstanceTextView.setTextColor(CustomThemeWrapper.darkenColor(mPost.isModerator() || mPost.isAdmin() ? mModeratorColor : mUsernameColor, 0.7f));
|
((PostDetailBaseViewHolder) holder).mUserInstanceTextView.setTextColor(CustomThemeWrapper.darkenColor(mPost.isModerator() || mPost.isAdmin() ? mModeratorColor : mUsernameColor, 0.7f));
|
||||||
|
@ -227,6 +227,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
|||||||
private boolean mHidePostFlair;
|
private boolean mHidePostFlair;
|
||||||
private boolean mHideTheNumberOfAwards;
|
private boolean mHideTheNumberOfAwards;
|
||||||
private boolean mHideSubredditAndUserPrefix;
|
private boolean mHideSubredditAndUserPrefix;
|
||||||
|
private boolean mShowDisplayNames;
|
||||||
private boolean mHideTheNumberOfVotes;
|
private boolean mHideTheNumberOfVotes;
|
||||||
|
|
||||||
private boolean mSeparateUpandDownVotes;
|
private boolean mSeparateUpandDownVotes;
|
||||||
@ -313,6 +314,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
|||||||
mHidePostFlair = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_POST_FLAIR, false);
|
mHidePostFlair = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_POST_FLAIR, false);
|
||||||
mHideTheNumberOfAwards = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_AWARDS, false);
|
mHideTheNumberOfAwards = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_AWARDS, false);
|
||||||
mHideSubredditAndUserPrefix = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_SUBREDDIT_AND_USER_PREFIX, false);
|
mHideSubredditAndUserPrefix = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_SUBREDDIT_AND_USER_PREFIX, false);
|
||||||
|
mShowDisplayNames = sharedPreferences.getBoolean(SharedPreferencesUtils.POST_DISPLAY_NAME_INSTEAD_OF_USERNAME, true);
|
||||||
mHideTheNumberOfVotes = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_VOTES, false);
|
mHideTheNumberOfVotes = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_VOTES, false);
|
||||||
mHideDownvotes = !currentAccountSharedPreferences.getBoolean(SharedPreferencesUtils.CAN_DOWNVOTE, true);
|
mHideDownvotes = !currentAccountSharedPreferences.getBoolean(SharedPreferencesUtils.CAN_DOWNVOTE, true);
|
||||||
mSeparateUpandDownVotes = sharedPreferences.getBoolean(SharedPreferencesUtils.POST_SEPARATE_UP_AND_DOWN_VOTES, true) && !mHideDownvotes;
|
mSeparateUpandDownVotes = sharedPreferences.getBoolean(SharedPreferencesUtils.POST_SEPARATE_UP_AND_DOWN_VOTES, true) && !mHideDownvotes;
|
||||||
@ -536,13 +538,10 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
|||||||
}
|
}
|
||||||
String authorPrefixed = post.getAuthorNamePrefixed();
|
String authorPrefixed = post.getAuthorNamePrefixed();
|
||||||
|
|
||||||
if (mHideSubredditAndUserPrefix) {
|
((PostBaseViewHolder) holder).userTextView.setText((mShowDisplayNames) ? post.getAuthor() : post.getAuthorInfo().getUsername());
|
||||||
((PostBaseViewHolder) holder).subredditTextView.setText(post.getSubredditName());
|
((PostBaseViewHolder) holder).subredditTextView.setText((mShowDisplayNames) ? post.getSubredditName() : post.getCommunityInfo().getName());
|
||||||
((PostBaseViewHolder) holder).userTextView.setText(post.getAuthor());
|
if (!mHideSubredditAndUserPrefix) {
|
||||||
} else {
|
|
||||||
((PostBaseViewHolder) holder).subredditTextView.setText(post.getSubredditName());
|
|
||||||
((PostBaseViewHolder) holder).communityInstanceTextView.setText('@' + post.getSubredditNamePrefixed().split(Pattern.quote("@"))[1]);
|
((PostBaseViewHolder) holder).communityInstanceTextView.setText('@' + post.getSubredditNamePrefixed().split(Pattern.quote("@"))[1]);
|
||||||
((PostBaseViewHolder) holder).userTextView.setText(post.getAuthor());
|
|
||||||
((PostBaseViewHolder) holder).userInstanceTextView.setText('@' + post.getAuthorNamePrefixed().split(Pattern.quote("@"))[1]);
|
((PostBaseViewHolder) holder).userInstanceTextView.setText('@' + post.getAuthorNamePrefixed().split(Pattern.quote("@"))[1]);
|
||||||
((PostBaseViewHolder) holder).communityInstanceTextView.setTextColor(CustomThemeWrapper.darkenColor(mSubredditColor, 0.7f));
|
((PostBaseViewHolder) holder).communityInstanceTextView.setTextColor(CustomThemeWrapper.darkenColor(mSubredditColor, 0.7f));
|
||||||
((PostBaseViewHolder) holder).userInstanceTextView.setTextColor(CustomThemeWrapper.darkenColor(post.isModerator() || post.isAdmin() ? mModeratorColor : mUsernameColor, 0.7f));
|
((PostBaseViewHolder) holder).userInstanceTextView.setTextColor(CustomThemeWrapper.darkenColor(post.isModerator() || post.isAdmin() ? mModeratorColor : mUsernameColor, 0.7f));
|
||||||
@ -599,10 +598,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
|||||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
|
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
|
||||||
.into(((PostBaseViewHolder) holder).iconGifImageView);
|
.into(((PostBaseViewHolder) holder).iconGifImageView);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (holder.getBindingAdapterPosition() >= 0) {
|
|
||||||
post.setSubredditIconUrl(iconUrl);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (!post.getSubredditIconUrl().equals("")) {
|
} else if (!post.getSubredditIconUrl().equals("")) {
|
||||||
@ -1191,9 +1186,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
|||||||
.into(((PostCompactBaseViewHolder) holder).iconGifImageView);
|
.into(((PostCompactBaseViewHolder) holder).iconGifImageView);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (holder.getBindingAdapterPosition() >= 0) {
|
|
||||||
post.setSubredditIconUrl(iconUrl);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (!post.getSubredditIconUrl().equals("")) {
|
} else if (!post.getSubredditIconUrl().equals("")) {
|
||||||
@ -1210,10 +1202,8 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
|||||||
}
|
}
|
||||||
|
|
||||||
((PostCompactBaseViewHolder) holder).nameTextView.setTextColor(mSubredditColor);
|
((PostCompactBaseViewHolder) holder).nameTextView.setTextColor(mSubredditColor);
|
||||||
if (mHideSubredditAndUserPrefix) {
|
((PostCompactBaseViewHolder) holder).nameTextView.setText((mShowDisplayNames) ? post.getAuthor() : post.getAuthorInfo().getUsername());
|
||||||
((PostCompactBaseViewHolder) holder).nameTextView.setText(post.getSubredditName());
|
if (!mHideSubredditAndUserPrefix) {
|
||||||
} else {
|
|
||||||
((PostCompactBaseViewHolder) holder).nameTextView.setText(post.getSubredditName());
|
|
||||||
((PostCompactBaseViewHolder) holder).instanceTextView.setText('@' + post.getSubredditNamePrefixed().split(Pattern.quote("@"))[1]);
|
((PostCompactBaseViewHolder) holder).instanceTextView.setText('@' + post.getSubredditNamePrefixed().split(Pattern.quote("@"))[1]);
|
||||||
((PostCompactBaseViewHolder) holder).instanceTextView.setTextColor(CustomThemeWrapper.darkenColor(mSubredditColor, 0.7f));
|
((PostCompactBaseViewHolder) holder).instanceTextView.setTextColor(CustomThemeWrapper.darkenColor(mSubredditColor, 0.7f));
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,9 @@ 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;
|
||||||
|
|
||||||
|
import eu.toldi.infinityforlemmy.community.BasicCommunityInfo;
|
||||||
import eu.toldi.infinityforlemmy.postfilter.PostFilter;
|
import eu.toldi.infinityforlemmy.postfilter.PostFilter;
|
||||||
|
import eu.toldi.infinityforlemmy.user.BasicUserInfo;
|
||||||
import eu.toldi.infinityforlemmy.utils.JSONUtils;
|
import eu.toldi.infinityforlemmy.utils.JSONUtils;
|
||||||
import eu.toldi.infinityforlemmy.utils.LemmyUtils;
|
import eu.toldi.infinityforlemmy.utils.LemmyUtils;
|
||||||
import eu.toldi.infinityforlemmy.utils.Utils;
|
import eu.toldi.infinityforlemmy.utils.Utils;
|
||||||
@ -188,25 +190,25 @@ public class ParsePost {
|
|||||||
boolean saved = data.getBoolean("saved");
|
boolean saved = data.getBoolean("saved");
|
||||||
String distinguished = (creator.getBoolean("admin") ? "admin" : "");
|
String distinguished = (creator.getBoolean("admin") ? "admin" : "");
|
||||||
String suggestedSort = "";
|
String suggestedSort = "";
|
||||||
ArrayList <Post.Preview> previews = new ArrayList<>();
|
ArrayList<Post.Preview> previews = new ArrayList<>();
|
||||||
if(!post.isNull("thumbnail_url")) {
|
if (!post.isNull("thumbnail_url")) {
|
||||||
String thumbnail = post.getString("thumbnail_url");
|
String thumbnail = post.getString("thumbnail_url");
|
||||||
//int[] wh_array = getImageDimension(thumbnail);
|
//int[] wh_array = getImageDimension(thumbnail);
|
||||||
previews.add(new Post.Preview(thumbnail, 0, 0, "", ""));
|
previews.add(new Post.Preview(thumbnail, 0, 0, "", ""));
|
||||||
}
|
}
|
||||||
|
BasicUserInfo authorInfo = new BasicUserInfo(creator.getInt("id"), author, authorFull, creator.optString("avatar", ""), creator.optString("display_name", author));
|
||||||
|
BasicCommunityInfo communityInfo = new BasicCommunityInfo(community.getInt("id"), subredditName, subredditNamePrefixed, community.optString("icon", ""), community.optString("title", subredditName));
|
||||||
|
|
||||||
|
return parseData(data, permalink, id, communityInfo,
|
||||||
return parseData(data, permalink, id, fullName, subredditName, subredditNamePrefixed,
|
authorInfo, postTimeMillis, title, previews,
|
||||||
author,authorFull, postTimeMillis, title, previews,
|
downvotes, upvotes, voteType, nComments, upvoteRatio, nsfw, locked, saved,
|
||||||
downvotes,upvotes, voteType, nComments, upvoteRatio, nsfw, locked, saved,
|
distinguished, suggestedSort);
|
||||||
distinguished, suggestedSort);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Post parseData(JSONObject data, String permalink, int id, String fullName,
|
private static Post parseData(JSONObject data, String permalink, int id, BasicCommunityInfo communityInfo, BasicUserInfo author,
|
||||||
String subredditName, String subredditNamePrefixed, String author, String authorFull,
|
|
||||||
long postTimeMillis, String title, ArrayList<Post.Preview> previews,
|
long postTimeMillis, String title, ArrayList<Post.Preview> previews,
|
||||||
int downvotes,int upvotes, int voteType, int nComments, int upvoteRatio,
|
int downvotes, int upvotes, int voteType, int nComments, int upvoteRatio,
|
||||||
boolean nsfw, boolean locked,
|
boolean nsfw, boolean locked,
|
||||||
boolean saved,
|
boolean saved,
|
||||||
String distinguished, String suggestedSort) throws JSONException {
|
String distinguished, String suggestedSort) throws JSONException {
|
||||||
@ -228,7 +230,7 @@ public class ParsePost {
|
|||||||
if (!data.getJSONObject("post").isNull("body") && url.equals("")) {
|
if (!data.getJSONObject("post").isNull("body") && url.equals("")) {
|
||||||
//Text post
|
//Text post
|
||||||
int postType = Post.TEXT_TYPE;
|
int postType = Post.TEXT_TYPE;
|
||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull,
|
post = new Post(id, communityInfo, author,
|
||||||
postTimeMillis, title, permalink, downvotes, upvotes,
|
postTimeMillis, title, permalink, downvotes, upvotes,
|
||||||
postType, voteType, nComments, upvoteRatio, nsfw,
|
postType, voteType, nComments, upvoteRatio, nsfw,
|
||||||
locked, saved, distinguished, suggestedSort);
|
locked, saved, distinguished, suggestedSort);
|
||||||
@ -241,9 +243,9 @@ public class ParsePost {
|
|||||||
//Image post
|
//Image post
|
||||||
int postType = Post.IMAGE_TYPE;
|
int postType = Post.IMAGE_TYPE;
|
||||||
|
|
||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull,
|
post = new Post(id, communityInfo, author,
|
||||||
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
||||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
|
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
|
||||||
|
|
||||||
if (previews.isEmpty()) {
|
if (previews.isEmpty()) {
|
||||||
previews.add(new Post.Preview(url, 0, 0, "", ""));
|
previews.add(new Post.Preview(url, 0, 0, "", ""));
|
||||||
@ -254,7 +256,7 @@ public class ParsePost {
|
|||||||
//No preview video post
|
//No preview video post
|
||||||
int postType = Post.VIDEO_TYPE;
|
int postType = Post.VIDEO_TYPE;
|
||||||
|
|
||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull, postTimeMillis, title, permalink, downvotes,upvotes, postType, voteType,
|
post = new Post(id, communityInfo, author, postTimeMillis, title, permalink, downvotes, upvotes, postType, voteType,
|
||||||
nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
|
nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
|
||||||
|
|
||||||
post.setVideoUrl(url);
|
post.setVideoUrl(url);
|
||||||
@ -262,7 +264,7 @@ public class ParsePost {
|
|||||||
} else if (!url.equals("")) {
|
} else if (!url.equals("")) {
|
||||||
//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, authorFull,
|
post = new Post(id, communityInfo, author,
|
||||||
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
||||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
|
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
|
||||||
if (data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
if (data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
||||||
@ -296,7 +298,7 @@ public class ParsePost {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int postType = Post.TEXT_TYPE;
|
int postType = Post.TEXT_TYPE;
|
||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull,
|
post = new Post(id, communityInfo, author,
|
||||||
postTimeMillis, title, permalink, downvotes, upvotes,
|
postTimeMillis, title, permalink, downvotes, upvotes,
|
||||||
postType, voteType, nComments, upvoteRatio, nsfw,
|
postType, voteType, nComments, upvoteRatio, nsfw,
|
||||||
locked, saved, distinguished, suggestedSort);
|
locked, saved, distinguished, suggestedSort);
|
||||||
@ -335,7 +337,7 @@ 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, authorFull, postTimeMillis, title, permalink, downvotes, upvotes, postType, voteType,
|
post = new Post(id, communityInfo, author, postTimeMillis, title, permalink, downvotes, upvotes, postType, voteType,
|
||||||
nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
|
nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
|
||||||
|
|
||||||
post.setPreviews(previews);
|
post.setPreviews(previews);
|
||||||
@ -346,8 +348,8 @@ public class ParsePost {
|
|||||||
//Image post
|
//Image post
|
||||||
int postType = Post.IMAGE_TYPE;
|
int postType = Post.IMAGE_TYPE;
|
||||||
|
|
||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
|
post = new Post(id, communityInfo, author,
|
||||||
authorFull, postTimeMillis, title, url, permalink, downvotes, upvotes,
|
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
||||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved,
|
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved,
|
||||||
distinguished, suggestedSort);
|
distinguished, suggestedSort);
|
||||||
|
|
||||||
@ -358,7 +360,7 @@ public class ParsePost {
|
|||||||
} else if (path.endsWith(".gif")) {
|
} else if (path.endsWith(".gif")) {
|
||||||
//Gif post
|
//Gif post
|
||||||
int postType = Post.GIF_TYPE;
|
int postType = Post.GIF_TYPE;
|
||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull,
|
post = new Post(id, communityInfo, author,
|
||||||
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
||||||
postType, voteType, nComments, upvoteRatio,
|
postType, voteType, nComments, upvoteRatio,
|
||||||
nsfw, locked, saved,
|
nsfw, locked, saved,
|
||||||
@ -374,7 +376,7 @@ public class ParsePost {
|
|||||||
url = url.substring(0, url.length() - 5) + ".mp4";
|
url = url.substring(0, url.length() - 5) + ".mp4";
|
||||||
}
|
}
|
||||||
|
|
||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull,
|
post = new Post(id, communityInfo, author,
|
||||||
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
||||||
postType, voteType, nComments, upvoteRatio,
|
postType, voteType, nComments, upvoteRatio,
|
||||||
nsfw, locked, saved,
|
nsfw, locked, saved,
|
||||||
@ -387,7 +389,7 @@ public class ParsePost {
|
|||||||
//Video post
|
//Video post
|
||||||
int postType = Post.VIDEO_TYPE;
|
int postType = Post.VIDEO_TYPE;
|
||||||
|
|
||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull,
|
post = new Post(id, communityInfo, author,
|
||||||
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
||||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved,
|
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved,
|
||||||
distinguished, suggestedSort);
|
distinguished, suggestedSort);
|
||||||
@ -398,7 +400,7 @@ public class ParsePost {
|
|||||||
//Link post
|
//Link post
|
||||||
int postType = Post.LINK_TYPE;
|
int postType = Post.LINK_TYPE;
|
||||||
|
|
||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFull,
|
post = new Post(id, communityInfo, author,
|
||||||
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
||||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved,
|
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved,
|
||||||
distinguished, suggestedSort);
|
distinguished, suggestedSort);
|
||||||
@ -439,7 +441,7 @@ public class ParsePost {
|
|||||||
//Image post
|
//Image post
|
||||||
int postType = Post.IMAGE_TYPE;
|
int postType = Post.IMAGE_TYPE;
|
||||||
|
|
||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,authorFull,
|
post = new Post(id, communityInfo, author,
|
||||||
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
||||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
|
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
|
||||||
|
|
||||||
@ -451,7 +453,7 @@ public class ParsePost {
|
|||||||
//Video post
|
//Video post
|
||||||
int postType = Post.VIDEO_TYPE;
|
int postType = Post.VIDEO_TYPE;
|
||||||
|
|
||||||
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,authorFull,
|
post = new Post(id, communityInfo, author,
|
||||||
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
||||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
|
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
|
||||||
post.setPreviews(previews);
|
post.setPreviews(previews);
|
||||||
@ -461,9 +463,9 @@ public class ParsePost {
|
|||||||
//CP No Preview Link post
|
//CP 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,authorFull,
|
post = new Post(id, communityInfo, author,
|
||||||
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
postTimeMillis, title, url, permalink, downvotes, upvotes,
|
||||||
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
|
postType, voteType, nComments, upvoteRatio, nsfw, locked, saved, distinguished, suggestedSort);
|
||||||
//Need attention
|
//Need attention
|
||||||
if (data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
if (data.isNull(JSONUtils.SELFTEXT_KEY)) {
|
||||||
post.setSelfText("");
|
post.setSelfText("");
|
||||||
@ -579,7 +581,7 @@ public class ParsePost {
|
|||||||
singleGalleryObject.getJSONObject(JSONUtils.S_KEY).getInt(JSONUtils.Y_KEY), galleryItemCaption, galleryItemCaptionUrl));
|
singleGalleryObject.getJSONObject(JSONUtils.S_KEY).getInt(JSONUtils.Y_KEY), galleryItemCaption, galleryItemCaptionUrl));
|
||||||
}
|
}
|
||||||
|
|
||||||
Post.Gallery postGalleryItem = new Post.Gallery(mimeType, galleryItemUrl, "", subredditName + "-" + galleryId + "." + mimeType.substring(mimeType.lastIndexOf("/") + 1), galleryItemCaption, galleryItemCaptionUrl);
|
Post.Gallery postGalleryItem = new Post.Gallery(mimeType, galleryItemUrl, "", communityInfo.getDisplayName() + "-" + galleryId + "." + mimeType.substring(mimeType.lastIndexOf("/") + 1), galleryItemCaption, galleryItemCaptionUrl);
|
||||||
|
|
||||||
// For issue #558
|
// For issue #558
|
||||||
// Construct a fallback image url
|
// Construct a fallback image url
|
||||||
@ -675,8 +677,8 @@ public class ParsePost {
|
|||||||
if (data.getJSONObject("post").getBoolean("featured_local")) {
|
if (data.getJSONObject("post").getBoolean("featured_local")) {
|
||||||
post.setFeaturedOnInstance(true);
|
post.setFeaturedOnInstance(true);
|
||||||
}
|
}
|
||||||
post.setAuthorIconUrl(authorAvatar);
|
|
||||||
post.setSubredditIconUrl(communityURL);
|
|
||||||
return post;
|
return post;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,9 @@ import androidx.annotation.Nullable;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import eu.toldi.infinityforlemmy.community.BasicCommunityInfo;
|
||||||
|
import eu.toldi.infinityforlemmy.user.BasicUserInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by alex on 3/1/18.
|
* Created by alex on 3/1/18.
|
||||||
*/
|
*/
|
||||||
@ -33,13 +36,8 @@ public class Post implements Parcelable {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
private int id;
|
private int id;
|
||||||
private String fullName;
|
private BasicCommunityInfo communityInfo;
|
||||||
private String subredditName;
|
private BasicUserInfo author;
|
||||||
private String subredditNamePrefixed;
|
|
||||||
private String subredditIconUrl;
|
|
||||||
private String author;
|
|
||||||
private String authorNamePrefixed;
|
|
||||||
private String authorIconUrl;
|
|
||||||
private String title;
|
private String title;
|
||||||
private String selfText;
|
private String selfText;
|
||||||
private String selfTextPlain;
|
private String selfTextPlain;
|
||||||
@ -80,18 +78,15 @@ public class Post implements Parcelable {
|
|||||||
private ArrayList<Preview> previews = new ArrayList<>();
|
private ArrayList<Preview> previews = new ArrayList<>();
|
||||||
private ArrayList<Gallery> gallery = new ArrayList<>();
|
private ArrayList<Gallery> gallery = new ArrayList<>();
|
||||||
|
|
||||||
public Post(int id, String fullName, String subredditName, String subredditNamePrefixed,
|
public Post(int id, BasicCommunityInfo communityInfo,
|
||||||
String author,String authorNamePrefixed, long postTimeMillis,
|
BasicUserInfo userInfo, long postTimeMillis,
|
||||||
String title, String permalink, int downvotes,int upvotes, int postType, int voteType, int nComments,
|
String title, String permalink, int downvotes, int upvotes, int postType, int voteType, int nComments,
|
||||||
int upvoteRatio,
|
int upvoteRatio,
|
||||||
boolean nsfw, boolean locked, boolean saved,
|
boolean nsfw, boolean locked, boolean saved,
|
||||||
String distinguished, String suggestedSort) {
|
String distinguished, String suggestedSort) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.fullName = fullName;
|
this.communityInfo = communityInfo;
|
||||||
this.subredditName = subredditName;
|
this.author = userInfo;
|
||||||
this.subredditNamePrefixed = subredditNamePrefixed;
|
|
||||||
this.author = author;
|
|
||||||
this.authorNamePrefixed = authorNamePrefixed;
|
|
||||||
this.postTimeMillis = postTimeMillis;
|
this.postTimeMillis = postTimeMillis;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.permalink = permalink;
|
this.permalink = permalink;
|
||||||
@ -112,17 +107,14 @@ public class Post implements Parcelable {
|
|||||||
isRead = false;
|
isRead = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Post(int id, String fullName, String subredditName, String subredditNamePrefixed,
|
public Post(int id, BasicCommunityInfo communityInfo,
|
||||||
String author, String authorNamePrefixed, long postTimeMillis, String title,
|
BasicUserInfo author, long postTimeMillis, String title,
|
||||||
String url, String permalink, int downvotes,int upvotes, int postType, int voteType, int nComments,
|
String url, String permalink, int downvotes, int upvotes, int postType, int voteType, int nComments,
|
||||||
int upvoteRatio,
|
int upvoteRatio,
|
||||||
boolean nsfw, boolean locked, boolean saved, String distinguished, String suggestedSort) {
|
boolean nsfw, boolean locked, boolean saved, String distinguished, String suggestedSort) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.fullName = fullName;
|
this.communityInfo = communityInfo;
|
||||||
this.subredditName = subredditName;
|
|
||||||
this.subredditNamePrefixed = subredditNamePrefixed;
|
|
||||||
this.author = author;
|
this.author = author;
|
||||||
this.authorNamePrefixed = authorNamePrefixed;
|
|
||||||
this.postTimeMillis = postTimeMillis;
|
this.postTimeMillis = postTimeMillis;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.url = url;
|
this.url = url;
|
||||||
@ -146,13 +138,8 @@ public class Post implements Parcelable {
|
|||||||
|
|
||||||
protected Post(Parcel in) {
|
protected Post(Parcel in) {
|
||||||
id = in.readInt();
|
id = in.readInt();
|
||||||
fullName = in.readString();
|
communityInfo = in.readParcelable(BasicCommunityInfo.class.getClassLoader());
|
||||||
subredditName = in.readString();
|
author = in.readParcelable(BasicUserInfo.class.getClassLoader());
|
||||||
subredditNamePrefixed = in.readString();
|
|
||||||
subredditIconUrl = in.readString();
|
|
||||||
author = in.readString();
|
|
||||||
authorNamePrefixed = in.readString();
|
|
||||||
authorIconUrl = in.readString();
|
|
||||||
postTimeMillis = in.readLong();
|
postTimeMillis = in.readLong();
|
||||||
title = in.readString();
|
title = in.readString();
|
||||||
selfText = in.readString();
|
selfText = in.readString();
|
||||||
@ -195,27 +182,24 @@ public class Post implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getFullName() {
|
public String getFullName() {
|
||||||
return fullName;
|
return communityInfo.getQualifiedName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSubredditName() {
|
public String getSubredditName() {
|
||||||
return subredditName;
|
return communityInfo.getDisplayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSubredditNamePrefixed() {
|
public String getSubredditNamePrefixed() {
|
||||||
return subredditNamePrefixed;
|
return communityInfo.getQualifiedName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSubredditIconUrl() {
|
public String getSubredditIconUrl() {
|
||||||
return subredditIconUrl;
|
return communityInfo.getIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSubredditIconUrl(String subredditIconUrl) {
|
|
||||||
this.subredditIconUrl = subredditIconUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAuthor() {
|
public String getAuthor() {
|
||||||
return author;
|
return author.getDisplayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAuthorDeleted() {
|
public boolean isAuthorDeleted() {
|
||||||
@ -223,20 +207,19 @@ public class Post implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setAuthor(String author) {
|
public void setAuthor(String author) {
|
||||||
this.author = author;
|
|
||||||
this.authorNamePrefixed = "u/" + author;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAuthorNamePrefixed() {
|
public String getAuthorNamePrefixed() {
|
||||||
return authorNamePrefixed;
|
return author.getQualifiedName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAuthorIconUrl() {
|
public String getAuthorIconUrl() {
|
||||||
return authorIconUrl;
|
return (author.getAvatar() == null) ? "" : author.getAvatar();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAuthorIconUrl(String authorIconUrl) {
|
public void setAuthorIconUrl(String authorIconUrl) {
|
||||||
this.authorIconUrl = authorIconUrl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getPostTimeMillis() {
|
public long getPostTimeMillis() {
|
||||||
@ -512,16 +495,19 @@ public class Post implements Parcelable {
|
|||||||
this.gallery = gallery;
|
this.gallery = gallery;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BasicCommunityInfo getCommunityInfo() {
|
||||||
|
return communityInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BasicUserInfo getAuthorInfo() {
|
||||||
|
return author;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToParcel(Parcel parcel, int i) {
|
public void writeToParcel(Parcel parcel, int i) {
|
||||||
parcel.writeInt(id);
|
parcel.writeInt(id);
|
||||||
parcel.writeString(fullName);
|
parcel.writeParcelable(communityInfo, i);
|
||||||
parcel.writeString(subredditName);
|
parcel.writeParcelable(author, i);
|
||||||
parcel.writeString(subredditNamePrefixed);
|
|
||||||
parcel.writeString(subredditIconUrl);
|
|
||||||
parcel.writeString(author);
|
|
||||||
parcel.writeString(authorNamePrefixed);
|
|
||||||
parcel.writeString(authorIconUrl);
|
|
||||||
parcel.writeLong(postTimeMillis);
|
parcel.writeLong(postTimeMillis);
|
||||||
parcel.writeString(title);
|
parcel.writeString(title);
|
||||||
parcel.writeString(selfText);
|
parcel.writeString(selfText);
|
||||||
|
@ -54,6 +54,10 @@ public class SharedPreferencesUtils {
|
|||||||
|
|
||||||
public static final String COMMENT_SEPARATE_UP_AND_DOWN_VOTES = "comment_separate_down_and_up_votes";
|
public static final String COMMENT_SEPARATE_UP_AND_DOWN_VOTES = "comment_separate_down_and_up_votes";
|
||||||
|
|
||||||
|
public static final String POST_DISPLAY_NAME_INSTEAD_OF_USERNAME = "post_display_name_instead_of_user_name";
|
||||||
|
|
||||||
|
public static final String POST_DETAIL_DISPLAY_NAME_INSTEAD_OF_USERNAME = "post_detail_display_name_instead_of_user_name";
|
||||||
|
|
||||||
public static final String SORT_TYPE_SHARED_PREFERENCES_FILE = "eu.toldi.infinityforlemmy.sort_type";
|
public static final String SORT_TYPE_SHARED_PREFERENCES_FILE = "eu.toldi.infinityforlemmy.sort_type";
|
||||||
public static final String SORT_TYPE_BEST_POST = "sort_type_best_post";
|
public static final String SORT_TYPE_BEST_POST = "sort_type_best_post";
|
||||||
public static final String SORT_TIME_BEST_POST = "sort_time_best_post";
|
public static final String SORT_TIME_BEST_POST = "sort_time_best_post";
|
||||||
|
@ -0,0 +1,43 @@
|
|||||||
|
package eu.toldi.infinityforlemmy.community
|
||||||
|
|
||||||
|
import android.os.Parcel
|
||||||
|
import android.os.Parcelable
|
||||||
|
|
||||||
|
data class BasicCommunityInfo(
|
||||||
|
val id: Int,
|
||||||
|
val name: String,
|
||||||
|
val qualifiedName: String,
|
||||||
|
val icon: String?,
|
||||||
|
val displayName: String
|
||||||
|
) : Parcelable {
|
||||||
|
constructor(parcel: Parcel) : this(
|
||||||
|
parcel.readInt(),
|
||||||
|
parcel.readString()!!,
|
||||||
|
parcel.readString()!!,
|
||||||
|
parcel.readString(),
|
||||||
|
parcel.readString()!!
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||||
|
parcel.writeInt(id)
|
||||||
|
parcel.writeString(name)
|
||||||
|
parcel.writeString(qualifiedName)
|
||||||
|
parcel.writeString(icon)
|
||||||
|
parcel.writeString(displayName)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun describeContents(): Int {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object CREATOR : Parcelable.Creator<BasicCommunityInfo> {
|
||||||
|
override fun createFromParcel(parcel: Parcel): BasicCommunityInfo {
|
||||||
|
return BasicCommunityInfo(parcel)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun newArray(size: Int): Array<BasicCommunityInfo?> {
|
||||||
|
return arrayOfNulls(size)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
package eu.toldi.infinityforlemmy.user
|
||||||
|
|
||||||
|
import android.os.Parcel
|
||||||
|
import android.os.Parcelable
|
||||||
|
|
||||||
|
data class BasicUserInfo(
|
||||||
|
val id: Int,
|
||||||
|
val username: String,
|
||||||
|
val qualifiedName: String,
|
||||||
|
val avatar: String?,
|
||||||
|
val displayName: String
|
||||||
|
) : Parcelable {
|
||||||
|
constructor(parcel: Parcel) : this(
|
||||||
|
parcel.readInt(),
|
||||||
|
parcel.readString()!!,
|
||||||
|
parcel.readString()!!,
|
||||||
|
parcel.readString(),
|
||||||
|
parcel.readString()!!
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||||
|
parcel.writeInt(id)
|
||||||
|
parcel.writeString(username)
|
||||||
|
parcel.writeString(qualifiedName)
|
||||||
|
parcel.writeString(avatar)
|
||||||
|
parcel.writeString(displayName)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun describeContents(): Int {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object CREATOR : Parcelable.Creator<BasicUserInfo> {
|
||||||
|
override fun createFromParcel(parcel: Parcel): BasicUserInfo {
|
||||||
|
return BasicUserInfo(parcel)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun newArray(size: Int): Array<BasicUserInfo?> {
|
||||||
|
return arrayOfNulls(size)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1365,4 +1365,6 @@
|
|||||||
<string name="action_unblock_user">Unblock User</string>
|
<string name="action_unblock_user">Unblock User</string>
|
||||||
<string name="unblock_user_success">Unblocked</string>
|
<string name="unblock_user_success">Unblocked</string>
|
||||||
<string name="unblock_user_failed">Failed to unblock user</string>
|
<string name="unblock_user_failed">Failed to unblock user</string>
|
||||||
|
<string name="settings_hide_community_and_user_instance">Hide community and user instance</string>
|
||||||
|
<string name="settings_show_display_name_instead_of_user_name">Show community and user display names</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -25,7 +25,13 @@
|
|||||||
<eu.toldi.infinityforlemmy.customviews.CustomFontSwitchPreference
|
<eu.toldi.infinityforlemmy.customviews.CustomFontSwitchPreference
|
||||||
app:defaultValue="false"
|
app:defaultValue="false"
|
||||||
app:key="hide_subreddit_and_user_prefix"
|
app:key="hide_subreddit_and_user_prefix"
|
||||||
app:title="@string/settings_hide_community_and_user_prefix" />
|
app:title="@string/settings_hide_community_and_user_instance" />
|
||||||
|
|
||||||
|
<eu.toldi.infinityforlemmy.customviews.CustomFontSwitchPreference
|
||||||
|
app:defaultValue="true"
|
||||||
|
app:key="post_detail_display_name_instead_of_user_name"
|
||||||
|
app:title="@string/settings_show_display_name_instead_of_user_name" />
|
||||||
|
|
||||||
|
|
||||||
<eu.toldi.infinityforlemmy.customviews.CustomFontSwitchPreference
|
<eu.toldi.infinityforlemmy.customviews.CustomFontSwitchPreference
|
||||||
app:defaultValue="false"
|
app:defaultValue="false"
|
||||||
|
@ -31,7 +31,12 @@
|
|||||||
<eu.toldi.infinityforlemmy.customviews.CustomFontSwitchPreference
|
<eu.toldi.infinityforlemmy.customviews.CustomFontSwitchPreference
|
||||||
app:defaultValue="false"
|
app:defaultValue="false"
|
||||||
app:key="hide_subreddit_and_user_prefix"
|
app:key="hide_subreddit_and_user_prefix"
|
||||||
app:title="@string/settings_hide_community_and_user_prefix" />
|
app:title="@string/settings_hide_community_and_user_instance" />
|
||||||
|
|
||||||
|
<eu.toldi.infinityforlemmy.customviews.CustomFontSwitchPreference
|
||||||
|
app:defaultValue="true"
|
||||||
|
app:key="post_display_name_instead_of_user_name"
|
||||||
|
app:title="@string/settings_show_display_name_instead_of_user_name" />
|
||||||
|
|
||||||
<eu.toldi.infinityforlemmy.customviews.CustomFontSwitchPreference
|
<eu.toldi.infinityforlemmy.customviews.CustomFontSwitchPreference
|
||||||
app:defaultValue="false"
|
app:defaultValue="false"
|
||||||
|
Loading…
Reference in New Issue
Block a user