mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-27 19:38:22 +01:00
Send correct image index when opening the image in gallery posts.
This commit is contained in:
parent
746ebc848c
commit
968b04a508
@ -3271,12 +3271,11 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
|||||||
break;
|
break;
|
||||||
case MotionEvent.ACTION_UP:
|
case MotionEvent.ACTION_UP:
|
||||||
if (!dragged) {
|
if (!dragged) {
|
||||||
int index = layoutManager.findFirstVisibleItemPosition();
|
|
||||||
int position = getBindingAdapterPosition();
|
int position = getBindingAdapterPosition();
|
||||||
if (position >= 0) {
|
if (position >= 0) {
|
||||||
if (post != null) {
|
if (post != null) {
|
||||||
markPostRead(post, true);
|
markPostRead(post, true);
|
||||||
openMedia(post, index);
|
openMedia(post, layoutManager.findFirstVisibleItemPosition());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4278,7 +4277,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
|||||||
ImageView noPreviewImageView;
|
ImageView noPreviewImageView;
|
||||||
|
|
||||||
PostGalleryTypeImageRecyclerViewAdapter adapter;
|
PostGalleryTypeImageRecyclerViewAdapter adapter;
|
||||||
private boolean swipeLocked;
|
private SwipeLockLinearLayoutManager layoutManager;
|
||||||
|
|
||||||
Post post;
|
Post post;
|
||||||
Post.Preview preview;
|
Post.Preview preview;
|
||||||
@ -4314,23 +4313,16 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
|||||||
recyclerView.setAdapter(adapter);
|
recyclerView.setAdapter(adapter);
|
||||||
new PagerSnapHelper().attachToRecyclerView(recyclerView);
|
new PagerSnapHelper().attachToRecyclerView(recyclerView);
|
||||||
recyclerView.setRecycledViewPool(mGalleryRecycledViewPool);
|
recyclerView.setRecycledViewPool(mGalleryRecycledViewPool);
|
||||||
SwipeLockLinearLayoutManager layoutManager = new SwipeLockLinearLayoutManager(
|
layoutManager = new SwipeLockLinearLayoutManager(
|
||||||
mActivity, RecyclerView.HORIZONTAL, false, new SwipeLockInterface() {
|
mActivity, RecyclerView.HORIZONTAL, false, new SwipeLockInterface() {
|
||||||
@Override
|
@Override
|
||||||
public void lockSwipe() {
|
public void lockSwipe() {
|
||||||
mActivity.lockSwipeRightToGoBack();
|
mActivity.lockSwipeRightToGoBack();
|
||||||
swipeLocked = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unlockSwipe() {
|
public void unlockSwipe() {
|
||||||
mActivity.unlockSwipeRightToGoBack();
|
mActivity.unlockSwipeRightToGoBack();
|
||||||
swipeLocked = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setSwipeLocked(boolean swipeLocked) {
|
|
||||||
PostGalleryBaseGalleryTypeViewHolder.this.swipeLocked = swipeLocked;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
recyclerView.setLayoutManager(layoutManager);
|
recyclerView.setLayoutManager(layoutManager);
|
||||||
@ -4416,7 +4408,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
|||||||
if (post.getPostType() == Post.TEXT_TYPE || !mSharedPreferences.getBoolean(SharedPreferencesUtils.CLICK_TO_SHOW_MEDIA_IN_GALLERY_LAYOUT, false)) {
|
if (post.getPostType() == Post.TEXT_TYPE || !mSharedPreferences.getBoolean(SharedPreferencesUtils.CLICK_TO_SHOW_MEDIA_IN_GALLERY_LAYOUT, false)) {
|
||||||
openViewPostDetailActivity(post, getBindingAdapterPosition());
|
openViewPostDetailActivity(post, getBindingAdapterPosition());
|
||||||
} else {
|
} else {
|
||||||
openMedia(post);
|
openMedia(post, layoutManager.findFirstVisibleItemPosition());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4432,7 +4424,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
|||||||
if (post.getPostType() == Post.TEXT_TYPE || mSharedPreferences.getBoolean(SharedPreferencesUtils.CLICK_TO_SHOW_MEDIA_IN_GALLERY_LAYOUT, false)) {
|
if (post.getPostType() == Post.TEXT_TYPE || mSharedPreferences.getBoolean(SharedPreferencesUtils.CLICK_TO_SHOW_MEDIA_IN_GALLERY_LAYOUT, false)) {
|
||||||
openViewPostDetailActivity(post, getBindingAdapterPosition());
|
openViewPostDetailActivity(post, getBindingAdapterPosition());
|
||||||
} else {
|
} else {
|
||||||
openMedia(post);
|
openMedia(post, layoutManager.findFirstVisibleItemPosition());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user