Fix app crashes when selecting go to top option in customize bottom navigation setting in anonymous mode.

This commit is contained in:
Docile-Alligator 2025-10-27 17:16:35 -04:00
parent 57ea8a0b31
commit 2f5ab4e175
6 changed files with 26 additions and 40 deletions

View File

@ -607,16 +607,13 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
startActivity(intent);
break;
}
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GO_TO_TOP: {
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GO_TO_TOP:
default: {
if (sectionsPagerAdapter != null) {
sectionsPagerAdapter.goBackToTop();
}
break;
}
default:
PostTypeBottomSheetFragment postTypeBottomSheetFragment = new PostTypeBottomSheetFragment();
postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag());
break;
}
}
@ -657,9 +654,8 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_SAVED:
return R.drawable.ic_bookmarks_day_night_24dp;
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GO_TO_TOP:
return R.drawable.ic_keyboard_double_arrow_up_day_night_24dp;
default:
return R.drawable.ic_account_circle_day_night_24dp;
return R.drawable.ic_keyboard_double_arrow_up_day_night_24dp;
}
}
@ -1168,6 +1164,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
view.setContentDescription(getString(R.string.content_description_saved));
break;
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GO_TO_TOP :
default:
view.setContentDescription(getString(R.string.content_description_go_to_top));
break;
}

View File

@ -602,16 +602,13 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT
startActivity(intent);
break;
}
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_TOP: {
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_TOP:
default: {
if (mFragment instanceof PostFragment) {
((PostFragment) mFragment).goBackToTop();
}
break;
}
default:
PostTypeBottomSheetFragment postTypeBottomSheetFragment = new PostTypeBottomSheetFragment();
postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag());
break;
}
}
@ -654,9 +651,8 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SAVED:
return R.drawable.ic_bookmarks_day_night_24dp;
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_TOP:
return R.drawable.ic_keyboard_double_arrow_up_day_night_24dp;
default:
return R.drawable.ic_account_circle_day_night_24dp;
return R.drawable.ic_keyboard_double_arrow_up_day_night_24dp;
}
}

View File

@ -776,16 +776,13 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
startActivity(intent);
break;
}
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_TOP: {
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_TOP:
default: {
if (sectionsPagerAdapter != null) {
sectionsPagerAdapter.goBackToTop();
}
break;
}
default:
PostTypeBottomSheetFragment postTypeBottomSheetFragment = new PostTypeBottomSheetFragment();
postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag());
break;
}
}
@ -828,9 +825,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SAVED:
return R.drawable.ic_bookmarks_day_night_24dp;
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_TOP:
return R.drawable.ic_keyboard_double_arrow_up_day_night_24dp;
default:
return R.drawable.ic_account_circle_day_night_24dp;
return R.drawable.ic_keyboard_double_arrow_up_day_night_24dp;
}
}

View File

@ -1102,16 +1102,13 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
startActivity(intent);
break;
}
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_TOP: {
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_TOP:
default: {
if (sectionsPagerAdapter != null) {
sectionsPagerAdapter.goBackToTop();
}
break;
}
default:
PostTypeBottomSheetFragment postTypeBottomSheetFragment = new PostTypeBottomSheetFragment();
postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag());
break;
}
}
@ -1154,9 +1151,8 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SAVED:
return R.drawable.ic_bookmarks_day_night_24dp;
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_TOP:
return R.drawable.ic_keyboard_double_arrow_up_day_night_24dp;
default:
return R.drawable.ic_account_circle_day_night_24dp;
return R.drawable.ic_keyboard_double_arrow_up_day_night_24dp;
}
}

View File

@ -179,34 +179,35 @@ public class NavigationWrapper {
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SEARCH:
view.setContentDescription(context.getString(R.string.content_description_search));
break;
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_SUBREDDIT :
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_SUBREDDIT:
view.setContentDescription(context.getString(R.string.content_description_go_to_subreddit));
break;
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_USER :
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_USER:
view.setContentDescription(context.getString(R.string.content_description_go_to_user));
break;
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_RANDOM :
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_RANDOM:
view.setContentDescription(context.getString(R.string.content_description_random));
break;
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_HIDE_READ_POSTS :
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_HIDE_READ_POSTS:
view.setContentDescription(context.getString(R.string.content_description_hide_read_posts));
break;
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_FILTER_POSTS :
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_FILTER_POSTS:
view.setContentDescription(context.getString(R.string.content_description_filter_posts));
break;
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_UPVOTED :
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_UPVOTED:
view.setContentDescription(context.getString(R.string.content_description_upvoted));
break;
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_DOWNVOTED :
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_DOWNVOTED:
view.setContentDescription(context.getString(R.string.content_description_downvoted));
break;
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_HIDDEN :
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_HIDDEN:
view.setContentDescription(context.getString(R.string.content_description_hidden));
break;
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SAVED :
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SAVED:
view.setContentDescription(context.getString(R.string.content_description_saved));
break;
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_TOP :
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_TOP:
default:
view.setContentDescription(context.getString(R.string.content_description_go_to_top));
break;
}

View File

@ -338,7 +338,7 @@
<item>10</item>
<item>11</item>
<item>13</item>
<item>19</item>
<item>18</item>
</string-array>
<string-array name="settings_other_activities_bottom_app_bar_options">
@ -391,7 +391,7 @@
<item>11</item>
<item>12</item>
<item>14</item>
<item>20</item>
<item>19</item>
</string-array>
<string-array name="settings_bottom_app_bar_fab_options">