From 68d247867f1e67ed7e62e396cdb622d8970a572f Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Thu, 1 Apr 2021 21:36:01 +0800 Subject: More options for the bottom app bar. --- .../infinityforreddit/activities/MainActivity.java | 45 ++++++++++++++++++++++ .../activities/ViewSubredditDetailActivity.java | 45 ++++++++++++++++++++++ .../utils/SharedPreferencesUtils.java | 10 +++++ 3 files changed, 100 insertions(+) (limited to 'app/src/main/java/ml') 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 1cf15575..0ea37503 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java @@ -469,6 +469,41 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb sectionsPagerAdapter.filterPosts(); } break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_UPVOTED: { + Intent intent = new Intent(this, AccountPostsActivity.class); + intent = new Intent(MainActivity.this, AccountPostsActivity.class); + intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_UPVOTED); + startActivity(intent); + break; + } + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_DOWNVOTED: { + Intent intent = new Intent(this, AccountPostsActivity.class); + intent = new Intent(MainActivity.this, AccountPostsActivity.class); + intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_DOWNVOTED); + startActivity(intent); + break; + } + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_HIDDEN: { + Intent intent = new Intent(this, AccountPostsActivity.class); + intent = new Intent(MainActivity.this, AccountPostsActivity.class); + intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_HIDDEN); + startActivity(intent); + break; + } + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_SAVED: { + Intent intent = new Intent(this, AccountPostsActivity.class); + intent = new Intent(MainActivity.this, AccountPostsActivity.class); + intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_SAVED); + startActivity(intent); + break; + } + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GILDED: { + Intent intent = new Intent(this, AccountPostsActivity.class); + intent = new Intent(MainActivity.this, AccountPostsActivity.class); + intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_GILDED); + startActivity(intent); + break; + } default: PostTypeBottomSheetFragment postTypeBottomSheetFragment = new PostTypeBottomSheetFragment(); postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag()); @@ -505,6 +540,16 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb return R.drawable.ic_hide_read_posts_24dp; case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_FILTER_POSTS: return R.drawable.ic_filter_24dp; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_UPVOTED: + return R.drawable.ic_arrow_upward_black_24dp; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_DOWNVOTED: + return R.drawable.ic_arrow_downward_black_24dp; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_HIDDEN: + return R.drawable.ic_outline_lock_24dp; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_SAVED: + return R.drawable.ic_outline_bookmarks_24dp; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GILDED: + return R.drawable.ic_star_border_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 e0a9ab7a..981f4d75 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java @@ -599,6 +599,41 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp sectionsPagerAdapter.filterPosts(); } break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_UPVOTED: { + Intent intent = new Intent(this, AccountPostsActivity.class); + intent = new Intent(this, AccountPostsActivity.class); + intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_UPVOTED); + startActivity(intent); + break; + } + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_DOWNVOTED: { + Intent intent = new Intent(this, AccountPostsActivity.class); + intent = new Intent(this, AccountPostsActivity.class); + intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_DOWNVOTED); + startActivity(intent); + break; + } + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_HIDDEN: { + Intent intent = new Intent(this, AccountPostsActivity.class); + intent = new Intent(this, AccountPostsActivity.class); + intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_HIDDEN); + startActivity(intent); + break; + } + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SAVED: { + Intent intent = new Intent(this, AccountPostsActivity.class); + intent = new Intent(this, AccountPostsActivity.class); + intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_SAVED); + startActivity(intent); + break; + } + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GILDED: { + Intent intent = new Intent(this, AccountPostsActivity.class); + intent = new Intent(this, AccountPostsActivity.class); + intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_GILDED); + startActivity(intent); + break; + } default: PostTypeBottomSheetFragment postTypeBottomSheetFragment = new PostTypeBottomSheetFragment(); postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag()); @@ -636,6 +671,16 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp return R.drawable.ic_hide_read_posts_24dp; case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_FILTER_POSTS: return R.drawable.ic_filter_24dp; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_UPVOTED: + return R.drawable.ic_arrow_upward_black_24dp; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_DOWNVOTED: + return R.drawable.ic_arrow_downward_black_24dp; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_HIDDEN: + return R.drawable.ic_outline_lock_24dp; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SAVED: + return R.drawable.ic_outline_bookmarks_24dp; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GILDED: + return R.drawable.ic_star_border_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 48714674..2aeb34c6 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java @@ -232,6 +232,11 @@ public class SharedPreferencesUtils { 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_OPTION_UPVOTED = 14; + public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_DOWNVOTED = 15; + public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_HIDDEN = 16; + public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_SAVED = 17; + public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GILDED = 18; 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; @@ -259,6 +264,11 @@ public class SharedPreferencesUtils { 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_OPTION_UPVOTED = 15; + public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_DOWNVOTED = 16; + public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_HIDDEN = 17; + public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SAVED = 18; + public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GILDED = 19; 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; -- cgit v1.2.3