diff options
Diffstat (limited to 'app')
24 files changed, 279 insertions, 36 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(); diff --git a/app/src/main/res/layout-land/activity_view_multi_reddit_detail.xml b/app/src/main/res/layout-land/activity_view_multi_reddit_detail.xml index 42a34b16..910576bf 100644 --- a/app/src/main/res/layout-land/activity_view_multi_reddit_detail.xml +++ b/app/src/main/res/layout-land/activity_view_multi_reddit_detail.xml @@ -64,6 +64,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="@dimen/fab_margin" - android:visibility="gone" /> + android:visibility="gone" + android:contentDescription="@null" /> </androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout-land/activity_view_subreddit_detail.xml b/app/src/main/res/layout-land/activity_view_subreddit_detail.xml index 1dee78ae..b265259b 100644 --- a/app/src/main/res/layout-land/activity_view_subreddit_detail.xml +++ b/app/src/main/res/layout-land/activity_view_subreddit_detail.xml @@ -199,6 +199,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="@dimen/fab_margin" - android:visibility="gone" /> + android:visibility="gone" + android:contentDescription="@null" /> </androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout-land/activity_view_user_detail.xml b/app/src/main/res/layout-land/activity_view_user_detail.xml index cc675f55..33b8b296 100644 --- a/app/src/main/res/layout-land/activity_view_user_detail.xml +++ b/app/src/main/res/layout-land/activity_view_user_detail.xml @@ -165,6 +165,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="@dimen/fab_margin" - android:visibility="gone" /> + android:visibility="gone" + android:contentDescription="@null" /> </androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout-land/app_bar_main.xml b/app/src/main/res/layout-land/app_bar_main.xml index 258441d8..c3a006d9 100644 --- a/app/src/main/res/layout-land/app_bar_main.xml +++ b/app/src/main/res/layout-land/app_bar_main.xml @@ -71,6 +71,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="@dimen/fab_margin" - android:visibility="gone" /> + android:visibility="gone" + android:contentDescription="@null" /> </androidx.coordinatorlayout.widget.CoordinatorLayout> diff --git a/app/src/main/res/layout-sw600dp/activity_view_multi_reddit_detail.xml b/app/src/main/res/layout-sw600dp/activity_view_multi_reddit_detail.xml index 42a34b16..910576bf 100644 --- a/app/src/main/res/layout-sw600dp/activity_view_multi_reddit_detail.xml +++ b/app/src/main/res/layout-sw600dp/activity_view_multi_reddit_detail.xml @@ -64,6 +64,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="@dimen/fab_margin" - android:visibility="gone" /> + android:visibility="gone" + android:contentDescription="@null" /> </androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout-sw600dp/activity_view_subreddit_detail.xml b/app/src/main/res/layout-sw600dp/activity_view_subreddit_detail.xml index 1dee78ae..b265259b 100644 --- a/app/src/main/res/layout-sw600dp/activity_view_subreddit_detail.xml +++ b/app/src/main/res/layout-sw600dp/activity_view_subreddit_detail.xml @@ -199,6 +199,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="@dimen/fab_margin" - android:visibility="gone" /> + android:visibility="gone" + android:contentDescription="@null" /> </androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout-sw600dp/activity_view_user_detail.xml b/app/src/main/res/layout-sw600dp/activity_view_user_detail.xml index cce4d78f..20b5e900 100644 --- a/app/src/main/res/layout-sw600dp/activity_view_user_detail.xml +++ b/app/src/main/res/layout-sw600dp/activity_view_user_detail.xml @@ -166,6 +166,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="@dimen/fab_margin" - android:visibility="gone" /> + android:visibility="gone" + android:contentDescription="@null" /> </androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout-sw600dp/app_bar_main.xml b/app/src/main/res/layout-sw600dp/app_bar_main.xml index 8ec561b0..a2bfa5bc 100644 --- a/app/src/main/res/layout-sw600dp/app_bar_main.xml +++ b/app/src/main/res/layout-sw600dp/app_bar_main.xml @@ -71,6 +71,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="@dimen/fab_margin" - android:visibility="gone" /> + android:visibility="gone" + android:contentDescription="@null" /> </androidx.coordinatorlayout.widget.CoordinatorLayout> diff --git a/app/src/main/res/layout/activity_view_multi_reddit_detail.xml b/app/src/main/res/layout/activity_view_multi_reddit_detail.xml index 57966184..8fddd8c0 100644 --- a/app/src/main/res/layout/activity_view_multi_reddit_detail.xml +++ b/app/src/main/res/layout/activity_view_multi_reddit_detail.xml @@ -49,6 +49,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="@dimen/fab_margin" - app:layout_anchor="@id/bottom_app_bar_bottom_app_bar" /> + app:layout_anchor="@id/bottom_app_bar_bottom_app_bar" + android:contentDescription="@null" /> </androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/activity_view_post_detail.xml b/app/src/main/res/layout/activity_view_post_detail.xml index d16d83b3..d52479e6 100644 --- a/app/src/main/res/layout/activity_view_post_detail.xml +++ b/app/src/main/res/layout/activity_view_post_detail.xml @@ -93,7 +93,8 @@ android:src="@drawable/ic_arrow_upward_black_24dp" android:background="?actionBarItemBackground" android:clickable="true" - android:focusable="true" /> + android:focusable="true" + android:contentDescription="@string/content_description_previous_result" /> <ImageView android:id="@+id/next_result_image_view_view_post_detail_activity" @@ -104,7 +105,8 @@ android:src="@drawable/ic_arrow_downward_black_24dp" android:background="?actionBarItemBackground" android:clickable="true" - android:focusable="true" /> + android:focusable="true" + android:contentDescription="@string/content_description_next_result" /> <ImageView android:id="@+id/close_search_panel_image_view_view_post_detail_activity" @@ -115,7 +117,8 @@ android:src="@drawable/ic_close_24dp" android:background="?actionBarItemBackground" android:clickable="true" - android:focusable="true" /> + android:focusable="true" + android:contentDescription="@string/content_description_close_search_panel" /> </LinearLayout> diff --git a/app/src/main/res/layout/activity_view_private_messages.xml b/app/src/main/res/layout/activity_view_private_messages.xml index bbffb234..e61995b7 100644 --- a/app/src/main/res/layout/activity_view_private_messages.xml +++ b/app/src/main/res/layout/activity_view_private_messages.xml @@ -75,7 +75,8 @@ android:clickable="true" android:focusable="true" android:scaleType="center" - android:src="@drawable/ic_send_black_24dp" /> + android:src="@drawable/ic_send_black_24dp" + android:contentDescription="@string/content_description_send_message" /> </LinearLayout> diff --git a/app/src/main/res/layout/activity_view_subreddit_detail.xml b/app/src/main/res/layout/activity_view_subreddit_detail.xml index f8c13dde..14392bc9 100644 --- a/app/src/main/res/layout/activity_view_subreddit_detail.xml +++ b/app/src/main/res/layout/activity_view_subreddit_detail.xml @@ -184,6 +184,7 @@ android:layout_height="wrap_content" android:layout_margin="@dimen/fab_margin" android:visibility="gone" - app:layout_anchor="@id/bottom_app_bar_bottom_app_bar" /> + app:layout_anchor="@id/bottom_app_bar_bottom_app_bar" + android:contentDescription="@null" /> </androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/activity_view_user_detail.xml b/app/src/main/res/layout/activity_view_user_detail.xml index dd0bf212..4bea527a 100644 --- a/app/src/main/res/layout/activity_view_user_detail.xml +++ b/app/src/main/res/layout/activity_view_user_detail.xml @@ -150,6 +150,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="@dimen/fab_margin" - app:layout_anchor="@id/bottom_app_bar_bottom_app_bar" /> + app:layout_anchor="@id/bottom_app_bar_bottom_app_bar" + android:contentDescription="@null" /> </androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/activity_wiki.xml b/app/src/main/res/layout/activity_wiki.xml index 6c47ba76..8fde4586 100644 --- a/app/src/main/res/layout/activity_wiki.xml +++ b/app/src/main/res/layout/activity_wiki.xml @@ -61,7 +61,8 @@ <ImageView android:id="@+id/fetch_wiki_image_view_wiki_activity" android:layout_width="150dp" - android:layout_height="wrap_content" /> + android:layout_height="wrap_content" + android:contentDescription="@null" /> <TextView android:id="@+id/fetch_wiki_text_view_wiki_activity" diff --git a/app/src/main/res/layout/app_bar_main.xml b/app/src/main/res/layout/app_bar_main.xml index fe3656be..c4f7a91b 100644 --- a/app/src/main/res/layout/app_bar_main.xml +++ b/app/src/main/res/layout/app_bar_main.xml @@ -63,6 +63,7 @@ android:layout_height="wrap_content" android:layout_margin="@dimen/fab_margin" android:visibility="gone" + android:contentDescription="@null" app:layout_anchor="@id/bottom_app_bar_bottom_app_bar" /> </androidx.coordinatorlayout.widget.CoordinatorLayout> diff --git a/app/src/main/res/layout/bottom_app_bar.xml b/app/src/main/res/layout/bottom_app_bar.xml index 1bc806c9..2494c74b 100644 --- a/app/src/main/res/layout/bottom_app_bar.xml +++ b/app/src/main/res/layout/bottom_app_bar.xml @@ -23,7 +23,8 @@ android:gravity="center" android:paddingTop="8dp" android:paddingBottom="8dp" - android:background="?attr/selectableItemBackgroundBorderless" /> + android:background="?attr/selectableItemBackgroundBorderless" + android:contentDescription="@null" /> <ImageView android:id="@+id/option_2_bottom_app_bar" @@ -33,7 +34,8 @@ android:gravity="center" android:paddingTop="8dp" android:paddingBottom="8dp" - android:background="?attr/selectableItemBackgroundBorderless" /> + android:background="?attr/selectableItemBackgroundBorderless" + android:contentDescription="@null" /> <TextView android:layout_width="0dp" @@ -49,7 +51,8 @@ android:gravity="center" android:paddingTop="8dp" android:paddingBottom="8dp" - android:background="?attr/selectableItemBackgroundBorderless" /> + android:background="?attr/selectableItemBackgroundBorderless" + android:contentDescription="@null" /> <ImageView android:id="@+id/option_4_bottom_app_bar" @@ -59,7 +62,8 @@ android:paddingTop="8dp" android:paddingBottom="8dp" android:gravity="center" - android:background="?attr/selectableItemBackgroundBorderless" /> + android:background="?attr/selectableItemBackgroundBorderless" + android:contentDescription="@null" /> </LinearLayout> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2e7e9995..9b8a026a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1473,7 +1473,18 @@ <string name="content_description_download">Download</string> <string name="content_description_share">Share</string> <string name="content_description_set_as_wallpaper">Set as wallpaper</string> - - + <string name="content_description_previous_result">Go to previous result</string> + <string name="content_description_next_result">Go to next result</string> + <string name="content_description_close_search_panel">Close search panel</string> + <string name="content_description_send_message">Send message</string> + <string name="content_description_home">Home</string> + <string name="content_description_subscriptions">Subscriptions</string> + <string name="content_description_inbox">Inbox</string> + <string name="content_description_profile">Profile</string> + <string name="content_description_multireddits">Multireddits</string> + <string name="content_description_upvoted">Upvoted</string> + <string name="content_description_downvoted">Downvoted</string> + <string name="content_description_hidden">Hidden</string> + <string name="content_description_saved">Saved</string> </resources> |