Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: new control Ti.UI.BottomNavigation #14126

Draft
wants to merge 20 commits into
base: master
Choose a base branch
from
Draft

Conversation

m1ga
Copy link
Contributor

@m1ga m1ga commented Sep 29, 2024

Work in progress

var win1 = Ti.UI.createWindow({backgroundColor:"red"});
var win2 = Ti.UI.createWindow({backgroundColor:"red"});
var tab1 = Ti.UI.createTab({ window: win1, title: 'Blue', icon: '/images/icon.png'});
var tab2 = Ti.UI.createTab({window: win2,	title: 'Red',	icon: '/images/starmask.png'});

var lbl1 = Ti.UI.createLabel({text:"Text 1", color: "#fff", bottom: 0});
var lbl2 = Ti.UI.createLabel({text:"Text 2", color: "#fff", bottom: 0});
win1.add(lbl1);
win2.add(lbl2);
win1.addEventListener("click", function(){
	tab1.badge = 20;
});

var bottomNav = Ti.UI.createTabGroup({
	tabs: [tab1, tab2],
	theme: "Theme.Titanium.Material3.DayNight",
	newLayout:true,
	style: Ti.UI.Android.TABS_STYLE_BOTTOM_NAVIGATION
});
bottomNav.open();

Just a test for now.

Currently working:

  • opening and adding menu / content
  • badge
  • automatic menu height (improvement over the current implementation)
  • new property: indicatorColor that allows you to set the color of the M3 ItemActiveIndicatorColor
Bildschirmaufnahme_20241002_231752.webm

Current issues:

  • when running LiveView and changing the theme M2 -> M3 -> M2 it will still show the M3 theme. Not sure why. Without liveview it works fine
  • not all features of the old tabgroup are included

@hansemannn
Copy link
Collaborator

Can't you replace the old tab group API with the newer API internally? I do not see iOS implementing the same API as it already has, as it's the same. Ideally, this change would only swap the internal UI behind Ti.UI.TabGroup while retaining the API structure. Legacy things like the style property can be dropped and edge cases like changing themes at runtime as well.

@m1ga
Copy link
Contributor Author

m1ga commented Oct 2, 2024

Pushed my current WIP where I use the old structure and you can use newLayout:true:

var bottomNav = Ti.UI.createTabGroup({
	tabs: [tab1, tab2],
	newLayout:true, // <- new
	style: Ti.UI.Android.TABS_STYLE_BOTTOM_NAVIGATION
});

to use the new XML layout.

I'm working on it at the moment 😄

@m1ga
Copy link
Contributor Author

m1ga commented Oct 5, 2024

Test a different app today and added more parts:
Screenshot_20241005-174416
icon setter, shiftMode

@m1ga
Copy link
Contributor Author

m1ga commented Oct 15, 2024

icon can now use Ti.App.Android.drawable.something and that can load animated icons too:

Bildschirmaufnahme_20241015_192941.mp4

(demo icon from https://shapeshifter.design/ )

@m1ga
Copy link
Contributor Author

m1ga commented Oct 17, 2024

Floating version is back:
Screenshot_20241017-131630

@m1ga
Copy link
Contributor Author

m1ga commented Oct 19, 2024

New property iconFont so you can use icons from a font right away:

'#tabHome': {
	icon: "\ueac1",
	iconFamily: "tabler-icons"
}

Screenshot_20241019-234001

and with tintColor/activteTintColor support

Screenshot_20241019-235342

@m1ga
Copy link
Contributor Author

m1ga commented Oct 20, 2024

Some updates:

  • statusBarColor is available in the TabGroup too (like in the Window)
  • you can use flags: Ti.Android.STATUS_BAR_LIGHT to set the Statusbar into light mode (dark text)
  • fixed Tab backgroundColor
  • some other bugfixes

simple test:
Screenshot_20241020-220819
phone is in dark mode, all colors are set in the TSS file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants