diff --git a/android/lib/src/main/java/com/ern/api/impl/navigation/ElectrodeNavigationFragmentDelegate.java b/android/lib/src/main/java/com/ern/api/impl/navigation/ElectrodeNavigationFragmentDelegate.java index 661dc2b3..2fd8fdda 100644 --- a/android/lib/src/main/java/com/ern/api/impl/navigation/ElectrodeNavigationFragmentDelegate.java +++ b/android/lib/src/main/java/com/ern/api/impl/navigation/ElectrodeNavigationFragmentDelegate.java @@ -2,6 +2,7 @@ import android.graphics.drawable.Drawable; import android.os.Bundle; +import android.text.TextUtils; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; @@ -384,7 +385,11 @@ private void updateNavBar(@NonNull NavigationBar navigationBar) { actionBar.setTitle(navigationBar.getTitle()); - updateHomeAsUpIndicator(navigationBar.getLeftButton(), actionBar); + NavigationBarLeftButton leftButton = navigationBar.getLeftButton(); + updateHomeAsUpIndicator(leftButton, actionBar); + if (actionBar.isShowing() && leftButton != null && !TextUtils.isEmpty(leftButton.getAdaLabel())) { + actionBar.setHomeActionContentDescription(leftButton.getAdaLabel()); + } if (mMenu != null && mFragment.getActivity() != null) { MenuUtil.updateMenuItems(mMenu, navigationBar, mNavBarButtonClickListener, mMenuItemDataProvider, mFragment.getActivity()); diff --git a/android/lib/src/main/java/com/ern/api/impl/navigation/MenuUtil.java b/android/lib/src/main/java/com/ern/api/impl/navigation/MenuUtil.java index 58fc3ae4..1fd4d355 100644 --- a/android/lib/src/main/java/com/ern/api/impl/navigation/MenuUtil.java +++ b/android/lib/src/main/java/com/ern/api/impl/navigation/MenuUtil.java @@ -21,8 +21,9 @@ import android.graphics.BitmapFactory; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; +import android.os.Build; import android.os.StrictMode; -import android.util.Patterns; +import android.text.TextUtils; import android.view.Menu; import android.view.MenuItem; import android.webkit.URLUtil; @@ -31,6 +32,7 @@ import androidx.annotation.IdRes; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.core.view.MenuItemCompat; import com.ernnavigationApi.ern.model.NavigationBar; import com.ernnavigationApi.ern.model.NavigationBarButton; @@ -113,6 +115,14 @@ private static MenuItem addButtonAsMenuItem(@NonNull NavigationBarButton button, registerItemClickListener(menuItem, button, navBarButtonClickListener); } + if (!TextUtils.isEmpty(button.getAdaLabel())) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + menuItem.setContentDescription(button.getAdaLabel()); + } else { + MenuItemCompat.setContentDescription(menuItem, button.getAdaLabel()); + } + } + return menuItem; }