From 9b9a1aa308659fc2f031f468002eeff15323b9d6 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Tue, 16 Feb 2021 19:32:23 +0800 Subject: Continue adding Gallery Layout. --- .../adapters/PostRecyclerViewAdapter.java | 46 +++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) 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 b4230074..4cbd3254 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java @@ -1056,6 +1056,21 @@ public class PostRecyclerViewAdapter extends PagedListAdapter= 0) { + Post post = getItem(position); + ((PostGalleryViewHolder) holder).markPostRead(post, false); + } + } + ((PostGalleryViewHolder) holder).itemView.setVisibility(View.VISIBLE); + RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) holder.itemView.getLayoutParams(); + params.height = ViewGroup.LayoutParams.WRAP_CONTENT; + int marginPixel = (int) Utils.convertDpToPixel(8, mActivity); + params.topMargin = marginPixel; + params.bottomMargin = marginPixel; + holder.itemView.setLayoutParams(params); + ((PostGalleryViewHolder) holder).itemView.setBackgroundTintList(ColorStateList.valueOf(mCardViewBackgroundColor)); + ((PostGalleryViewHolder) holder).titleTextView.setText(""); ((PostGalleryViewHolder) holder).titleTextView.setVisibility(View.GONE); mGlide.clear(((PostGalleryViewHolder) holder).imageView); @@ -3442,7 +3473,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter= 0 && canStartActivity) { Post post = getItem(position); if (post != null) { - //markPostRead(post, true); + markPostRead(post, true); canStartActivity = false; Intent intent = new Intent(mActivity, ViewPostDetailActivity.class); @@ -3454,6 +3485,19 @@ public class PostRecyclerViewAdapter extends PagedListAdapter