diff options
author | andrewrasch <raschykid@gmail.com> | 2021-09-22 00:37:41 +0000 |
---|---|---|
committer | andrewrasch <raschykid@gmail.com> | 2021-09-22 00:37:41 +0000 |
commit | a651935fa57d26a9a035d82a3936b198625740bd (patch) | |
tree | 1cae9233bfd7aeccbdb4855f50bd60daf0408f32 | |
parent | d6c3bfddd713b064e545461238978d3fa6c9941e (diff) | |
download | infinity-for-reddit-a651935fa57d26a9a035d82a3936b198625740bd.tar infinity-for-reddit-a651935fa57d26a9a035d82a3936b198625740bd.tar.gz infinity-for-reddit-a651935fa57d26a9a035d82a3936b198625740bd.tar.bz2 infinity-for-reddit-a651935fa57d26a9a035d82a3936b198625740bd.tar.lz infinity-for-reddit-a651935fa57d26a9a035d82a3936b198625740bd.tar.xz infinity-for-reddit-a651935fa57d26a9a035d82a3936b198625740bd.tar.zst infinity-for-reddit-a651935fa57d26a9a035d82a3936b198625740bd.zip |
Added go to top of page option.
Added Main + Other Activity bottom bar option to go to the top of a page.
5 files changed, 21 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 430d7bc0..f2b4b21c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java @@ -523,6 +523,12 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb startActivity(intent); break; } + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GO_TO_TOP: { + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.goBackToTop(); + } + break; + } default: PostTypeBottomSheetFragment postTypeBottomSheetFragment = new PostTypeBottomSheetFragment(); postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag()); @@ -569,6 +575,8 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb return R.drawable.ic_outline_bookmarks_24dp; case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GILDED: return R.drawable.ic_star_border_24dp; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GO_TO_TOP: + return R.drawable.ic_home_black_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 4096a96b..7371f5d3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java @@ -698,6 +698,12 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp startActivity(intent); break; } + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_TOP: { + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.goBackToTop(); + } + break; + } default: PostTypeBottomSheetFragment postTypeBottomSheetFragment = new PostTypeBottomSheetFragment(); postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag()); @@ -745,6 +751,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp return R.drawable.ic_outline_bookmarks_24dp; case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GILDED: return R.drawable.ic_star_border_24dp; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_TOP: + return R.drawable.ic_home_black_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 27e6a0b4..1d5838e1 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java @@ -249,6 +249,7 @@ public class SharedPreferencesUtils { 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_OPTION_GO_TO_TOP = 19; 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; @@ -281,6 +282,7 @@ public class SharedPreferencesUtils { 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_OPTION_GO_TO_TOP = 20; 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; diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index f8097c33..50c7b6c6 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -283,6 +283,7 @@ <item>@string/hidden</item> <item>@string/saved</item> <item>@string/gilded</item> + <item>@string/go_to_top</item> </string-array> <string-array name="settings_other_activities_bottom_app_bar_options"> @@ -306,6 +307,7 @@ <item>@string/hidden</item> <item>@string/saved</item> <item>@string/gilded</item> + <item>@string/go_to_top</item> </string-array> <string-array name="settings_bottom_app_bar_fab_options"> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 68ab820b..b94cac10 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1190,5 +1190,6 @@ <string name="app_lock_timeout_6_hours">6 hours</string> <string name="app_lock_timeout_12_hours">12 hours</string> <string name="app_lock_timeout_24_hours">24 hours</string> + <string name="go_to_top">Go To Top</string> </resources> |