diff options
Diffstat (limited to '')
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); } |