diff --git a/android/modules/ui/res/layout/titanium_ui_bottom_navigation.xml b/android/modules/ui/res/layout/titanium_ui_bottom_navigation.xml
new file mode 100644
index 00000000000..9a50ac07b42
--- /dev/null
+++ b/android/modules/ui/res/layout/titanium_ui_bottom_navigation.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/TabGroupProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/TabGroupProxy.java
index 0c76925eb2e..1dee4f9dbbc 100644
--- a/android/modules/ui/src/java/ti/modules/titanium/ui/TabGroupProxy.java
+++ b/android/modules/ui/src/java/ti/modules/titanium/ui/TabGroupProxy.java
@@ -39,6 +39,7 @@
import ti.modules.titanium.ui.android.AndroidModule;
import ti.modules.titanium.ui.widget.tabgroup.TiUIAbstractTabGroup;
+import ti.modules.titanium.ui.widget.tabgroup.TiUIBottomNavigation;
import ti.modules.titanium.ui.widget.tabgroup.TiUIBottomNavigationTabGroup;
import ti.modules.titanium.ui.widget.tabgroup.TiUITabLayoutTabGroup;
@@ -49,7 +50,8 @@
TiC.PROPERTY_SWIPEABLE,
TiC.PROPERTY_AUTO_TAB_TITLE,
TiC.PROPERTY_EXIT_ON_CLOSE,
- TiC.PROPERTY_SMOOTH_SCROLL_ON_TAB_CLICK
+ TiC.PROPERTY_SMOOTH_SCROLL_ON_TAB_CLICK,
+ TiC.PROPERTY_INDICATOR_COLOR
})
public class TabGroupProxy extends TiWindowProxy implements TiActivityWindow
{
@@ -323,6 +325,21 @@ protected void handleOpen(KrollDict options)
if (topActivity == null || topActivity.isFinishing()) {
return;
}
+
+ // set theme for XML layout
+ if (hasProperty(TiC.PROPERTY_STYLE)
+ && ((Integer) getProperty(TiC.PROPERTY_STYLE)) == AndroidModule.TABS_STYLE_BOTTOM_NAVIGATION
+ && getProperty(TiC.PROPERTY_THEME) != null) {
+ try {
+ String themeName = getProperty(TiC.PROPERTY_THEME).toString();
+ int theme = TiRHelper.getResource("style."
+ + themeName.replaceAll("[^A-Za-z0-9_]", "_"));
+ topActivity.setTheme(theme);
+ topActivity.getApplicationContext().setTheme(theme);
+ } catch (Exception e) {
+ }
+ }
+
Intent intent = new Intent(topActivity, TiActivity.class);
fillIntent(topActivity, intent);
@@ -367,7 +384,11 @@ public void windowCreated(TiBaseActivity activity, Bundle savedInstanceState)
((TiUITabLayoutTabGroup) view).setTabMode((Integer) getProperty(TiC.PROPERTY_TAB_MODE));
}
} else {
- view = new TiUIBottomNavigationTabGroup(this, activity);
+ if (TiConvert.toBoolean(getProperty("newLayout"), false)) {
+ view = new TiUIBottomNavigation(this, activity);
+ } else {
+ view = new TiUIBottomNavigationTabGroup(this, activity);
+ }
}
// If we have set a title before the creation of the native view, set it now.
if (this.tabGroupTitle != null) {
diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/tabgroup/TiUIAbstractTabGroup.java b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/tabgroup/TiUIAbstractTabGroup.java
index 57d27a4ebab..fb4afb02cb3 100644
--- a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/tabgroup/TiUIAbstractTabGroup.java
+++ b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/tabgroup/TiUIAbstractTabGroup.java
@@ -115,6 +115,13 @@ public abstract class TiUIAbstractTabGroup extends TiUIView
*/
public abstract void updateTabBackgroundDrawable(int index);
+ /**
+ * Material 3 active indicator color
+ *
+ * @param color color
+ */
+ public abstract void updateActiveIndicatorColor(int color);
+
/**
* Update the tab's title to the proper text.
*
@@ -454,7 +461,7 @@ public void onPageScrollStateChanged(int i)
// Set action bar color.
if (proxy != null) {
final ActionBar actionBar = ((AppCompatActivity) proxy.getActivity()).getSupportActionBar();
- if (actionBar != null) {
+ if (actionBar != null && !this.tabs.isEmpty()) {
final TiWindowProxy windowProxy = ((TabProxy) this.tabs.get(tabIndex).getProxy()).getWindow();
final KrollDict windowProperties = windowProxy.getProperties();
final KrollDict properties = getProxy().getProperties();
@@ -495,6 +502,9 @@ public void processProperties(KrollDict d)
} else {
setBackgroundColor(getDefaultBackgroundColor());
}
+ if (d.containsKeyAndNotNull(TiC.PROPERTY_INDICATOR_COLOR)) {
+ updateActiveIndicatorColor(TiConvert.toColor(d, TiC.PROPERTY_INDICATOR_COLOR, proxy.getActivity()));
+ }
super.processProperties(d);
}
@@ -516,6 +526,8 @@ public void propertyChanged(String key, Object oldValue, Object newValue, KrollP
for (TiUITab tabView : tabs) {
updateTabBackgroundDrawable(tabs.indexOf(tabView));
}
+ } else if (key.equals(TiC.PROPERTY_INDICATOR_COLOR)) {
+ updateActiveIndicatorColor(TiColorHelper.parseColor(newValue.toString(), proxy.getActivity()));
} else {
super.propertyChanged(key, oldValue, newValue, proxy);
}
@@ -550,7 +562,6 @@ public Drawable updateIconTint(TiViewProxy tabProxy, Drawable drawable, boolean
if (drawable == null) {
return null;
}
-
// Clone existing drawable so color filter applies correctly.
drawable = drawable.getConstantState().newDrawable();
diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/tabgroup/TiUIBottomNavigation.java b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/tabgroup/TiUIBottomNavigation.java
new file mode 100644
index 00000000000..9407681bfe0
--- /dev/null
+++ b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/tabgroup/TiUIBottomNavigation.java
@@ -0,0 +1,437 @@
+/**
+ * Titanium SDK
+ * Copyright TiDev, Inc. 04/07/2022-Present. All Rights Reserved.
+ * Licensed under the terms of the Apache Public License
+ * Please see the LICENSE included with this distribution for details.
+ */
+package ti.modules.titanium.ui.widget.tabgroup;
+
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.content.res.ColorStateList;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.RippleDrawable;
+import android.os.Build;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.Window;
+import android.widget.FrameLayout;
+import android.widget.RelativeLayout;
+
+import androidx.annotation.NonNull;
+import androidx.core.graphics.ColorUtils;
+
+import com.google.android.material.badge.BadgeDrawable;
+import com.google.android.material.bottomnavigation.BottomNavigationMenuView;
+import com.google.android.material.bottomnavigation.BottomNavigationView;
+import com.google.android.material.navigation.NavigationBarView;
+import com.google.android.material.shape.MaterialShapeDrawable;
+
+import org.appcelerator.titanium.TiApplication;
+import org.appcelerator.titanium.TiBaseActivity;
+import org.appcelerator.titanium.TiC;
+import org.appcelerator.titanium.proxy.TiViewProxy;
+import org.appcelerator.titanium.util.TiConvert;
+import org.appcelerator.titanium.util.TiRHelper;
+import org.appcelerator.titanium.util.TiUIHelper;
+import org.appcelerator.titanium.view.TiUIView;
+
+import java.util.ArrayList;
+
+import ti.modules.titanium.ui.TabGroupProxy;
+import ti.modules.titanium.ui.TabProxy;
+
+/**
+ * TabGroup implementation using BottomNavigationView as a controller.
+ */
+public class TiUIBottomNavigation extends TiUIAbstractTabGroup implements BottomNavigationView.OnItemSelectedListener
+{
+
+ static int id_layout = 0;
+ static int id_content = 0;
+ static int id_bottomNavigation = 0;
+ private int currentlySelectedIndex = -1;
+ private ArrayList