titanium-sdk
titanium-sdk copied to clipboard
feat(android): Animate parameter for disableTabNavigation
JIRA: https://jira.appcelerator.org/browse/AC-6539
Optional Description:
BottomNavBar will animate when removing it:
$.tabgroup.disableTabNavigation(false, true);
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();
Fails | |
---|---|
:no_entry_sign: |
:microscope: 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 | |
---|---|
:warning: | 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 |
:warning: |
Commit 1dc9c5297285f8cbcdccddf1f54856306262cff2 has a message "scrollDamping" giving 2 errors:
|
:warning: |
Commit 22a6f5bed8c0d76dddec5060512a16cead0e5554 has a message "animate bottomnavbar" giving 2 errors:
|
:warning: |
Commit 3b5974d25506f67efac1a421a8ce27a8ddf7eef9 has a message "remove wrong branch stuff" giving 2 errors:
|
Messages | |
---|---|
:book: |
:floppy_disk: Here's the generated SDK zipfile. |
:book: | :tada: Another contribution from our awesome community member, m1ga! Thanks again for helping us make Titanium SDK better. :thumbsup: |
:book: |
:rotating_light: 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. |
:book: |
:white_check_mark: All tests are passing Nice one! All 7375 tests are passing. (There are 711 skipped tests not included in that total) |
Generated by :no_entry_sign: dangerJS against 998508807fa1b7e42706aa45373ac95e21e84a2a
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,
});
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:
(blue should be gone). I'll check that
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.
closing in favor of https://github.com/tidev/titanium_mobile/pull/13770