diff options
Diffstat (limited to 'app/src/main/java')
7 files changed, 225 insertions, 14 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/BaseActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/BaseActivity.java index fde2926e..d0c873d0 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/BaseActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/BaseActivity.java @@ -405,6 +405,44 @@ public abstract class BaseActivity extends AppCompatActivity implements CustomFo } catch (NoSuchFieldException | IllegalAccessException ignore) {} } + protected void setOtherActivitiesFabContentDescription(FloatingActionButton fab, int fabOption) { + switch (fabOption) { + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SUBMIT_POSTS: + fab.setContentDescription(getString(R.string.content_description_submit_post)); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_REFRESH: + fab.setContentDescription(getString(R.string.content_description_refresh)); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE: + fab.setContentDescription(getString(R.string.content_description_change_sort_type)); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT: + fab.setContentDescription(getString(R.string.content_description_change_post_layout)); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SEARCH: + fab.setContentDescription(getString(R.string.content_description_search)); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT: + fab.setContentDescription(getString(R.string.content_description_go_to_subreddit)); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_USER: + fab.setContentDescription(getString(R.string.content_description_go_to_user)); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_RANDOM: + fab.setContentDescription(getString(R.string.content_description_random)); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS: + fab.setContentDescription(getString(R.string.content_description_hide_read_posts)); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_FILTER_POSTS: + fab.setContentDescription(getString(R.string.content_description_filter_posts)); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_TOP: + fab.setContentDescription(getString(R.string.content_description_go_to_top)); + break; + } + } + @Override public void setCustomFont(Typeface typeface, Typeface titleTypeface, Typeface contentTypeface) { this.typeface = typeface; 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 4500b4e5..e49ec447 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java @@ -79,8 +79,8 @@ import ml.docilealligator.infinityforreddit.account.AccountViewModel; import ml.docilealligator.infinityforreddit.adapters.SubredditAutocompleteRecyclerViewAdapter; import ml.docilealligator.infinityforreddit.adapters.navigationdrawer.NavigationDrawerRecyclerViewMergedAdapter; import ml.docilealligator.infinityforreddit.apis.RedditAPI; -import ml.docilealligator.infinityforreddit.asynctasks.InsertSubscribedThings; import ml.docilealligator.infinityforreddit.asynctasks.AccountManagement; +import ml.docilealligator.infinityforreddit.asynctasks.InsertSubscribedThings; import ml.docilealligator.infinityforreddit.bottomsheetfragments.FABMoreOptionsBottomSheetFragment; import ml.docilealligator.infinityforreddit.bottomsheetfragments.PostLayoutBottomSheetFragment; import ml.docilealligator.infinityforreddit.bottomsheetfragments.PostTypeBottomSheetFragment; @@ -571,6 +571,9 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb navigationWrapper.option4BottomAppBar.setOnClickListener(view -> { bottomAppBarOptionAction(option2); }); + + setBottomAppBarContentDescription(navigationWrapper.option2BottomAppBar, option1); + setBottomAppBarContentDescription(navigationWrapper.option4BottomAppBar, option2); } else { navigationWrapper.navigationRailView.setOnItemSelectedListener(item -> { int itemId = item.getItemId(); @@ -608,6 +611,11 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb navigationWrapper.option4BottomAppBar.setOnClickListener(view -> { bottomAppBarOptionAction(option4); }); + + setBottomAppBarContentDescription(navigationWrapper.option1BottomAppBar, option1); + setBottomAppBarContentDescription(navigationWrapper.option2BottomAppBar, option2); + setBottomAppBarContentDescription(navigationWrapper.option3BottomAppBar, option3); + setBottomAppBarContentDescription(navigationWrapper.option4BottomAppBar, option4); } else { navigationWrapper.navigationRailView.setOnItemSelectedListener(item -> { int itemId = item.getItemId(); @@ -640,45 +648,58 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb switch (fabOption) { case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_REFRESH: navigationWrapper.floatingActionButton.setImageResource(R.drawable.ic_refresh_24dp); + navigationWrapper.floatingActionButton.setContentDescription(getString(R.string.content_description_refresh)); break; case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE: navigationWrapper.floatingActionButton.setImageResource(R.drawable.ic_sort_toolbar_24dp); + navigationWrapper.floatingActionButton.setContentDescription(getString(R.string.content_description_change_sort_type)); break; case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT: navigationWrapper.floatingActionButton.setImageResource(R.drawable.ic_post_layout_24dp); + navigationWrapper.floatingActionButton.setContentDescription(getString(R.string.content_description_change_post_layout)); break; case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_SEARCH: navigationWrapper.floatingActionButton.setImageResource(R.drawable.ic_search_24dp); + navigationWrapper.floatingActionButton.setContentDescription(getString(R.string.content_description_search)); break; case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT: navigationWrapper.floatingActionButton.setImageResource(R.drawable.ic_subreddit_24dp); + navigationWrapper.floatingActionButton.setContentDescription(getString(R.string.content_description_go_to_subreddit)); break; case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_GO_TO_USER: navigationWrapper.floatingActionButton.setImageResource(R.drawable.ic_user_24dp); + navigationWrapper.floatingActionButton.setContentDescription(getString(R.string.content_description_go_to_user)); break; case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_RANDOM: navigationWrapper.floatingActionButton.setImageResource(R.drawable.ic_random_24dp); + navigationWrapper.floatingActionButton.setContentDescription(getString(R.string.content_description_random)); break; case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS: if (accountName.equals(Account.ANONYMOUS_ACCOUNT)) { navigationWrapper.floatingActionButton.setImageResource(R.drawable.ic_filter_24dp); fabOption = SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_FILTER_POSTS; + navigationWrapper.floatingActionButton.setContentDescription(getString(R.string.content_description_filter_posts)); } else { navigationWrapper.floatingActionButton.setImageResource(R.drawable.ic_hide_read_posts_24dp); + navigationWrapper.floatingActionButton.setContentDescription(getString(R.string.content_description_hide_read_posts)); } break; case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_FILTER_POSTS: navigationWrapper.floatingActionButton.setImageResource(R.drawable.ic_filter_24dp); + navigationWrapper.floatingActionButton.setContentDescription(getString(R.string.content_description_filter_posts)); break; case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_GO_TO_TOP: navigationWrapper.floatingActionButton.setImageResource(R.drawable.ic_keyboard_double_arrow_up_24); + navigationWrapper.floatingActionButton.setContentDescription(getString(R.string.content_description_go_to_top)); break; default: if (accountName.equals(Account.ANONYMOUS_ACCOUNT)) { navigationWrapper.floatingActionButton.setImageResource(R.drawable.ic_filter_24dp); fabOption = SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_FILTER_POSTS; + navigationWrapper.floatingActionButton.setContentDescription(getString(R.string.content_description_filter_posts)); } else { navigationWrapper.floatingActionButton.setImageResource(R.drawable.ic_add_day_night_24dp); + navigationWrapper.floatingActionButton.setContentDescription(getString(R.string.content_description_submit_post)); } break; } @@ -984,6 +1005,68 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb } } + public void setBottomAppBarContentDescription(View view, int option) { + switch (option) { + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_SUBSCRIPTIONS: + view.setContentDescription(getString(R.string.content_description_subscriptions)); + break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_INBOX: + view.setContentDescription(getString(R.string.content_description_inbox)); + break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_PROFILE: + view.setContentDescription(getString(R.string.content_description_profile)); + break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_MULTIREDDITS: + view.setContentDescription(getString(R.string.content_description_multireddits)); + break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_SUBMIT_POSTS: + view.setContentDescription(getString(R.string.content_description_submit_post)); + break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_REFRESH: + view.setContentDescription(getString(R.string.content_description_refresh)); + break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_CHANGE_SORT_TYPE: + view.setContentDescription(getString(R.string.content_description_change_sort_type)); + break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_CHANGE_POST_LAYOUT: + view.setContentDescription(getString(R.string.content_description_change_post_layout)); + break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_SEARCH: + view.setContentDescription(getString(R.string.content_description_search)); + break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GO_TO_SUBREDDIT : + view.setContentDescription(getString(R.string.content_description_go_to_subreddit)); + break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GO_TO_USER : + view.setContentDescription(getString(R.string.content_description_go_to_user)); + break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_RANDOM : + view.setContentDescription(getString(R.string.content_description_random)); + break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_HIDE_READ_POSTS : + view.setContentDescription(getString(R.string.content_description_hide_read_posts)); + break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_FILTER_POSTS : + view.setContentDescription(getString(R.string.content_description_filter_posts)); + break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_UPVOTED : + view.setContentDescription(getString(R.string.content_description_upvoted)); + break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_DOWNVOTED : + view.setContentDescription(getString(R.string.content_description_downvoted)); + break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_HIDDEN : + view.setContentDescription(getString(R.string.content_description_hidden)); + break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_SAVED : + view.setContentDescription(getString(R.string.content_description_saved)); + break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GO_TO_TOP : + view.setContentDescription(getString(R.string.content_description_go_to_top)); + break; + } + } + private void loadSubscriptions() { if (System.currentTimeMillis() - mCurrentAccountSharedPreferences.getLong(SharedPreferencesUtils.SUBSCRIBED_THINGS_SYNC_TIME, 0L) < 24 * 60 * 60 * 1000) { return; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java index fe0c16fe..77c59575 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java @@ -280,61 +280,51 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect switch (fabOption) { case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_REFRESH: binding.fabSearchResultActivity.setImageResource(R.drawable.ic_refresh_24dp); - binding.fabSearchResultActivity.setContentDescription(getString(R.string.content_description_refresh)); break; case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE: binding.fabSearchResultActivity.setImageResource(R.drawable.ic_sort_toolbar_24dp); - binding.fabSearchResultActivity.setContentDescription(getString(R.string.content_description_change_sort_type)); break; case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT: binding.fabSearchResultActivity.setImageResource(R.drawable.ic_post_layout_24dp); - binding.fabSearchResultActivity.setContentDescription(getString(R.string.content_description_change_post_layout)); break; case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SEARCH: binding.fabSearchResultActivity.setImageResource(R.drawable.ic_search_24dp); - binding.fabSearchResultActivity.setContentDescription(getString(R.string.content_description_search)); break; case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT: binding.fabSearchResultActivity.setImageResource(R.drawable.ic_subreddit_24dp); - binding.fabSearchResultActivity.setContentDescription(getString(R.string.content_description_go_to_subreddit)); break; case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_USER: binding.fabSearchResultActivity.setImageResource(R.drawable.ic_user_24dp); - binding.fabSearchResultActivity.setContentDescription(getString(R.string.content_description_go_to_user)); break; case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_RANDOM: binding.fabSearchResultActivity.setImageResource(R.drawable.ic_random_24dp); - binding.fabSearchResultActivity.setContentDescription(getString(R.string.content_description_random)); break; case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS: if (accountName.equals(Account.ANONYMOUS_ACCOUNT)) { binding.fabSearchResultActivity.setImageResource(R.drawable.ic_filter_24dp); fabOption = SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_FILTER_POSTS; - binding.fabSearchResultActivity.setContentDescription(getString(R.string.content_description_filter_posts)); } else { binding.fabSearchResultActivity.setImageResource(R.drawable.ic_hide_read_posts_24dp); - binding.fabSearchResultActivity.setContentDescription(getString(R.string.content_description_hide_read_posts)); } break; case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_FILTER_POSTS: binding.fabSearchResultActivity.setImageResource(R.drawable.ic_filter_24dp); - binding.fabSearchResultActivity.setContentDescription(getString(R.string.content_description_filter_posts)); break; case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_TOP: binding.fabSearchResultActivity.setImageResource(R.drawable.ic_keyboard_double_arrow_up_24); - binding.fabSearchResultActivity.setContentDescription(getString(R.string.content_description_go_to_top)); break; default: if (accountName.equals(Account.ANONYMOUS_ACCOUNT)) { binding.fabSearchResultActivity.setImageResource(R.drawable.ic_filter_24dp); fabOption = SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_FILTER_POSTS; - binding.fabSearchResultActivity.setContentDescription(getString(R.string.content_description_filter_posts)); } else { binding.fabSearchResultActivity.setImageResource(R.drawable.ic_add_day_night_24dp); - binding.fabSearchResultActivity.setContentDescription(getString(R.string.content_description_submit_post)); } break; } + + setOtherActivitiesFabContentDescription(binding.fabSearchResultActivity, fabOption); + binding.fabSearchResultActivity.setOnClickListener(view -> { switch (fabOption) { case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_REFRESH: { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewMultiRedditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewMultiRedditDetailActivity.java index a71bf4da..47425b0a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewMultiRedditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewMultiRedditDetailActivity.java @@ -233,6 +233,9 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT navigationWrapper.option4BottomAppBar.setOnClickListener(view -> { bottomAppBarOptionAction(option2); }); + + navigationWrapper.setOtherActivitiesContentDescription(this, navigationWrapper.option2BottomAppBar, option1); + navigationWrapper.setOtherActivitiesContentDescription(this, navigationWrapper.option4BottomAppBar, option2); } else { navigationWrapper.navigationRailView.setOnItemSelectedListener(item -> { int itemId = item.getItemId(); @@ -270,6 +273,11 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT navigationWrapper.option4BottomAppBar.setOnClickListener(view -> { bottomAppBarOptionAction(option4); }); + + navigationWrapper.setOtherActivitiesContentDescription(this, navigationWrapper.option1BottomAppBar, option1); + navigationWrapper.setOtherActivitiesContentDescription(this, navigationWrapper.option2BottomAppBar, option2); + navigationWrapper.setOtherActivitiesContentDescription(this, navigationWrapper.option3BottomAppBar, option3); + navigationWrapper.setOtherActivitiesContentDescription(this, navigationWrapper.option4BottomAppBar, option4); } else { navigationWrapper.navigationRailView.setOnItemSelectedListener(item -> { int itemId = item.getItemId(); @@ -343,6 +351,9 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT } break; } + + setOtherActivitiesFabContentDescription(navigationWrapper.floatingActionButton, fabOption); + navigationWrapper.floatingActionButton.setOnClickListener(view -> { switch (fabOption) { case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_REFRESH: { 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 f750128a..f609dde2 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java @@ -749,6 +749,9 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp navigationWrapper.option4BottomAppBar.setOnClickListener(view -> { bottomAppBarOptionAction(option2); }); + + navigationWrapper.setOtherActivitiesContentDescription(this, navigationWrapper.option2BottomAppBar, option1); + navigationWrapper.setOtherActivitiesContentDescription(this, navigationWrapper.option4BottomAppBar, option2); } else { navigationWrapper.navigationRailView.setOnItemSelectedListener(item -> { int itemId = item.getItemId(); @@ -786,6 +789,11 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp navigationWrapper.option4BottomAppBar.setOnClickListener(view -> { bottomAppBarOptionAction(option4); }); + + navigationWrapper.setOtherActivitiesContentDescription(this, navigationWrapper.option1BottomAppBar, option1); + navigationWrapper.setOtherActivitiesContentDescription(this, navigationWrapper.option2BottomAppBar, option2); + navigationWrapper.setOtherActivitiesContentDescription(this, navigationWrapper.option3BottomAppBar, option3); + navigationWrapper.setOtherActivitiesContentDescription(this, navigationWrapper.option4BottomAppBar, option4); } else { navigationWrapper.navigationRailView.setOnItemSelectedListener(item -> { int itemId = item.getItemId(); @@ -859,6 +867,9 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp } break; } + + setOtherActivitiesFabContentDescription(navigationWrapper.floatingActionButton, fabOption); + navigationWrapper.floatingActionButton.setOnClickListener(view -> { switch (fabOption) { case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_REFRESH: { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java index 57d60542..e70bf372 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java @@ -699,6 +699,9 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele navigationWrapper.option4BottomAppBar.setOnClickListener(view -> { bottomAppBarOptionAction(option2); }); + + navigationWrapper.setOtherActivitiesContentDescription(this, navigationWrapper.option2BottomAppBar, option1); + navigationWrapper.setOtherActivitiesContentDescription(this, navigationWrapper.option4BottomAppBar, option2); } else { navigationWrapper.navigationRailView.setOnItemSelectedListener(item -> { int itemId = item.getItemId(); @@ -736,6 +739,11 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele navigationWrapper.option4BottomAppBar.setOnClickListener(view -> { bottomAppBarOptionAction(option4); }); + + navigationWrapper.setOtherActivitiesContentDescription(this, navigationWrapper.option1BottomAppBar, option1); + navigationWrapper.setOtherActivitiesContentDescription(this, navigationWrapper.option2BottomAppBar, option2); + navigationWrapper.setOtherActivitiesContentDescription(this, navigationWrapper.option3BottomAppBar, option3); + navigationWrapper.setOtherActivitiesContentDescription(this, navigationWrapper.option4BottomAppBar, option4); } else { navigationWrapper.navigationRailView.setOnItemSelectedListener(item -> { int itemId = item.getItemId(); @@ -809,6 +817,9 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele } break; } + + setOtherActivitiesFabContentDescription(navigationWrapper.floatingActionButton, fabOption); + navigationWrapper.floatingActionButton.setOnClickListener(view -> { switch (fabOption) { case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_REFRESH: { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/NavigationWrapper.java b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/NavigationWrapper.java index 1d702c19..7602ff0e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/NavigationWrapper.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/NavigationWrapper.java @@ -1,6 +1,7 @@ package ml.docilealligator.infinityforreddit.customviews; import android.annotation.SuppressLint; +import android.content.Context; import android.content.res.ColorStateList; import android.view.Menu; import android.view.MenuItem; @@ -16,6 +17,7 @@ import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.navigationrail.NavigationRailView; import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; public class NavigationWrapper { public BottomAppBar bottomAppBar; @@ -113,6 +115,71 @@ public class NavigationWrapper { } } + public void setOtherActivitiesContentDescription(Context context, View view, int option) { + switch (option) { + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_HOME: + view.setContentDescription(context.getString(R.string.content_description_home)); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SUBSCRIPTIONS: + view.setContentDescription(context.getString(R.string.content_description_subscriptions)); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_INBOX: + view.setContentDescription(context.getString(R.string.content_description_inbox)); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_PROFILE: + view.setContentDescription(context.getString(R.string.content_description_profile)); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_MULTIREDDITS: + view.setContentDescription(context.getString(R.string.content_description_multireddits)); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SUBMIT_POSTS: + view.setContentDescription(context.getString(R.string.content_description_submit_post)); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_REFRESH: + view.setContentDescription(context.getString(R.string.content_description_refresh)); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_CHANGE_SORT_TYPE: + view.setContentDescription(context.getString(R.string.content_description_change_sort_type)); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_CHANGE_POST_LAYOUT: + view.setContentDescription(context.getString(R.string.content_description_change_post_layout)); + break; + 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 : + view.setContentDescription(context.getString(R.string.content_description_go_to_subreddit)); + break; + 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 : + view.setContentDescription(context.getString(R.string.content_description_random)); + break; + 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 : + view.setContentDescription(context.getString(R.string.content_description_filter_posts)); + break; + 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 : + view.setContentDescription(context.getString(R.string.content_description_downvoted)); + break; + 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 : + view.setContentDescription(context.getString(R.string.content_description_saved)); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_TOP : + view.setContentDescription(context.getString(R.string.content_description_go_to_top)); + break; + } + } + public void showNavigation() { if (bottomAppBar != null) { bottomAppBar.performShow(); |