mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-10 20:57:25 +01:00
Don't hide read posts after initial post loading even if Hide Read Posts Automatically is enabled.
This commit is contained in:
parent
f13d4576e1
commit
ea837718bf
@ -407,7 +407,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
||||
Post post = getItem(position);
|
||||
if (post != null) {
|
||||
if (post.isRead()) {
|
||||
if (mHideReadPostsAutomatically || position < mHideReadPostsIndex) {
|
||||
if ((mHideReadPostsAutomatically && !post.isHiddenManuallyByUser()) || position < mHideReadPostsIndex) {
|
||||
post.hidePostInRecyclerView();
|
||||
holder.itemView.setVisibility(View.GONE);
|
||||
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) holder.itemView.getLayoutParams();
|
||||
@ -736,7 +736,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
||||
Post post = getItem(position);
|
||||
if (post != null) {
|
||||
if (post.isRead()) {
|
||||
if (mHideReadPostsAutomatically || position < mHideReadPostsIndex) {
|
||||
if ((mHideReadPostsAutomatically && !post.isHiddenManuallyByUser()) || position < mHideReadPostsIndex) {
|
||||
post.hidePostInRecyclerView();
|
||||
holder.itemView.setVisibility(View.GONE);
|
||||
ViewGroup.LayoutParams params = holder.itemView.getLayoutParams();
|
||||
@ -1980,7 +1980,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
||||
|
||||
void markPostRead(Post post, boolean changePostItemColor) {
|
||||
if (mAccessToken != null && !post.isRead() && mMarkPostsAsRead) {
|
||||
post.markAsRead();
|
||||
post.markAsRead(true);
|
||||
if (changePostItemColor) {
|
||||
cardView.setBackgroundTintList(ColorStateList.valueOf(mReadPostCardViewBackgroundColor));
|
||||
titleTextView.setTextColor(mReadPostTitleColor);
|
||||
@ -3033,7 +3033,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
||||
|
||||
void markPostRead(Post post, boolean changePostItemColor) {
|
||||
if (mAccessToken != null && !post.isRead() && mMarkPostsAsRead) {
|
||||
post.markAsRead();
|
||||
post.markAsRead(true);
|
||||
if (changePostItemColor) {
|
||||
itemView.setBackgroundColor(mReadPostCardViewBackgroundColor);
|
||||
titleTextView.setTextColor(mReadPostTitleColor);
|
||||
|
@ -565,7 +565,7 @@ public class ParsePost {
|
||||
JSONObject data = allData.getJSONObject(i).getJSONObject(JSONUtils.DATA_KEY);
|
||||
Post post = parseBasicData(data);
|
||||
if (readPostHashSet != null && readPostHashSet.contains(ReadPost.convertPost(post))) {
|
||||
post.markAsRead();
|
||||
post.markAsRead(false);
|
||||
}
|
||||
if (PostFilter.isPostAllowed(post, postFilter)) {
|
||||
newPosts.add(post);
|
||||
|
@ -73,6 +73,7 @@ public class Post implements Parcelable {
|
||||
private boolean isCrosspost;
|
||||
private boolean isRead;
|
||||
private boolean isHiddenInRecyclerView = false;
|
||||
private boolean isHiddenManuallyByUser = false;
|
||||
private String crosspostParentId;
|
||||
private ArrayList<Preview> previews = new ArrayList<>();
|
||||
private ArrayList<Gallery> gallery = new ArrayList<>();
|
||||
@ -189,6 +190,7 @@ public class Post implements Parcelable {
|
||||
isCrosspost = in.readByte() != 0;
|
||||
isRead = in.readByte() != 0;
|
||||
isHiddenInRecyclerView = in.readByte() != 0;
|
||||
isHiddenManuallyByUser = in.readByte() != 0;
|
||||
crosspostParentId = in.readString();
|
||||
in.readTypedList(previews, Preview.CREATOR);
|
||||
in.readTypedList(gallery, Gallery.CREATOR);
|
||||
@ -452,8 +454,9 @@ public class Post implements Parcelable {
|
||||
return isCrosspost;
|
||||
}
|
||||
|
||||
public void markAsRead() {
|
||||
public void markAsRead(boolean isHiddenManuallyByUser) {
|
||||
isRead = true;
|
||||
this.isHiddenManuallyByUser = isHiddenManuallyByUser;
|
||||
}
|
||||
|
||||
public boolean isRead() {
|
||||
@ -468,6 +471,10 @@ public class Post implements Parcelable {
|
||||
isHiddenInRecyclerView = true;
|
||||
}
|
||||
|
||||
public boolean isHiddenManuallyByUser() {
|
||||
return isHiddenManuallyByUser;
|
||||
}
|
||||
|
||||
public String getCrosspostParentId() {
|
||||
return crosspostParentId;
|
||||
}
|
||||
@ -534,6 +541,7 @@ public class Post implements Parcelable {
|
||||
parcel.writeByte((byte) (isCrosspost ? 1 : 0));
|
||||
parcel.writeByte((byte) (isRead ? 1 : 0));
|
||||
parcel.writeByte((byte) (isHiddenInRecyclerView ? 1 : 0));
|
||||
parcel.writeByte((byte) (isHiddenManuallyByUser ? 1 : 0));
|
||||
parcel.writeString(crosspostParentId);
|
||||
parcel.writeTypedList(previews);
|
||||
parcel.writeTypedList(gallery);
|
||||
|
Loading…
Reference in New Issue
Block a user