From e23f547a25c28acfa91ccef20900b2be0a5ed541 Mon Sep 17 00:00:00 2001 From: Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:45:14 -0400 Subject: Long click menu for compact layout if long click to hide toolbar is disabled. Long click menu in PostDetailRecyclerViewAdapter. --- .../adapters/PostDetailRecyclerViewAdapter.java | 33 ++++++++++++++++++++++ .../adapters/PostRecyclerViewAdapter.java | 11 +++++++- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java index 8ef71a7e..71ffc785 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java @@ -86,6 +86,7 @@ import ml.docilealligator.infinityforreddit.apis.StreamableAPI; import ml.docilealligator.infinityforreddit.asynctasks.LoadSubredditIcon; import ml.docilealligator.infinityforreddit.asynctasks.LoadUserData; import ml.docilealligator.infinityforreddit.bottomsheetfragments.CopyTextBottomSheetFragment; +import ml.docilealligator.infinityforreddit.bottomsheetfragments.PostOptionsBottomSheetFragment; import ml.docilealligator.infinityforreddit.bottomsheetfragments.ShareLinkBottomSheetFragment; import ml.docilealligator.infinityforreddit.bottomsheetfragments.UrlMenuBottomSheetFragment; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; @@ -1256,6 +1257,18 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter { + PostOptionsBottomSheetFragment postOptionsBottomSheetFragment; + if (mPost.getPostType() == Post.GALLERY_TYPE && this instanceof PostDetailGalleryViewHolder) { + postOptionsBottomSheetFragment = PostOptionsBottomSheetFragment.newInstance(mPost, + ((LinearLayoutManagerBugFixed) ((PostDetailGalleryViewHolder) this).binding.galleryRecyclerViewItemPostDetailGallery.getLayoutManager()).findFirstVisibleItemPosition()); + } else { + postOptionsBottomSheetFragment = PostOptionsBottomSheetFragment.newInstance(mPost); + } + postOptionsBottomSheetFragment.show(mActivity.getSupportFragmentManager(), postOptionsBottomSheetFragment.getTag()); + return true; + }); + iconGifImageView.setOnClickListener(view -> subredditTextView.performClick()); subredditTextView.setOnClickListener(view -> { @@ -2097,6 +2110,11 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter { openMedia(mPost); }); + + binding.imageViewItemPostDetailVideoAndGifPreview.setOnLongClickListener(v -> { + itemView.performLongClick(); + return true; + }); } } @@ -2135,6 +2153,11 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter { openMedia(mPost); }); + + binding.imageViewItemPostDetailImageAndGifAutoplay.setOnLongClickListener(view -> { + itemView.performLongClick(); + return true; + }); } } @@ -2181,6 +2204,11 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter { + itemView.performLongClick(); + return true; + }); } } @@ -2223,6 +2251,11 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter { openMedia(mPost); }); + + binding.imageViewNoPreviewPostTypeItemPostDetailNoPreview.setOnLongClickListener(view -> { + itemView.performLongClick(); + return true; + }); } } 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 9afcbdd9..3796d986 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java @@ -609,7 +609,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter