From ea837718bf1c005d43ab79795706dd37c8070af5 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Mon, 18 Jan 2021 23:37:08 +0800 Subject: Don't hide read posts after initial post loading even if Hide Read Posts Automatically is enabled. --- .../infinityforreddit/adapters/PostRecyclerViewAdapter.java | 8 ++++---- .../ml/docilealligator/infinityforreddit/post/ParsePost.java | 2 +- .../java/ml/docilealligator/infinityforreddit/post/Post.java | 10 +++++++++- 3 files changed, 14 insertions(+), 6 deletions(-) (limited to 'app/src/main/java/ml/docilealligator') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java index 8064779f..a830dd53 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java @@ -407,7 +407,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter previews = new ArrayList<>(); private ArrayList 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); -- cgit v1.2.3