From 796f6eba831fec94bb86bca039a41948c285030f Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Tue, 10 Sep 2024 21:15:20 +0200 Subject: [PATCH] fix(android): fix Material3 BottomNavigation height --- .../tabgroup/TiUIBottomNavigationTabGroup.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/tabgroup/TiUIBottomNavigationTabGroup.java b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/tabgroup/TiUIBottomNavigationTabGroup.java index 1ead9f66615..773b6ea5cb7 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/tabgroup/TiUIBottomNavigationTabGroup.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/tabgroup/TiUIBottomNavigationTabGroup.java @@ -31,6 +31,7 @@ import com.google.android.material.shape.ShapeAppearanceModel; import org.appcelerator.kroll.common.Log; +import org.appcelerator.titanium.R; import org.appcelerator.titanium.TiBaseActivity; import org.appcelerator.titanium.TiC; import org.appcelerator.titanium.TiDimension; @@ -79,13 +80,18 @@ public void addTab(TabProxy tabProxy) } } + @SuppressLint("PrivateResource") @Override public void addViews(TiBaseActivity activity) { // Manually calculate the proper position of the BottomNavigationView. - int resourceID = activity.getResources().getIdentifier("design_bottom_navigation_height", "dimen", - activity.getPackageName()); - this.mBottomNavigationHeightValue = activity.getResources().getDimensionPixelSize(resourceID); + this.mBottomNavigationHeightValue + = activity.getResources().getDimensionPixelSize(R.dimen.design_bottom_navigation_height); + + if (activity.getTheme().toString().indexOf("Material3") > -1) { + this.mBottomNavigationHeightValue + = activity.getResources().getDimensionPixelSize(R.dimen.m3_bottom_nav_min_height); + } // Fetch padding properties. If at least 1 property is non-zero, then show a floating tab bar. final TiDimension paddingLeft = TiConvert.toTiDimension(