aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main')
-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;
});