Prevent inserting read posts into database multiple times when clicking posts.

This commit is contained in:
Alex Ning 2020-12-08 00:18:04 +08:00
parent a4232a54bd
commit 69af53ddba

View File

@ -1880,6 +1880,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
}
void markPostRead(Post post) {
if (!post.isRead()) {
post.markAsRead();
cardView.setBackgroundTintList(ColorStateList.valueOf(mReadPostCardViewBackgroundColor));
titleTextView.setTextColor(mReadPostTitleColor);
@ -1891,6 +1892,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
}
}
}
}
class PostVideoAutoplayViewHolder extends PostBaseViewHolder implements ToroPlayer {
@BindView(R.id.card_view_item_post_video_type_autoplay)
@ -2933,6 +2935,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
}
void markPostRead(Post post) {
if (!post.isRead()) {
post.markAsRead();
itemView.setBackgroundColor(mReadPostCardViewBackgroundColor);
titleTextView.setTextColor(mReadPostTitleColor);
@ -2941,6 +2944,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
}
}
}
}
class PostCompactLeftThumbnailViewHolder extends PostCompactBaseViewHolder {
@BindView(R.id.icon_gif_image_view_item_post_compact)