mirror of
https://github.com/Docile-Alligator/Infinity-For-Reddit.git
synced 2026-02-22 01:15:35 +00:00
Continue adding contentDescription for image views.
This commit is contained in:
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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: {
|
||||
|
||||
@ -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: {
|
||||
|
||||
@ -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: {
|
||||
|
||||
@ -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: {
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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>
|
||||
@ -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>
|
||||
@ -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>
|
||||
@ -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>
|
||||
|
||||
@ -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>
|
||||
@ -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>
|
||||
@ -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>
|
||||
@ -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>
|
||||
|
||||
@ -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>
|
||||
@ -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>
|
||||
|
||||
|
||||
@ -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>
|
||||
|
||||
|
||||
@ -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>
|
||||
@ -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>
|
||||
@ -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"
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -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>
|
||||
|
||||
|
||||
@ -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>
|
||||
|
||||
Reference in New Issue
Block a user