aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-10-29 19:45:14 +0000
committerDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-10-29 19:45:14 +0000
commite23f547a25c28acfa91ccef20900b2be0a5ed541 (patch)
tree9f30bdb94991ac8761f06459dde8d6161fa85e16
parent9959d76829ccd4e1aa07d207550d538b9e8c9bb6 (diff)
downloadinfinity-for-reddit-e23f547a25c28acfa91ccef20900b2be0a5ed541.tar
infinity-for-reddit-e23f547a25c28acfa91ccef20900b2be0a5ed541.tar.gz
infinity-for-reddit-e23f547a25c28acfa91ccef20900b2be0a5ed541.tar.bz2
infinity-for-reddit-e23f547a25c28acfa91ccef20900b2be0a5ed541.tar.lz
infinity-for-reddit-e23f547a25c28acfa91ccef20900b2be0a5ed541.tar.xz
infinity-for-reddit-e23f547a25c28acfa91ccef20900b2be0a5ed541.tar.zst
infinity-for-reddit-e23f547a25c28acfa91ccef20900b2be0a5ed541.zip
Long click menu for compact layout if long click to hide toolbar is disabled. Long click menu in PostDetailRecyclerViewAdapter.
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java33
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java11
2 files changed, 43 insertions, 1 deletions
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<Recycler
this.saveButton = saveButton;
this.shareButton = shareButton;
+ itemView.setOnLongClickListener(v -> {
+ 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<Recycler
binding.imageViewItemPostDetailVideoAndGifPreview.setOnClickListener(view -> {
openMedia(mPost);
});
+
+ binding.imageViewItemPostDetailVideoAndGifPreview.setOnLongClickListener(v -> {
+ itemView.performLongClick();
+ return true;
+ });
}
}
@@ -2135,6 +2153,11 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
binding.imageViewItemPostDetailImageAndGifAutoplay.setOnClickListener(view -> {
openMedia(mPost);
});
+
+ binding.imageViewItemPostDetailImageAndGifAutoplay.setOnLongClickListener(view -> {
+ itemView.performLongClick();
+ return true;
+ });
}
}
@@ -2181,6 +2204,11 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
intent.putExtra(LinkResolverActivity.EXTRA_IS_NSFW, mPost.isNSFW());
mActivity.startActivity(intent);
});
+
+ binding.imageViewItemPostDetailLink.setOnLongClickListener(view -> {
+ itemView.performLongClick();
+ return true;
+ });
}
}
@@ -2223,6 +2251,11 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
binding.imageViewNoPreviewPostTypeItemPostDetailNoPreview.setOnClickListener(view -> {
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<Post, RecyclerVie
if (mHandleReadPost && post.isRead()) {
((PostViewHolder) holder).setItemViewBackgroundColor(true);
- ((PostBaseViewHolder) holder).titleTextView.setTextColor(mReadPostTitleColor);
+ ((PostViewHolder) holder).titleTextView.setTextColor(mReadPostTitleColor);
}
if (mDisplaySubredditName) {
@@ -3774,6 +3774,15 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
params.height = 0;
bottomConstraintLayout.setLayoutParams(params);
}
+ } else {
+ Post post = getItem(getBindingAdapterPosition());
+ if (post == null) {
+ return false;
+ }
+
+ PostOptionsBottomSheetFragment postOptionsBottomSheetFragment;
+ postOptionsBottomSheetFragment = PostOptionsBottomSheetFragment.newInstance(post);
+ postOptionsBottomSheetFragment.show(mActivity.getSupportFragmentManager(), postOptionsBottomSheetFragment.getTag());
}
return true;
});