diff options
Diffstat (limited to 'app')
2 files changed, 23 insertions, 0 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java index 9363a9d8..4d8ec1a4 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java @@ -711,6 +711,9 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_RANDOM: fab.setImageResource(R.drawable.ic_random_24dp); break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS: + fab.setImageResource(R.drawable.ic_hide_read_posts_24dp); + break; default: fab.setImageResource(R.drawable.ic_add_day_night_24dp); break; @@ -746,6 +749,11 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_RANDOM: random(); break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS: + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.hideReadPosts(); + } + break; default: postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag()); break; @@ -1125,6 +1133,11 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp random(); break; } + case FABMoreOptionsBottomSheetFragment.FAB_HIDE_READ_POSTS: { + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.hideReadPosts(); + } + } } } @@ -1314,6 +1327,15 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp } } + void hideReadPosts() { + if (fragmentManager != null) { + Fragment fragment = fragmentManager.findFragmentByTag("f0"); + if (fragment instanceof PostFragment) { + ((PostFragment) fragment).hideReadPosts(); + } + } + } + @Override public int getItemCount() { return 2; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java index 44bf874f..674ea87d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java @@ -208,6 +208,7 @@ public class SharedPreferencesUtils { public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT = 5; public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_USER = 6; public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_RANDOM = 7; + public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS = 8; public static final String NSFW_AND_SPOILER_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.nsfw_and_spoiler"; public static final String NSFW_BASE = "_nsfw"; |