Skip to content

Commit

Permalink
Download the gallery image that's been swiped to in PostOptionsBottom…
Browse files Browse the repository at this point in the history
…SheetFragment.
  • Loading branch information
Docile-Alligator committed Sep 17, 2024
1 parent aac0de2 commit db09315
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2836,7 +2836,13 @@ void setBaseView(AspectRatioGifImageView iconGifImageView,
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;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ public PostOptionsBottomSheetFragment() {
* @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();
Expand Down

0 comments on commit db09315

Please sign in to comment.