aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-09-28 04:05:24 +0000
committerDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-09-28 04:05:24 +0000
commitd2c240d02f349f8a1f7fda0f55a134785f315c6a (patch)
treebb2245c7578e8092e4ccc6c65144cf12d086646b
parentb7e63c0f843b65a1f0cb8c78e75371d8d760e7f8 (diff)
downloadinfinity-for-reddit-d2c240d02f349f8a1f7fda0f55a134785f315c6a.tar
infinity-for-reddit-d2c240d02f349f8a1f7fda0f55a134785f315c6a.tar.gz
infinity-for-reddit-d2c240d02f349f8a1f7fda0f55a134785f315c6a.tar.bz2
infinity-for-reddit-d2c240d02f349f8a1f7fda0f55a134785f315c6a.tar.lz
infinity-for-reddit-d2c240d02f349f8a1f7fda0f55a134785f315c6a.tar.xz
infinity-for-reddit-d2c240d02f349f8a1f7fda0f55a134785f315c6a.tar.zst
infinity-for-reddit-d2c240d02f349f8a1f7fda0f55a134785f315c6a.zip
Long click the preview image to open PostOptionsBottomSheetFragment.
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java9
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostGalleryTypeImageRecyclerViewAdapter.java18
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java12
4 files changed, 34 insertions, 8 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java
index 8b6ca8d1..4861e6a6 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java
@@ -3656,7 +3656,8 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
noPreviewImageView.setColorFilter(mNoPreviewPostTypeIconTint, android.graphics.PorterDuff.Mode.SRC_IN);
adapter = new PostGalleryTypeImageRecyclerViewAdapter(mGlide, mActivity.typeface,
- mSaveMemoryCenterInsideDownsampleStrategy, mColorAccent, mPrimaryTextColor, mScale);
+ mSaveMemoryCenterInsideDownsampleStrategy, mColorAccent, mPrimaryTextColor, mScale,
+ galleryImage -> itemView.performLongClick());
galleryRecyclerView.setOnTouchListener((v, motionEvent) -> {
if (motionEvent.getActionMasked() == MotionEvent.ACTION_UP || motionEvent.getActionMasked() == MotionEvent.ACTION_CANCEL) {
if (mActivity.mSliderPanel != null) {
@@ -4613,7 +4614,8 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
imageIndexTextView.setBorderColor(mMediaIndicatorBackgroundColor);
adapter = new PostGalleryTypeImageRecyclerViewAdapter(mGlide, mActivity.typeface,
- mSaveMemoryCenterInsideDownsampleStrategy, mColorAccent, mPrimaryTextColor, mScale);
+ mSaveMemoryCenterInsideDownsampleStrategy, mColorAccent, mPrimaryTextColor, mScale,
+ galleryImage -> {});
recyclerView.setOnTouchListener((v, motionEvent) -> {
if (motionEvent.getActionMasked() == MotionEvent.ACTION_UP || motionEvent.getActionMasked() == MotionEvent.ACTION_CANCEL) {
if (mActivity.mSliderPanel != null) {
@@ -6235,7 +6237,8 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
noPreviewImageView.setColorFilter(mNoPreviewPostTypeIconTint, android.graphics.PorterDuff.Mode.SRC_IN);
adapter = new PostGalleryTypeImageRecyclerViewAdapter(mGlide, mActivity.typeface,
- mSaveMemoryCenterInsideDownsampleStrategy, mColorAccent, mPrimaryTextColor, mScale);
+ mSaveMemoryCenterInsideDownsampleStrategy, mColorAccent, mPrimaryTextColor, mScale,
+ galleryImage -> itemView.performLongClick());
galleryRecyclerView.setOnTouchListener((v, motionEvent) -> {
if (motionEvent.getActionMasked() == MotionEvent.ACTION_UP || motionEvent.getActionMasked() == MotionEvent.ACTION_CANCEL) {
if (mActivity.mSliderPanel != null) {
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 9b94485f..1112cf51 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java
@@ -2268,7 +2268,8 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
adapter = new PostGalleryTypeImageRecyclerViewAdapter(mGlide, mActivity.typeface, mPostDetailMarkwon,
mSaveMemoryCenterInsideDownsampleStrategy, mColorAccent, mPrimaryTextColor,
- mCardViewColor, mCommentColor, mScale);
+ mCardViewColor, mCommentColor, mScale,
+ galleryImage -> {});
binding.galleryRecyclerViewItemPostDetailGallery.setAdapter(adapter);
new PagerSnapHelper().attachToRecyclerView(binding.galleryRecyclerViewItemPostDetailGallery);
binding.galleryRecyclerViewItemPostDetailGallery.setOnTouchListener((v, motionEvent) -> {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostGalleryTypeImageRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostGalleryTypeImageRecyclerViewAdapter.java
index 386e29f9..27ea1832 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostGalleryTypeImageRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostGalleryTypeImageRecyclerViewAdapter.java
@@ -44,23 +44,27 @@ public class PostGalleryTypeImageRecyclerViewAdapter extends RecyclerView.Adapte
private boolean blurImage;
private float ratio;
private final boolean showCaption;
+ private ItemClickListener itemClickListener;
public PostGalleryTypeImageRecyclerViewAdapter(RequestManager glide, Typeface typeface,
SaveMemoryCenterInisdeDownsampleStrategy saveMemoryCenterInisdeDownsampleStrategy,
- int mColorAccent, int mPrimaryTextColor, float scale) {
+ int mColorAccent, int mPrimaryTextColor, float scale,
+ ItemClickListener itemClickListener) {
this.glide = glide;
this.typeface = typeface;
this.saveMemoryCenterInisdeDownsampleStrategy = saveMemoryCenterInisdeDownsampleStrategy;
this.mColorAccent = mColorAccent;
this.mPrimaryTextColor = mPrimaryTextColor;
this.mScale = scale;
+ this.itemClickListener = itemClickListener;
showCaption = false;
}
public PostGalleryTypeImageRecyclerViewAdapter(RequestManager glide, Typeface typeface, Markwon postDetailMarkwon,
SaveMemoryCenterInisdeDownsampleStrategy saveMemoryCenterInisdeDownsampleStrategy,
int mColorAccent, int mPrimaryTextColor, int mCardViewColor,
- int mCommentColor, float scale) {
+ int mCommentColor, float scale,
+ ItemClickListener itemClickListener) {
this.glide = glide;
this.typeface = typeface;
this.mPostDetailMarkwon = postDetailMarkwon;
@@ -70,6 +74,7 @@ public class PostGalleryTypeImageRecyclerViewAdapter extends RecyclerView.Adapte
this.mCardViewColor = mCardViewColor;
this.mCommentColor = mCommentColor;
this.mScale = scale;
+ this.itemClickListener = itemClickListener;
showCaption = true;
}
@@ -203,6 +208,11 @@ public class PostGalleryTypeImageRecyclerViewAdapter extends RecyclerView.Adapte
this.binding = binding;
+ itemView.setOnLongClickListener(v -> {
+ itemClickListener.OnItemLongClick(galleryImages.get(getBindingAdapterPosition()));
+ return true;
+ });
+
if (typeface != null) {
binding.errorTextViewItemGalleryImageInPostFeed.setTypeface(typeface);
}
@@ -216,4 +226,8 @@ public class PostGalleryTypeImageRecyclerViewAdapter extends RecyclerView.Adapte
});
}
}
+
+ public interface ItemClickListener {
+ void OnItemLongClick(Post.Gallery galleryImage);
+ }
}
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 fadba1a5..a2f523e8 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
@@ -3233,6 +3233,8 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
}
});
+ imageView.setOnLongClickListener(view -> itemView.performLongClick());
+
loadImageErrorTextView.setOnClickListener(view -> {
progressBar.setVisibility(View.VISIBLE);
loadImageErrorTextView.setVisibility(View.GONE);
@@ -3243,6 +3245,8 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
imageView.performClick();
});
+ imageViewNoPreviewGallery.setOnLongClickListener(view -> itemView.performLongClick());
+
glideRequestListener = new RequestListener<>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
@@ -3339,7 +3343,8 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
noPreviewImageView.setColorFilter(mNoPreviewPostTypeIconTint, android.graphics.PorterDuff.Mode.SRC_IN);
adapter = new PostGalleryTypeImageRecyclerViewAdapter(mGlide, mActivity.typeface,
- mSaveMemoryCenterInsideDownsampleStrategy, mColorAccent, mPrimaryTextColor, mScale);
+ mSaveMemoryCenterInsideDownsampleStrategy, mColorAccent, mPrimaryTextColor, mScale,
+ galleryImage -> itemView.performLongClick());
galleryRecyclerView.setAdapter(adapter);
galleryRecyclerView.setOnTouchListener((v, motionEvent) -> {
if (motionEvent.getActionMasked() == MotionEvent.ACTION_UP || motionEvent.getActionMasked() == MotionEvent.ACTION_CANCEL) {
@@ -3439,6 +3444,8 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
openMedia(post, 0);
}
});
+
+ noPreviewImageView.setOnLongClickListener(view -> itemView.performLongClick());
}
public boolean isSwipeLocked() {
@@ -4027,7 +4034,8 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
imageIndexTextView.setBorderColor(mMediaIndicatorBackgroundColor);
adapter = new PostGalleryTypeImageRecyclerViewAdapter(mGlide, mActivity.typeface,
- mSaveMemoryCenterInsideDownsampleStrategy, mColorAccent, mPrimaryTextColor, mScale);
+ mSaveMemoryCenterInsideDownsampleStrategy, mColorAccent, mPrimaryTextColor, mScale,
+ galleryImage -> {});
recyclerView.setOnTouchListener((v, motionEvent) -> {
if (motionEvent.getActionMasked() == MotionEvent.ACTION_UP || motionEvent.getActionMasked() == MotionEvent.ACTION_CANCEL) {
if (mActivity.mSliderPanel != null) {