From db2c4d6c8d4200649a5003b7a45e54ec66237aaf Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Sat, 20 Feb 2021 23:26:42 +0800 Subject: Long click gallery layout. --- .../adapters/PostRecyclerViewAdapter.java | 205 +++++++-------------- 1 file changed, 70 insertions(+), 135 deletions(-) (limited to 'app/src') 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 b1e0bea1..c791e2d8 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java @@ -1737,6 +1737,54 @@ public class PostRecyclerViewAdapter extends PagedListAdapter { + int position = getBindingAdapterPosition(); + if (position >= 0 && canStartActivity) { + Post post = getItem(position); + if (post != null) { + markPostRead(post, true); + canStartActivity = false; + + if (post.getPostType() == Post.TEXT_TYPE || mSharedPreferences.getBoolean(SharedPreferencesUtils.CLICK_TO_SHOW_MEDIA_IN_GALLERY_LAYOUT, false)) { + openViewPostDetailActivity(post, getBindingAdapterPosition()); + } else { + openMedia(post); } } } + + return true; }); noPreviewImageView.setOnClickListener(view -> { -- cgit v1.2.3