aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
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();