diff options
author | Alex Ning <chineseperson5@gmail.com> | 2020-12-08 07:26:22 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2020-12-08 07:26:22 +0000 |
commit | 59baa9c51cb0f18c39e7c78a56fc26e755971dcc (patch) | |
tree | 5b5dabe4bc78fad60db20a4deada34a1eff3763e /app/src/main | |
parent | a6975f2489119a0e0cc278fcdee8cead97978b14 (diff) | |
download | infinity-for-reddit-59baa9c51cb0f18c39e7c78a56fc26e755971dcc.tar infinity-for-reddit-59baa9c51cb0f18c39e7c78a56fc26e755971dcc.tar.gz infinity-for-reddit-59baa9c51cb0f18c39e7c78a56fc26e755971dcc.tar.bz2 infinity-for-reddit-59baa9c51cb0f18c39e7c78a56fc26e755971dcc.tar.lz infinity-for-reddit-59baa9c51cb0f18c39e7c78a56fc26e755971dcc.tar.xz infinity-for-reddit-59baa9c51cb0f18c39e7c78a56fc26e755971dcc.tar.zst infinity-for-reddit-59baa9c51cb0f18c39e7c78a56fc26e755971dcc.zip |
Hide read posts in ViewSubredditDetailActivity.
Diffstat (limited to '')
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"; |