diff options
author | Alex Ning <chineseperson5@gmail.com> | 2021-01-18 10:46:45 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2021-01-18 10:46:45 +0000 |
commit | d2749d15d5009dfca3bbbdcf40c3512f1ee792e4 (patch) | |
tree | e1b6bd52ff41c4de2d8cccb75cb52acb0ba590b2 /app/src/main/java/ml/docilealligator/infinityforreddit | |
parent | c7f776b048b6f04ffe5ce726812725141827b27d (diff) | |
download | infinity-for-reddit-d2749d15d5009dfca3bbbdcf40c3512f1ee792e4.tar infinity-for-reddit-d2749d15d5009dfca3bbbdcf40c3512f1ee792e4.tar.gz infinity-for-reddit-d2749d15d5009dfca3bbbdcf40c3512f1ee792e4.tar.bz2 infinity-for-reddit-d2749d15d5009dfca3bbbdcf40c3512f1ee792e4.tar.lz infinity-for-reddit-d2749d15d5009dfca3bbbdcf40c3512f1ee792e4.tar.xz infinity-for-reddit-d2749d15d5009dfca3bbbdcf40c3512f1ee792e4.tar.zst infinity-for-reddit-d2749d15d5009dfca3bbbdcf40c3512f1ee792e4.zip |
Add more options to the bottom app bar.
Diffstat (limited to 'app/src/main/java/ml/docilealligator/infinityforreddit')
3 files changed, 152 insertions, 0 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java index 625be3e3..3045b6a4 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java @@ -485,6 +485,50 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb startActivity(intent); break; } + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_REFRESH: { + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.refresh(); + } + break; + } + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_CHANGE_SORT_TYPE: { + changeSortType(); + break; + } + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_CHANGE_POST_LAYOUT: { + PostLayoutBottomSheetFragment postLayoutBottomSheetFragment = new PostLayoutBottomSheetFragment(); + postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag()); + break; + } + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_SEARCH: { + Intent intent = new Intent(this, SearchActivity.class); + startActivity(intent); + break; + } + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GO_TO_SUBREDDIT: + goToSubreddit(); + break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GO_TO_USER: + goToUser(); + break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_RANDOM: + randomThing(); + break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_HIDE_READ_POSTS: + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.hideReadPosts(); + } + break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_FILTER_POSTS: + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.filterPosts(); + } + break; + default: + PostTypeBottomSheetFragment postTypeBottomSheetFragment = new PostTypeBottomSheetFragment(); + postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag()); + break; + } } @@ -496,6 +540,26 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb return R.drawable.ic_multi_reddit_24dp; case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_INBOX: return R.drawable.ic_inbox_24dp; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_SUBMIT_POSTS: + return R.drawable.ic_add_day_night_24dp; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_REFRESH: + return R.drawable.ic_refresh_24dp; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_CHANGE_SORT_TYPE: + return R.drawable.ic_sort_toolbar_24dp; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_CHANGE_POST_LAYOUT: + return R.drawable.ic_post_layout_24dp; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_SEARCH: + return R.drawable.ic_search_black_24dp; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GO_TO_SUBREDDIT: + return R.drawable.ic_subreddit_24dp; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GO_TO_USER: + return R.drawable.ic_user_24dp; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_RANDOM: + return R.drawable.ic_random_24dp; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_HIDE_READ_POSTS: + return R.drawable.ic_hide_read_posts_24dp; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_FILTER_POSTS: + return R.drawable.ic_filter_24dp; default: return R.drawable.ic_account_circle_24dp; } 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 b657f0fa..d0fc6475 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java @@ -574,6 +574,50 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp startActivity(intent); break; } + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_REFRESH: { + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.refresh(); + } + break; + } + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_CHANGE_SORT_TYPE: { + displaySortTypeBottomSheetFragment(); + break; + } + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_CHANGE_POST_LAYOUT: { + PostLayoutBottomSheetFragment postLayoutBottomSheetFragment = new PostLayoutBottomSheetFragment(); + postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag()); + break; + } + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SEARCH: { + Intent intent = new Intent(this, SearchActivity.class); + intent.putExtra(SearchActivity.EXTRA_SUBREDDIT_NAME, subredditName); + startActivity(intent); + break; + } + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_SUBREDDIT: + goToSubreddit(); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_USER: + goToUser(); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_RANDOM: + random(); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_HIDE_READ_POSTS: + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.hideReadPosts(); + } + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_FILTER_POSTS: + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.filterPosts(); + } + break; + default: + PostTypeBottomSheetFragment postTypeBottomSheetFragment = new PostTypeBottomSheetFragment(); + postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag()); + break; } } @@ -587,6 +631,26 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp return R.drawable.ic_inbox_24dp; case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_MULTIREDDITS: return R.drawable.ic_multi_reddit_24dp; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SUBMIT_POSTS: + return R.drawable.ic_add_day_night_24dp; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_REFRESH: + return R.drawable.ic_refresh_24dp; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_CHANGE_SORT_TYPE: + return R.drawable.ic_sort_toolbar_24dp; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_CHANGE_POST_LAYOUT: + return R.drawable.ic_post_layout_24dp; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SEARCH: + return R.drawable.ic_search_black_24dp; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_SUBREDDIT: + return R.drawable.ic_subreddit_24dp; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_USER: + return R.drawable.ic_user_24dp; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_RANDOM: + return R.drawable.ic_random_24dp; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_HIDE_READ_POSTS: + return R.drawable.ic_hide_read_posts_24dp; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_FILTER_POSTS: + return R.drawable.ic_filter_24dp; default: return R.drawable.ic_account_circle_24dp; } 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 0d6c9ffe..85be7c4e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java @@ -186,10 +186,22 @@ public class SharedPreferencesUtils { public static final String OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_3 = "other_activities_bottom_app_bar_option_3"; public static final String OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_4 = "other_activities_bottom_app_bar_option_4"; public static final String OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB = "other_activities_bottom_app_bar_fab"; + public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_SUBSCRIPTIONS = 0; public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_MULTIREDDITS = 1; public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_INBOX = 2; public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_PROFILE = 3; + public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_SUBMIT_POSTS = 4; + public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_REFRESH = 5; + public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_CHANGE_SORT_TYPE = 6; + public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_CHANGE_POST_LAYOUT = 7; + public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_SEARCH = 8; + public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GO_TO_SUBREDDIT = 9; + public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GO_TO_USER = 10; + public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_RANDOM = 11; + public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_HIDE_READ_POSTS = 12; + public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_FILTER_POSTS = 13; + public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_SUBMIT_POSTS = 0; public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_REFRESH = 1; public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE = 2; @@ -200,11 +212,23 @@ public class SharedPreferencesUtils { public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_RANDOM = 7; public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS = 8; public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_FILTER_POSTS = 9; + public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_HOME = 0; public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SUBSCRIPTIONS = 1; public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_INBOX = 2; public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_PROFILE = 3; public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_MULTIREDDITS = 4; + public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SUBMIT_POSTS = 5; + public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_REFRESH = 6; + public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_CHANGE_SORT_TYPE = 7; + public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_CHANGE_POST_LAYOUT = 8; + public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SEARCH = 9; + public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_SUBREDDIT = 10; + public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_USER = 11; + public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_RANDOM = 12; + public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_HIDE_READ_POSTS = 13; + public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_FILTER_POSTS = 14; + public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SUBMIT_POSTS = 0; public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_REFRESH = 1; public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE = 2; |