mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-01-15 20:53:07 +01:00
Added option to show displayname and hide the instance for comment author names
This commit is contained in:
parent
4010e02438
commit
f14ebe9a0d
@ -450,7 +450,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
|
|||||||
Comment comment = getItem(getBindingAdapterPosition());
|
Comment comment = getItem(getBindingAdapterPosition());
|
||||||
if (comment != null) {
|
if (comment != null) {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
if (comment.getAuthor().equals(mAccountName)) {
|
if (comment.getAuthorName().equals(mAccountName)) {
|
||||||
bundle.putBoolean(CommentMoreBottomSheetFragment.EXTRA_EDIT_AND_DELETE_AVAILABLE, true);
|
bundle.putBoolean(CommentMoreBottomSheetFragment.EXTRA_EDIT_AND_DELETE_AVAILABLE, true);
|
||||||
}
|
}
|
||||||
bundle.putString(CommentMoreBottomSheetFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
|
bundle.putString(CommentMoreBottomSheetFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
|
||||||
|
@ -39,10 +39,12 @@ import java.util.List;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import eu.toldi.infinityforlemmy.R;
|
import eu.toldi.infinityforlemmy.R;
|
||||||
|
import eu.toldi.infinityforlemmy.RetrofitHolder;
|
||||||
import eu.toldi.infinityforlemmy.SaveComment;
|
import eu.toldi.infinityforlemmy.SaveComment;
|
||||||
import eu.toldi.infinityforlemmy.SaveThing;
|
import eu.toldi.infinityforlemmy.SaveThing;
|
||||||
import eu.toldi.infinityforlemmy.SortType;
|
import eu.toldi.infinityforlemmy.SortType;
|
||||||
@ -95,7 +97,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
|||||||
private BaseActivity mActivity;
|
private BaseActivity mActivity;
|
||||||
private ViewPostDetailFragment mFragment;
|
private ViewPostDetailFragment mFragment;
|
||||||
private Executor mExecutor;
|
private Executor mExecutor;
|
||||||
private Retrofit mRetrofit;
|
private RetrofitHolder mRetrofit;
|
||||||
private Retrofit mOauthRetrofit;
|
private Retrofit mOauthRetrofit;
|
||||||
private Markwon mCommentMarkwon;
|
private Markwon mCommentMarkwon;
|
||||||
private String mAccessToken;
|
private String mAccessToken;
|
||||||
@ -134,6 +136,9 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
|||||||
private boolean isInitiallyLoadingFailed;
|
private boolean isInitiallyLoadingFailed;
|
||||||
private boolean mHasMoreComments;
|
private boolean mHasMoreComments;
|
||||||
private boolean loadMoreCommentsFailed;
|
private boolean loadMoreCommentsFailed;
|
||||||
|
|
||||||
|
private boolean mHideUserInstance;
|
||||||
|
private boolean mShowUserDisplayName;
|
||||||
private Drawable expandDrawable;
|
private Drawable expandDrawable;
|
||||||
private Drawable collapseDrawable;
|
private Drawable collapseDrawable;
|
||||||
|
|
||||||
@ -165,7 +170,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
|||||||
|
|
||||||
public CommentsRecyclerViewAdapter(BaseActivity activity, ViewPostDetailFragment fragment,
|
public CommentsRecyclerViewAdapter(BaseActivity activity, ViewPostDetailFragment fragment,
|
||||||
CustomThemeWrapper customThemeWrapper,
|
CustomThemeWrapper customThemeWrapper,
|
||||||
Executor executor, Retrofit retrofit,
|
Executor executor, RetrofitHolder retrofit,
|
||||||
String accessToken, String accountName,
|
String accessToken, String accountName,
|
||||||
Post post, Locale locale, Integer singleCommentId,
|
Post post, Locale locale, Integer singleCommentId,
|
||||||
boolean isSingleCommentThreadMode,
|
boolean isSingleCommentThreadMode,
|
||||||
@ -242,6 +247,8 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
|||||||
mShowAuthorAvatar = sharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_AUTHOR_AVATAR, false);
|
mShowAuthorAvatar = sharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_AUTHOR_AVATAR, false);
|
||||||
mAlwaysShowChildCommentCount = sharedPreferences.getBoolean(SharedPreferencesUtils.ALWAYS_SHOW_CHILD_COMMENT_COUNT, false);
|
mAlwaysShowChildCommentCount = sharedPreferences.getBoolean(SharedPreferencesUtils.ALWAYS_SHOW_CHILD_COMMENT_COUNT, false);
|
||||||
mHideTheNumberOfVotes = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_VOTES_IN_COMMENTS, false);
|
mHideTheNumberOfVotes = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_VOTES_IN_COMMENTS, false);
|
||||||
|
mHideUserInstance = sharedPreferences.getBoolean(SharedPreferencesUtils.COMMENT_HIDE_USER_INSTANCE, false);
|
||||||
|
mShowUserDisplayName = sharedPreferences.getBoolean(SharedPreferencesUtils.COMMENT_DISPLAY_NAME_INSTEAD_OF_USERNAME, true);
|
||||||
mHideDownvotes = !currentAccountSharedPreferences.getBoolean(SharedPreferencesUtils.CAN_DOWNVOTE, true);
|
mHideDownvotes = !currentAccountSharedPreferences.getBoolean(SharedPreferencesUtils.CAN_DOWNVOTE, true);
|
||||||
mSeperateUpandDownvote = sharedPreferences.getBoolean(SharedPreferencesUtils.COMMENT_SEPARATE_UP_AND_DOWN_VOTES, true) && !mHideDownvotes;
|
mSeperateUpandDownvote = sharedPreferences.getBoolean(SharedPreferencesUtils.COMMENT_SEPARATE_UP_AND_DOWN_VOTES, true) && !mHideDownvotes;
|
||||||
mDepthThreshold = sharedPreferences.getInt(SharedPreferencesUtils.SHOW_FEWER_TOOLBAR_OPTIONS_THRESHOLD, 5);
|
mDepthThreshold = sharedPreferences.getInt(SharedPreferencesUtils.SHOW_FEWER_TOOLBAR_OPTIONS_THRESHOLD, 5);
|
||||||
@ -375,9 +382,9 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
|||||||
if (mIsSingleCommentThreadMode && comment.getId() == mSingleCommentId) {
|
if (mIsSingleCommentThreadMode && comment.getId() == mSingleCommentId) {
|
||||||
holder.itemView.setBackgroundColor(mSingleCommentThreadBackgroundColor);
|
holder.itemView.setBackgroundColor(mSingleCommentThreadBackgroundColor);
|
||||||
}
|
}
|
||||||
|
String authorDisplayName = (mShowUserDisplayName) ? comment.getAuthorName() : comment.getAuthor().getUsername();
|
||||||
String authorPrefixed = comment.getAuthorQualifiedName();
|
String authorInstance = (mHideUserInstance) ? "" : "@" + comment.getAuthor().getQualifiedName().split(Pattern.quote("@"))[1];
|
||||||
((CommentViewHolder) holder).authorTextView.setText(authorPrefixed);
|
((CommentViewHolder) holder).authorTextView.setText(authorDisplayName + authorInstance);
|
||||||
|
|
||||||
|
|
||||||
if (comment.isSubmitter()) {
|
if (comment.isSubmitter()) {
|
||||||
@ -565,7 +572,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
|||||||
} else if (holder instanceof CommentFullyCollapsedViewHolder) {
|
} else if (holder instanceof CommentFullyCollapsedViewHolder) {
|
||||||
Comment comment = getCurrentComment(position);
|
Comment comment = getCurrentComment(position);
|
||||||
if (comment != null) {
|
if (comment != null) {
|
||||||
String authorWithPrefix = "u/" + comment.getAuthor();
|
String authorWithPrefix = "u/" + comment.getAuthorName();
|
||||||
((CommentFullyCollapsedViewHolder) holder).usernameTextView.setText(authorWithPrefix);
|
((CommentFullyCollapsedViewHolder) holder).usernameTextView.setText(authorWithPrefix);
|
||||||
|
|
||||||
if (comment.getAuthorIconUrl() == null) {
|
if (comment.getAuthorIconUrl() == null) {
|
||||||
@ -648,7 +655,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
|||||||
mVisibleComments.get(commentPosition).setLoadMoreChildrenFailed(false);
|
mVisibleComments.get(commentPosition).setLoadMoreChildrenFailed(false);
|
||||||
((LoadMoreChildCommentsViewHolder) holder).placeholderTextView.setText(R.string.loading);
|
((LoadMoreChildCommentsViewHolder) holder).placeholderTextView.setText(R.string.loading);
|
||||||
|
|
||||||
Retrofit retrofit = mRetrofit;
|
Retrofit retrofit = mRetrofit.getRetrofit();
|
||||||
SortType.Type sortType = mCommentRecyclerViewAdapterCallback.getSortType();
|
SortType.Type sortType = mCommentRecyclerViewAdapterCallback.getSortType();
|
||||||
FetchComment.fetchComments(mExecutor, new Handler(), retrofit, mAccessToken,
|
FetchComment.fetchComments(mExecutor, new Handler(), retrofit, mAccessToken,
|
||||||
mPost.getId(), parentComment.getId(), sortType,
|
mPost.getId(), parentComment.getId(), sortType,
|
||||||
@ -1479,7 +1486,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
|||||||
comment.getScore() + comment.getVoteType())));
|
comment.getScore() + comment.getVoteType())));
|
||||||
}
|
}
|
||||||
|
|
||||||
VoteThing.voteComment(mActivity, mRetrofit, mAccessToken, new VoteThing.VoteThingListener() {
|
VoteThing.voteComment(mActivity, mRetrofit.getRetrofit(), mAccessToken, new VoteThing.VoteThingListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onVoteThingSuccess(int position) {
|
public void onVoteThingSuccess(int position) {
|
||||||
int currentPosition = getBindingAdapterPosition();
|
int currentPosition = getBindingAdapterPosition();
|
||||||
@ -1586,7 +1593,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
|||||||
}
|
}
|
||||||
|
|
||||||
int position = getBindingAdapterPosition();
|
int position = getBindingAdapterPosition();
|
||||||
VoteThing.voteComment(mActivity, mRetrofit, mAccessToken, new VoteThing.VoteThingListener() {
|
VoteThing.voteComment(mActivity, mRetrofit.getRetrofit(), mAccessToken, new VoteThing.VoteThingListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onVoteThingSuccess(int position1) {
|
public void onVoteThingSuccess(int position1) {
|
||||||
int currentPosition = getBindingAdapterPosition();
|
int currentPosition = getBindingAdapterPosition();
|
||||||
@ -1594,9 +1601,9 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
|||||||
comment.setVoteType(Comment.VOTE_TYPE_DOWNVOTE);
|
comment.setVoteType(Comment.VOTE_TYPE_DOWNVOTE);
|
||||||
if (currentPosition == position) {
|
if (currentPosition == position) {
|
||||||
downvoteButton.setColorFilter(mDownvotedColor, PorterDuff.Mode.SRC_IN);
|
downvoteButton.setColorFilter(mDownvotedColor, PorterDuff.Mode.SRC_IN);
|
||||||
if(mSeperateUpandDownvote){
|
if (mSeperateUpandDownvote) {
|
||||||
downvoteTextView.setTextColor(mDownvotedColor);
|
downvoteTextView.setTextColor(mDownvotedColor);
|
||||||
}else {
|
} else {
|
||||||
scoreTextView.setTextColor(mDownvotedColor);
|
scoreTextView.setTextColor(mDownvotedColor);
|
||||||
}
|
}
|
||||||
topScoreTextView.setTextColor(mDownvotedColor);
|
topScoreTextView.setTextColor(mDownvotedColor);
|
||||||
@ -1646,7 +1653,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
|||||||
SaveComment saveComment = new SaveComment();
|
SaveComment saveComment = new SaveComment();
|
||||||
if (comment.isSaved()) {
|
if (comment.isSaved()) {
|
||||||
comment.setSaved(false);
|
comment.setSaved(false);
|
||||||
saveComment.unsaveThing(mRetrofit, mAccessToken, comment.getId(), new SaveThing.SaveThingListener() {
|
saveComment.unsaveThing(mRetrofit.getRetrofit(), mAccessToken, comment.getId(), new SaveThing.SaveThingListener() {
|
||||||
@Override
|
@Override
|
||||||
public void success() {
|
public void success() {
|
||||||
comment.setSaved(false);
|
comment.setSaved(false);
|
||||||
@ -1667,7 +1674,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
comment.setSaved(true);
|
comment.setSaved(true);
|
||||||
saveComment.saveThing(mRetrofit, mAccessToken, comment.getId(), new SaveThing.SaveThingListener() {
|
saveComment.saveThing(mRetrofit.getRetrofit(), mAccessToken, comment.getId(), new SaveThing.SaveThingListener() {
|
||||||
@Override
|
@Override
|
||||||
public void success() {
|
public void success() {
|
||||||
comment.setSaved(true);
|
comment.setSaved(true);
|
||||||
@ -1696,7 +1703,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Intent intent = new Intent(mActivity, ViewUserDetailActivity.class);
|
Intent intent = new Intent(mActivity, ViewUserDetailActivity.class);
|
||||||
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, comment.getAuthor());
|
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, comment.getAuthorName());
|
||||||
intent.putExtra(ViewUserDetailActivity.EXTRA_QUALIFIED_USER_NAME_KEY, comment.getAuthorQualifiedName());
|
intent.putExtra(ViewUserDetailActivity.EXTRA_QUALIFIED_USER_NAME_KEY, comment.getAuthorQualifiedName());
|
||||||
mActivity.startActivity(intent);
|
mActivity.startActivity(intent);
|
||||||
});
|
});
|
||||||
|
@ -217,7 +217,7 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<CommentInteract
|
|||||||
((DataViewHolder) holder).authorTextView.setOnClickListener(view -> {
|
((DataViewHolder) holder).authorTextView.setOnClickListener(view -> {
|
||||||
|
|
||||||
Intent intent = new Intent(mActivity, ViewUserDetailActivity.class);
|
Intent intent = new Intent(mActivity, ViewUserDetailActivity.class);
|
||||||
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, message.getComment().getAuthor());
|
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, message.getComment().getAuthorName());
|
||||||
intent.putExtra(ViewUserDetailActivity.EXTRA_QUALIFIED_USER_NAME_KEY, message.getComment().getAuthorQualifiedName());
|
intent.putExtra(ViewUserDetailActivity.EXTRA_QUALIFIED_USER_NAME_KEY, message.getComment().getAuthorQualifiedName());
|
||||||
mActivity.startActivity(intent);
|
mActivity.startActivity(intent);
|
||||||
});
|
});
|
||||||
|
@ -8,6 +8,7 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import eu.toldi.infinityforlemmy.BuildConfig;
|
import eu.toldi.infinityforlemmy.BuildConfig;
|
||||||
|
import eu.toldi.infinityforlemmy.user.BasicUserInfo;
|
||||||
|
|
||||||
public class Comment implements Parcelable {
|
public class Comment implements Parcelable {
|
||||||
public static final int VOTE_TYPE_NO_VOTE = 0;
|
public static final int VOTE_TYPE_NO_VOTE = 0;
|
||||||
@ -29,9 +30,7 @@ public class Comment implements Parcelable {
|
|||||||
};
|
};
|
||||||
private int id;
|
private int id;
|
||||||
private String fullName;
|
private String fullName;
|
||||||
private String author;
|
private BasicUserInfo author;
|
||||||
private String authorQualifiedName;
|
|
||||||
private String authorIconUrl;
|
|
||||||
private String linkAuthor;
|
private String linkAuthor;
|
||||||
private long commentTimeMillis;
|
private long commentTimeMillis;
|
||||||
private String commentMarkdown;
|
private String commentMarkdown;
|
||||||
@ -66,16 +65,14 @@ public class Comment implements Parcelable {
|
|||||||
private List<String> path;
|
private List<String> path;
|
||||||
private int postId;
|
private int postId;
|
||||||
|
|
||||||
public Comment(int id, int postId, String fullName, String author, String authorQualifiedName, String linkAuthor,
|
public Comment(int id, int postId, BasicUserInfo author, String linkAuthor,
|
||||||
long commentTimeMillis, String commentMarkdown, String commentRawText,
|
long commentTimeMillis, String commentMarkdown, String commentRawText,
|
||||||
String linkId, String communityName, String communityQualifiedName, Integer parentId, int downvotes,int upvotes,
|
String linkId, String communityName, String communityQualifiedName, Integer parentId, int downvotes, int upvotes,
|
||||||
int voteType, boolean isSubmitter, String distinguished, String permalink,
|
int voteType, boolean isSubmitter, String distinguished, String permalink,
|
||||||
int depth, boolean collapsed, boolean hasReply, boolean saved, boolean deleted, long edited, String[] path) {
|
int depth, boolean collapsed, boolean hasReply, boolean saved, boolean deleted, long edited, String[] path) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.postId = postId;
|
this.postId = postId;
|
||||||
this.fullName = fullName;
|
|
||||||
this.author = author;
|
this.author = author;
|
||||||
this.authorQualifiedName = authorQualifiedName;
|
|
||||||
this.linkAuthor = linkAuthor;
|
this.linkAuthor = linkAuthor;
|
||||||
this.commentTimeMillis = commentTimeMillis;
|
this.commentTimeMillis = commentTimeMillis;
|
||||||
this.commentMarkdown = commentMarkdown;
|
this.commentMarkdown = commentMarkdown;
|
||||||
@ -122,10 +119,7 @@ public class Comment implements Parcelable {
|
|||||||
protected Comment(Parcel in) {
|
protected Comment(Parcel in) {
|
||||||
id = in.readInt();
|
id = in.readInt();
|
||||||
postId = in.readInt();
|
postId = in.readInt();
|
||||||
fullName = in.readString();
|
author = in.readParcelable(BasicUserInfo.class.getClassLoader());
|
||||||
author = in.readString();
|
|
||||||
authorQualifiedName = in.readString();
|
|
||||||
authorIconUrl = in.readString();
|
|
||||||
linkAuthor = in.readString();
|
linkAuthor = in.readString();
|
||||||
commentTimeMillis = in.readLong();
|
commentTimeMillis = in.readLong();
|
||||||
commentMarkdown = in.readString();
|
commentMarkdown = in.readString();
|
||||||
@ -169,8 +163,8 @@ public class Comment implements Parcelable {
|
|||||||
return fullName;
|
return fullName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAuthor() {
|
public String getAuthorName() {
|
||||||
return author;
|
return author.getDisplayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAuthorDeleted() {
|
public boolean isAuthorDeleted() {
|
||||||
@ -178,16 +172,17 @@ public class Comment implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setAuthor(String author) {
|
public void setAuthor(String author) {
|
||||||
this.author = author;
|
//this.author = author;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getAuthorIconUrl() {
|
public String getAuthorIconUrl() {
|
||||||
return authorIconUrl;
|
return author.getAvatar();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAuthorIconUrl(String authorIconUrl) {
|
public void setAuthorIconUrl(String authorIconUrl) {
|
||||||
this.authorIconUrl = authorIconUrl;
|
|
||||||
|
//this.authorIconUrl = authorIconUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLinkAuthor() {
|
public String getLinkAuthor() {
|
||||||
@ -435,10 +430,7 @@ public class Comment implements Parcelable {
|
|||||||
public void writeToParcel(Parcel parcel, int i) {
|
public void writeToParcel(Parcel parcel, int i) {
|
||||||
parcel.writeInt(id);
|
parcel.writeInt(id);
|
||||||
parcel.writeInt(postId);
|
parcel.writeInt(postId);
|
||||||
parcel.writeString(fullName);
|
parcel.writeParcelable(author, i);
|
||||||
parcel.writeString(author);
|
|
||||||
parcel.writeString(authorQualifiedName);
|
|
||||||
parcel.writeString(authorIconUrl);
|
|
||||||
parcel.writeString(linkAuthor);
|
parcel.writeString(linkAuthor);
|
||||||
parcel.writeLong(commentTimeMillis);
|
parcel.writeLong(commentTimeMillis);
|
||||||
parcel.writeString(commentMarkdown);
|
parcel.writeString(commentMarkdown);
|
||||||
@ -486,7 +478,7 @@ public class Comment implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getAuthorQualifiedName() {
|
public String getAuthorQualifiedName() {
|
||||||
return authorQualifiedName;
|
return author.getQualifiedName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCommunityQualifiedName() {
|
public String getCommunityQualifiedName() {
|
||||||
@ -496,4 +488,8 @@ public class Comment implements Parcelable {
|
|||||||
public int getPostId() {
|
public int getPostId() {
|
||||||
return postId;
|
return postId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BasicUserInfo getAuthor() {
|
||||||
|
return author;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ public class FetchRemovedComment {
|
|||||||
boolean isSubmitter = result.getBoolean(JSONUtils.IS_SUBMITTER_KEY);
|
boolean isSubmitter = result.getBoolean(JSONUtils.IS_SUBMITTER_KEY);
|
||||||
|
|
||||||
if (id.equals(comment.getId()) &&
|
if (id.equals(comment.getId()) &&
|
||||||
(!author.equals(comment.getAuthor()) ||
|
(!author.equals(comment.getAuthorName()) ||
|
||||||
!body.equals(comment.getCommentRawText()))
|
!body.equals(comment.getCommentRawText()))
|
||||||
) {
|
) {
|
||||||
comment.setAuthor(author);
|
comment.setAuthor(author);
|
||||||
|
@ -56,7 +56,7 @@ public class FetchRemovedCommentReveddit {
|
|||||||
String author = result.getString(JSONUtils.AUTHOR_KEY);
|
String author = result.getString(JSONUtils.AUTHOR_KEY);
|
||||||
String body = Utils.modifyMarkdown(Utils.trimTrailingWhitespace(result.optString(JSONUtils.BODY_KEY)));
|
String body = Utils.modifyMarkdown(Utils.trimTrailingWhitespace(result.optString(JSONUtils.BODY_KEY)));
|
||||||
|
|
||||||
if (id.equals(comment.getId()) && (!author.equals(comment.getAuthor()) || !body.equals(comment.getCommentRawText()))) {
|
if (id.equals(comment.getId()) && (!author.equals(comment.getAuthorName()) || !body.equals(comment.getCommentRawText()))) {
|
||||||
comment.setAuthor(author);
|
comment.setAuthor(author);
|
||||||
comment.setCommentMarkdown(body);
|
comment.setCommentMarkdown(body);
|
||||||
comment.setCommentRawText(body);
|
comment.setCommentRawText(body);
|
||||||
|
@ -24,6 +24,7 @@ import java.util.TimeZone;
|
|||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
@ -340,10 +341,10 @@ public class ParseComment {
|
|||||||
boolean saved = jsonObject.getBoolean("saved");
|
boolean saved = jsonObject.getBoolean("saved");
|
||||||
boolean deleted = commentObj.getBoolean("deleted");
|
boolean deleted = commentObj.getBoolean("deleted");
|
||||||
long edited = 0;
|
long edited = 0;
|
||||||
|
BasicUserInfo authorInfo = new BasicUserInfo(creatorObj.getInt("id"), author, authorQualifiedName, creatorObj.optString("avatar", ""), creatorObj.optString("display_name", author));
|
||||||
Comment comment = new Comment(id, postID, fullName, author, authorQualifiedName, linkAuthor, commentTimeMillis,
|
Comment comment = new Comment(id, postID, authorInfo, linkAuthor, commentTimeMillis,
|
||||||
commentMarkdown, commentRawText, linkId, communityName, communityQualifiedName, parentId,
|
commentMarkdown, commentRawText, linkId, communityName, communityQualifiedName, parentId,
|
||||||
downvotes,upvotes, voteType, isSubmitter, distinguished, permalink, depth, collapsed, hasReply, saved, deleted, edited, path);
|
downvotes, upvotes, voteType, isSubmitter, distinguished, permalink, depth, collapsed, hasReply, saved, deleted, edited, path);
|
||||||
int child_count = countsObj.getInt("child_count");
|
int child_count = countsObj.getInt("child_count");
|
||||||
comment.setChildCount(child_count);
|
comment.setChildCount(child_count);
|
||||||
comment.setAuthorIconUrl(authorAvatar);
|
comment.setAuthorIconUrl(authorAvatar);
|
||||||
|
@ -620,7 +620,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
|||||||
mSharedPreferences, mCurrentAccountSharedPreferences, mNsfwAndSpoilerSharedPreferences, mPostDetailsSharedPreferences,
|
mSharedPreferences, mCurrentAccountSharedPreferences, mNsfwAndSpoilerSharedPreferences, mPostDetailsSharedPreferences,
|
||||||
mExoCreator, post -> EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition)));
|
mExoCreator, post -> EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition)));
|
||||||
mCommentsAdapter = new CommentsRecyclerViewAdapter(activity,
|
mCommentsAdapter = new CommentsRecyclerViewAdapter(activity,
|
||||||
this, mCustomThemeWrapper, mExecutor, mRetrofit.getRetrofit(),
|
this, mCustomThemeWrapper, mExecutor, mRetrofit,
|
||||||
mAccessToken, mAccountQualifiedName, mPost, mLocale, mSingleCommentId
|
mAccessToken, mAccountQualifiedName, mPost, mLocale, mSingleCommentId
|
||||||
, isSingleCommentThreadMode, mSharedPreferences, mCurrentAccountSharedPreferences,
|
, isSingleCommentThreadMode, mSharedPreferences, mCurrentAccountSharedPreferences,
|
||||||
new CommentsRecyclerViewAdapter.CommentRecyclerViewAdapterCallback() {
|
new CommentsRecyclerViewAdapter.CommentRecyclerViewAdapterCallback() {
|
||||||
@ -1351,7 +1351,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
|||||||
pages_loaded++;
|
pages_loaded++;
|
||||||
mCommentsAdapter = new CommentsRecyclerViewAdapter(activity,
|
mCommentsAdapter = new CommentsRecyclerViewAdapter(activity,
|
||||||
ViewPostDetailFragment.this, mCustomThemeWrapper, mExecutor,
|
ViewPostDetailFragment.this, mCustomThemeWrapper, mExecutor,
|
||||||
mRetrofit.getRetrofit(), mAccessToken, mAccountQualifiedName, mPost, mLocale,
|
mRetrofit, mAccessToken, mAccountQualifiedName, mPost, mLocale,
|
||||||
mSingleCommentId, isSingleCommentThreadMode, mSharedPreferences, mCurrentAccountSharedPreferences,
|
mSingleCommentId, isSingleCommentThreadMode, mSharedPreferences, mCurrentAccountSharedPreferences,
|
||||||
new CommentsRecyclerViewAdapter.CommentRecyclerViewAdapterCallback() {
|
new CommentsRecyclerViewAdapter.CommentRecyclerViewAdapterCallback() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -56,6 +56,9 @@ public class SharedPreferencesUtils {
|
|||||||
|
|
||||||
public static final String POST_DISPLAY_NAME_INSTEAD_OF_USERNAME = "post_display_name_instead_of_user_name";
|
public static final String POST_DISPLAY_NAME_INSTEAD_OF_USERNAME = "post_display_name_instead_of_user_name";
|
||||||
|
|
||||||
|
public static final String COMMENT_DISPLAY_NAME_INSTEAD_OF_USERNAME = "comment_display_name_instead_of_user_name";
|
||||||
|
public static final String COMMENT_HIDE_USER_INSTANCE = "comment_hide_user_instance";
|
||||||
|
|
||||||
public static final String POST_DETAIL_DISPLAY_NAME_INSTEAD_OF_USERNAME = "post_detail_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";
|
||||||
|
@ -1382,4 +1382,5 @@
|
|||||||
<string name="settings_show_post_and_comment_score">Show post and comment scores</string>
|
<string name="settings_show_post_and_comment_score">Show post and comment scores</string>
|
||||||
<string name="moderators">Moderators</string>
|
<string name="moderators">Moderators</string>
|
||||||
<string name="admins">Admins</string>
|
<string name="admins">Admins</string>
|
||||||
|
<string name="settings_hide_user_instance">Hide user instance</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -61,6 +61,16 @@
|
|||||||
app:key="comment_separate_down_and_up_votes"
|
app:key="comment_separate_down_and_up_votes"
|
||||||
app:title="@string/separate_down_and_up_votes" />
|
app:title="@string/separate_down_and_up_votes" />
|
||||||
|
|
||||||
|
<eu.toldi.infinityforlemmy.customviews.CustomFontSwitchPreference
|
||||||
|
app:defaultValue="false"
|
||||||
|
app:key="comment_hide_user_instance"
|
||||||
|
app:title="@string/settings_hide_user_instance" />
|
||||||
|
|
||||||
|
<eu.toldi.infinityforlemmy.customviews.CustomFontSwitchPreference
|
||||||
|
app:defaultValue="true"
|
||||||
|
app:key="comment_display_name_instead_of_user_name"
|
||||||
|
app:title="@string/settings_show_display_name_instead_of_user_name" />
|
||||||
|
|
||||||
<eu.toldi.infinityforlemmy.customviews.CustomFontSeekBarPreference
|
<eu.toldi.infinityforlemmy.customviews.CustomFontSeekBarPreference
|
||||||
app:defaultValue="5"
|
app:defaultValue="5"
|
||||||
android:max="10"
|
android:max="10"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user