aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2020-12-09 06:22:00 +0000
committerAlex Ning <chineseperson5@gmail.com>2020-12-09 06:22:00 +0000
commit459f75b749865ed8501b22dcb5f9a600fb9ad950 (patch)
treeb67d42a82932c4a0fb25485c6b33288573443cd2
parentb38025882d7b03adb0a3acad136b90d4bafdcf0a (diff)
downloadinfinity-for-reddit-459f75b749865ed8501b22dcb5f9a600fb9ad950.tar
infinity-for-reddit-459f75b749865ed8501b22dcb5f9a600fb9ad950.tar.gz
infinity-for-reddit-459f75b749865ed8501b22dcb5f9a600fb9ad950.tar.bz2
infinity-for-reddit-459f75b749865ed8501b22dcb5f9a600fb9ad950.tar.lz
infinity-for-reddit-459f75b749865ed8501b22dcb5f9a600fb9ad950.tar.xz
infinity-for-reddit-459f75b749865ed8501b22dcb5f9a600fb9ad950.tar.zst
infinity-for-reddit-459f75b749865ed8501b22dcb5f9a600fb9ad950.zip
Disable marking posts as read in AccountPostsActivity and AccountSavedThingActivity.
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountPostsActivity.java1
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountSavedThingActivity.java1
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java23
3 files changed, 16 insertions, 9 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountPostsActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountPostsActivity.java
index 27292222..8c340208 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountPostsActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountPostsActivity.java
@@ -201,6 +201,7 @@ public class AccountPostsActivity extends BaseActivity implements SortTypeSelect
bundle.putInt(PostFragment.EXTRA_FILTER, PostFragment.EXTRA_NO_FILTER);
bundle.putString(PostFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
bundle.putString(PostFragment.EXTRA_ACCOUNT_NAME, mAccountName);
+ bundle.putBoolean(PostFragment.EXTRA_DISABLE_READ_POSTS, true);
mFragment.setArguments(bundle);
getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_account_posts_activity, mFragment).commit();
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountSavedThingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountSavedThingActivity.java
index 9be885d1..5069d2e4 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountSavedThingActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountSavedThingActivity.java
@@ -361,6 +361,7 @@ public class AccountSavedThingActivity extends BaseActivity implements ActivityT
bundle.putInt(PostFragment.EXTRA_FILTER, PostFragment.EXTRA_NO_FILTER);
bundle.putString(PostFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
bundle.putString(PostFragment.EXTRA_ACCOUNT_NAME, mAccountName);
+ bundle.putBoolean(PostFragment.EXTRA_DISABLE_READ_POSTS, true);
fragment.setArguments(bundle);
return fragment;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java
index 415bff31..91e2ca0f 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java
@@ -131,6 +131,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
public static final int EXTRA_NO_FILTER = -2;
public static final String EXTRA_ACCESS_TOKEN = "EAT";
public static final String EXTRA_ACCOUNT_NAME = "EAN";
+ public static final String EXTRA_DISABLE_READ_POSTS = "EDRP";
private static final String IS_IN_LAZY_MODE_STATE = "IILMS";
private static final String RECYCLER_VIEW_POSITION_STATE = "RVPS";
@@ -674,15 +675,19 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
if (accountName != null && !accountName.equals("")) {
if (readPosts == null) {
- FetchReadPosts.fetchReadPosts(mRedditDataRoomDatabase, accountName,
- postType == PostDataSource.TYPE_SUBREDDIT && subredditName != null && (subredditName.equals("all") || subredditName.equals("popular")),
- (readPosts, subredditFilters) -> {
- if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) {
- this.readPosts = readPosts;
- this.subredditFilterList = subredditFilters;
- initializeAndBindPostViewModel(accessToken, locale, filter, nsfw);
- }
- });
+ if (getArguments().getBoolean(EXTRA_DISABLE_READ_POSTS, false)) {
+ initializeAndBindPostViewModel(accessToken, locale, filter, nsfw);
+ } else {
+ FetchReadPosts.fetchReadPosts(mRedditDataRoomDatabase, accountName,
+ postType == PostDataSource.TYPE_SUBREDDIT && subredditName != null && (subredditName.equals("all") || subredditName.equals("popular")),
+ (readPosts, subredditFilters) -> {
+ if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) {
+ this.readPosts = readPosts;
+ this.subredditFilterList = subredditFilters;
+ initializeAndBindPostViewModel(accessToken, locale, filter, nsfw);
+ }
+ });
+ }
} else {
initializeAndBindPostViewModel(accessToken, locale, filter, nsfw);
}