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

feat(android): Animate parameter for disableTabNavigation #11681

Closed
wants to merge 12 commits into from

Conversation

m1ga
Copy link
Contributor

@m1ga m1ga commented May 3, 2020

JIRA: https://jira.appcelerator.org/browse/AC-6539

Optional Description:

BottomNavBar will animate when removing it:

$.tabgroup.disableTabNavigation(false, true);

ezgif-3-c99e7f591a6d

var win1 = Ti.UI.createWindow({backgroundColor: '#fff'});
win1.add(Ti.UI.createLabel({touchEnabled:false, text: 'Click to hide - animated'}));

var isOpen = true;

win1.addEventListener("click",function(){
	isOpen = !isOpen;
	tabGroup.disableTabNavigation(!isOpen, true); // animate navbar
})

var win2 = Ti.UI.createWindow({backgroundColor: '#fff'});
win2.add(Ti.UI.createLabel({touchEnabled:false,text: 'Click to hide'}));
win2.addEventListener("click",function(){
	isOpen = !isOpen;
	tabGroup.disableTabNavigation(!isOpen); // old behavior
})
var tab1 = Ti.UI.createTab({
    window: win1,
    title: 'Blue'
}),
tab2 = Ti.UI.createTab({
    window: win2,
    title: 'Red'
}),
tabGroup = Ti.UI.createTabGroup({
	style: Ti.UI.Android.TABS_STYLE_BOTTOM_NAVIGATION,
    tabs: [tab1, tab2]
});
tabGroup.open();

@build
Copy link
Contributor

build commented May 3, 2020

Fails
🚫

🔬 There are library changes, but no changes to the unit tests. That's OK as long as you're refactoring existing code, but will require an admin to merge this PR. Please see README.md#unit-tests for docs on unit testing.

Warnings
⚠️ This PR has milestone set to 9.3.0, but the version defined in package.json is 9.2.0 Please either: - Update the milestone on the PR - Update the version in package.json - Hold the PR to be merged later after a release and version bump on this branch
⚠️

Commit 1dc9c5297285f8cbcdccddf1f54856306262cff2 has a message "scrollDamping" giving 2 errors:

  • subject may not be empty
  • type may not be empty
⚠️

Commit 22a6f5bed8c0d76dddec5060512a16cead0e5554 has a message "animate bottomnavbar" giving 2 errors:

  • subject may not be empty
  • type may not be empty
⚠️

Commit 3b5974d25506f67efac1a421a8ce27a8ddf7eef9 has a message "remove wrong branch stuff" giving 2 errors:

  • subject may not be empty
  • type may not be empty
Messages
📖

💾 Here's the generated SDK zipfile.

📖 🎉 Another contribution from our awesome community member, m1ga! Thanks again for helping us make Titanium SDK better. 👍
📖

🚨 This PR has one or more commits with warnings/errors for commit messages not matching our configuration. You may want to squash merge this PR and edit the message to match our conventions, or ask the original developer to modify their history.

📖

✅ All tests are passing
Nice one! All 7375 tests are passing.
(There are 711 skipped tests not included in that total)

Generated by 🚫 dangerJS against 9985088

@jquick-axway
Copy link
Contributor

jquick-axway commented May 5, 2020

Oh this is an interesting idea. Kind of reminds me of our iOS-only hidesBarsOnSwipe and hidesSearchBarWhenScrolling features, but your solution gives the app dev more direct control of when to hide/show it.

Question:
Will the top or bottom tabs "fully" slide out of view when using a translucent status bar or navigation bar? I think it will, but would you mind testing it please?

Ti.UI.createWindow({
	backgroundColor: '#fff',
	extendSafeArea: true,
	theme: "Theme.AppCompat.NoTitleBar",
	windowFlags: Ti.UI.Android.FLAG_TRANSLUCENT_STATUS | Ti.UI.Android.FLAG_TRANSLUCENT_NAVIGATION,
});

@m1ga
Copy link
Contributor Author

m1ga commented May 5, 2020

Good catch!

var win1 = Ti.UI.createWindow({
	backgroundColor: '#fff',
});
win1.add(Ti.UI.createLabel({
	touchEnabled: false,
	text: 'Click to hide - animated'
}));

var isOpen = true;

win1.addEventListener("click", function() {
	isOpen = !isOpen;
	tabGroup.disableTabNavigation(!isOpen, true); // animate navbar
})

var win2 = Ti.UI.createWindow({
	backgroundColor: '#fff'
});
win2.add(Ti.UI.createLabel({
	touchEnabled: false,
	text: 'Click to hide'
}));
win2.addEventListener("click", function() {
	isOpen = !isOpen;
	tabGroup.disableTabNavigation(!isOpen); // old behavior
})
var tab1 = Ti.UI.createTab({
		window: win1,
		title: 'Blue'
	}),
	tab2 = Ti.UI.createTab({
		window: win2,
		title: 'Red'
	}),
	tabGroup = Ti.UI.createTabGroup({
		tabsBackgroundColor: "blue",
		extendSafeArea: true,
		theme: "Theme.AppCompat.NoTitleBar",
		windowFlags: Ti.UI.Android.FLAG_TRANSLUCENT_STATUS | Ti.UI.Android.FLAG_TRANSLUCENT_NAVIGATION,
		style: Ti.UI.Android.TABS_STYLE_BOTTOM_NAVIGATION,
		tabs: [tab1, tab2]
	});
tabGroup.open();

will only animate it behind the task switcher bar at the bottom:
Screenshot_20200505-081023
(blue should be gone). I'll check that

@jquick-axway
Copy link
Contributor

Right. This is an issue because mBottomNavigationHeightValue is the height of the bar from its "resource" file, but the actual height of the bar will be increased via fitSystemWindows() insets.

Now I'm actually wondering if there is a pre-existing issue with the ViewPager where it will be overlapped by the bottom tab bar when using a translucent nav bar. I'll have to test it out, but I'm thinking it will be an issue and we'll have to relayout the ViewPager dynamically since the insets can change dynamically. Especially when rotating between portrait/landscape.

@sgtcoolguy sgtcoolguy modified the milestones: 9.1.0, 9.3.0 Jul 31, 2020
@sgtcoolguy sgtcoolguy modified the milestones: 9.3.0, 10.0.0 Nov 20, 2020
@hansemannn hansemannn removed this from the 10.0.0 milestone Mar 21, 2022
@m1ga m1ga marked this pull request as draft July 2, 2022 10:24
@m1ga
Copy link
Contributor Author

m1ga commented Mar 12, 2023

closing in favor of #13770

@m1ga m1ga closed this Mar 12, 2023
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.

None yet

5 participants