aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-09-17 14:25:17 +0000
committerDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-09-17 14:25:17 +0000
commitdb09315c6d1917d4d334b3fb6b340f4af1a6e6d4 (patch)
treee37f17b2333af625871cf9de6985c5b66b85a71c
parentaac0de2393bad37a56eabc5ebb4cb839bcdbe2e1 (diff)
downloadinfinity-for-reddit-db09315c6d1917d4d334b3fb6b340f4af1a6e6d4.tar
infinity-for-reddit-db09315c6d1917d4d334b3fb6b340f4af1a6e6d4.tar.gz
infinity-for-reddit-db09315c6d1917d4d334b3fb6b340f4af1a6e6d4.tar.bz2
infinity-for-reddit-db09315c6d1917d4d334b3fb6b340f4af1a6e6d4.tar.lz
infinity-for-reddit-db09315c6d1917d4d334b3fb6b340f4af1a6e6d4.tar.xz
infinity-for-reddit-db09315c6d1917d4d334b3fb6b340f4af1a6e6d4.tar.zst
infinity-for-reddit-db09315c6d1917d4d334b3fb6b340f4af1a6e6d4.zip
Download the gallery image that's been swiped to in PostOptionsBottomSheetFragment.
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostOptionsBottomSheetFragment.java9
2 files changed, 16 insertions, 1 deletions
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 fa1c6c01..6e88ad4b 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
@@ -2836,7 +2836,13 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
return false;
}
- PostOptionsBottomSheetFragment postOptionsBottomSheetFragment = PostOptionsBottomSheetFragment.newInstance(post);
+ PostOptionsBottomSheetFragment postOptionsBottomSheetFragment;
+ if (post.getPostType() == Post.GALLERY_TYPE && this instanceof PostBaseGalleryTypeViewHolder) {
+ postOptionsBottomSheetFragment = PostOptionsBottomSheetFragment.newInstance(post,
+ ((LinearLayoutManagerBugFixed) ((PostBaseGalleryTypeViewHolder) this).galleryRecyclerView.getLayoutManager()).findFirstVisibleItemPosition());
+ } else {
+ postOptionsBottomSheetFragment = PostOptionsBottomSheetFragment.newInstance(post);
+ }
postOptionsBottomSheetFragment.show(mActivity.getSupportFragmentManager(), postOptionsBottomSheetFragment.getTag());
return true;
});
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostOptionsBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostOptionsBottomSheetFragment.java
index faeb2b3d..075c08cd 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostOptionsBottomSheetFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostOptionsBottomSheetFragment.java
@@ -56,6 +56,15 @@ public class PostOptionsBottomSheetFragment extends LandscapeExpandedRoundedBott
* @param post Post
* @return A new instance of fragment PostOptionsBottomSheetFragment.
*/
+ public static PostOptionsBottomSheetFragment newInstance(Post post, int galleryIndex) {
+ PostOptionsBottomSheetFragment fragment = new PostOptionsBottomSheetFragment();
+ Bundle args = new Bundle();
+ args.putParcelable(EXTRA_POST, post);
+ args.putInt(EXTRA_GALLERY_INDEX, galleryIndex);
+ fragment.setArguments(args);
+ return fragment;
+ }
+
public static PostOptionsBottomSheetFragment newInstance(Post post) {
PostOptionsBottomSheetFragment fragment = new PostOptionsBottomSheetFragment();
Bundle args = new Bundle();