aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-11-21 11:38:49 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-11-21 11:38:49 +0000
commitfd1b6fa6fef6aecb7e945546c1f14f3aa6923881 (patch)
tree913522d22ae0d2af9aaec9ac07cc6888dc2c971d
parent04cc769ccfbcf08667ff85350f12556b8e98a453 (diff)
downloadinfinity-for-reddit-fd1b6fa6fef6aecb7e945546c1f14f3aa6923881.tar
infinity-for-reddit-fd1b6fa6fef6aecb7e945546c1f14f3aa6923881.tar.gz
infinity-for-reddit-fd1b6fa6fef6aecb7e945546c1f14f3aa6923881.tar.bz2
infinity-for-reddit-fd1b6fa6fef6aecb7e945546c1f14f3aa6923881.tar.lz
infinity-for-reddit-fd1b6fa6fef6aecb7e945546c1f14f3aa6923881.tar.xz
infinity-for-reddit-fd1b6fa6fef6aecb7e945546c1f14f3aa6923881.tar.zst
infinity-for-reddit-fd1b6fa6fef6aecb7e945546c1f14f3aa6923881.zip
Fix cannot open media in Gallery layout.
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java20
1 files changed, 9 insertions, 11 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 2c23649e..57ce12b0 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
@@ -1916,12 +1916,15 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
}
private void openViewPostDetailActivity(Post post, int position) {
- Intent intent = new Intent(mActivity, ViewPostDetailActivity.class);
- intent.putExtra(ViewPostDetailActivity.EXTRA_POST_DATA, post);
- intent.putExtra(ViewPostDetailActivity.EXTRA_POST_LIST_POSITION, position);
- intent.putExtra(ViewPostDetailActivity.EXTRA_POST_FRAGMENT_ID, mFragment.getPostFragmentId());
- intent.putExtra(ViewPostDetailActivity.EXTRA_IS_NSFW_SUBREDDIT, mFragment.getIsNsfwSubreddit());
- mActivity.startActivity(intent);
+ 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);
+ intent.putExtra(ViewPostDetailActivity.EXTRA_POST_FRAGMENT_ID, mFragment.getPostFragmentId());
+ intent.putExtra(ViewPostDetailActivity.EXTRA_IS_NSFW_SUBREDDIT, mFragment.getIsNsfwSubreddit());
+ mActivity.startActivity(intent);
+ }
}
private void openMedia(Post post) {
@@ -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());