Fix cannot open media in Gallery layout.

This commit is contained in:
Alex Ning 2021-11-21 19:38:49 +08:00
parent 04cc769ccf
commit fd1b6fa6fe

View File

@ -1916,6 +1916,8 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
}
private void openViewPostDetailActivity(Post post, int position) {
if (canStartActivity) {
canStartActivity = false;
Intent intent = new Intent(mActivity, ViewPostDetailActivity.class);
intent.putExtra(ViewPostDetailActivity.EXTRA_POST_DATA, post);
intent.putExtra(ViewPostDetailActivity.EXTRA_POST_LIST_POSITION, position);
@ -1923,6 +1925,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
intent.putExtra(ViewPostDetailActivity.EXTRA_IS_NSFW_SUBREDDIT, mFragment.getIsNsfwSubreddit());
mActivity.startActivity(intent);
}
}
private void openMedia(Post post) {
if (canStartActivity) {
@ -2113,7 +2116,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
Post post = getItem(position);
if (post != null) {
markPostRead(post, true);
canStartActivity = false;
openViewPostDetailActivity(post, getBindingAdapterPosition());
}
@ -3160,8 +3162,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
Post post = getItem(position);
if (post != null && canStartActivity) {
markPostRead(post, true);
canStartActivity = false;
openViewPostDetailActivity(post, getBindingAdapterPosition());
}
});
@ -3750,7 +3750,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
Post post = getItem(position);
if (post != null) {
markPostRead(post, true);
canStartActivity = false;
if (post.getPostType() == Post.TEXT_TYPE || !mSharedPreferences.getBoolean(SharedPreferencesUtils.CLICK_TO_SHOW_MEDIA_IN_GALLERY_LAYOUT, false)) {
openViewPostDetailActivity(post, getBindingAdapterPosition());
@ -3767,7 +3766,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
Post post = getItem(position);
if (post != null) {
markPostRead(post, true);
canStartActivity = false;
if (post.getPostType() == Post.TEXT_TYPE || mSharedPreferences.getBoolean(SharedPreferencesUtils.CLICK_TO_SHOW_MEDIA_IN_GALLERY_LAYOUT, false)) {
openViewPostDetailActivity(post, getBindingAdapterPosition());