Skip to content

Commit

Permalink
add content Description
Browse files Browse the repository at this point in the history
  • Loading branch information
dargoz committed Apr 27, 2020
1 parent 0c3a70f commit 90cd94f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,7 @@ ChangeList
- add small screen adjustment

- v 0.2.0
- adjust highlight dimen size
- adjust highlight dimen size

- v 0.3.0
- add content Description
4 changes: 2 additions & 2 deletions extendedbottomnavigationview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
defaultConfig {
minSdkVersion 19
targetSdkVersion 29
versionCode 15
versionName "0.2.0"
versionCode 16
versionName "0.3.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public void addSubMenu(int menuResId, int indexRootMenu, SubMenuOrientation orie
for (int index = 0; index < subMenu.size(); index++) {
Log.i(TAG, "index : " + index);
LinearLayout subMenuLayout = subMenuItemLayout.constructMenu(subMenu, index);

subMenuLayout.setContentDescription("BottomNav SubMenu - " + subMenu.getItem(index).getTitle());
if(subMenuType == -1 || subMenuType == 1) {
if(drawable == null) {
subMenuLayout.setBackgroundResource(subMenuBackground);
Expand Down Expand Up @@ -258,6 +258,7 @@ private void addMenuToContainer(final Menu menu) {

for (int itemIndex = 0; itemIndex < menu.size(); itemIndex++) {
LinearLayout menuItemContainer = menuItemLayout.constructMenu(menu, itemIndex);
menuItemContainer.setContentDescription("BottomNav Icon - " + menu.getItem(itemIndex).getTitle());
imageIconIds = ((BaseMenuLayout)menuItemLayout).getImageIconIds();
bottomNavBaseContainer.addView(menuItemContainer);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public void setOnMenuClickListener(MenuOnClickListener listener) {
public LinearLayout constructMenu(@NonNull final Menu menu, int itemIndex) {
TextView titleText = constructTitleTextView(menu.getItem(itemIndex).getTitle().toString());
ImageView imageView = constructIconImageView(menu.getItem(itemIndex).getIcon());
imageView.setContentDescription("BottomNav Icon - " + menu.getItem(itemIndex).getTitle().toString());
imageIconIds.append(itemIndex, imageView.getId());
return buildMenuItemLayout(menu, context, titleText, imageView, itemIndex);
}
Expand All @@ -58,6 +59,7 @@ protected TextView constructTitleTextView(String text) {
0, 0);
titleText.setLayoutParams(titleParams);
titleText.setText(text);
titleText.setContentDescription("BottomNav Icon - " + text);
titleText.setTextAlignment(TEXT_ALIGNMENT_CENTER);
titleText.setTextSize(TypedValue.DENSITY_DEFAULT, context.getResources().getDimensionPixelSize(R.dimen.font_size));
titleText.setTypeface(Typeface.DEFAULT_BOLD);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ protected TextView constructTitleTextView(String text) {
0, 0);
titleText.setLayoutParams(titleParams);
titleText.setText(text);
titleText.setContentDescription("BottomNav SubMenu - " + text);
titleText.setTextAlignment(View.TEXT_ALIGNMENT_TEXT_START);
titleText.setTextSize(TypedValue.DENSITY_DEFAULT, context.getResources().getDimensionPixelSize(R.dimen.font_size));
titleText.setTypeface(Typeface.DEFAULT_BOLD);
Expand Down

0 comments on commit 90cd94f

Please sign in to comment.