[TIMOB-14227] Android: Orientation mode not taken into account with TabGroup unless new window is opened
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Reopened |
Resolution | Unresolved |
Affected Version/s | Release 3.1.0, Release 3.2.0 |
Fix Version/s | n/a |
Components | Android |
Labels | reprod |
Reporter | Ketan Majmudar |
Assignee | Unknown |
Created | 2012-02-23T10:39:04.000+0000 |
Updated | 2018-12-12T15:31:25.000+0000 |
Description
*Problem*
Locking android window orientation should be straight forward as listed in the wiki, however there is strange buggy behaviour when using a tab group. The following test uses the default 2 tab app that every new mobile project creates, I've altered it so that tapping on the label on window 1 opens a brand new window on the same tab.
All the windows have been set to heavyweight and have their orientation set outside of the object creation to Ti.UI.PORTRAIT.
What is expected is that the windows are locked from the start, however what happens is that the device orientation changes cause all the UI to change, until you open a new window on the first tab, then and only then are all the window orientation modes set.
*Test case*
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
// create tab group
var tabGroup = Titanium.UI.createTabGroup();
//
// create base UI tab and root window
//
var win1 = Titanium.UI.createWindow({
title : 'Tab 1',
backgroundColor : '#fff',
fullscreen : false
});
win1.orientationModes = [Ti.UI.PORTRAIT];
var tab1 = Titanium.UI.createTab({
icon : 'KS_nav_views.png',
title : 'Tab 1',
window : win1
});
var label1 = Titanium.UI.createLabel({
color : '#999',
text : 'Tap to open new windoe',
font : {
fontSize : 20,
fontFamily : 'Helvetica Neue'
},
textAlign : 'center',
width : 'auto'
});
label1.addEventListener('click', function(e) {
var win3 = Titanium.UI.createWindow({
title : 'Win3',
backgroundColor : '#fff',
fullscreen : false
});
win3.orientationModes = [Ti.UI.PORTRAIT];
tabGroup.activeTab.open(win3);
});
win1.add(label1);
//
// create controls tab and root window
//
var win2 = Titanium.UI.createWindow({
title : 'Tab 2',
backgroundColor : '#fff',
fullscreen : false
});
win1.orientationModes = [Ti.UI.PORTRAIT];
var tab2 = Titanium.UI.createTab({
icon : 'KS_nav_ui.png',
title : 'Tab 2',
window : win2
});
var label2 = Titanium.UI.createLabel({
color : '#999',
text : 'I am Window 2',
font : {
fontSize : 20,
fontFamily : 'Helvetica Neue'
},
textAlign : 'center',
width : 'auto'
});
win2.add(label2);
//
// add tabs
//
tabGroup.addTab(tab1);
tabGroup.addTab(tab2);
// open tab group
tabGroup.open();
Please state the specific devices tested, or the emulator if you have tested that. Please state the runtime used. The test case can be minimized further. Personally, I'd take the comments out, and any superfluous objects.
This is fixed in 1.9 CI, you can get it on http://builds.appcelerator.com.s3.amazonaws.com/index.html in the master branch. Best, Mauro
That master branch only has 2.0.x releases, I can't find the 1.9 CI build anywhere - so i downloaded the latest build of the 2.0.x branch to test it, and this bug still exists in it. If you have a build you know has the fix in, could you point out a URL for it please, I can test it against my app.
Hello Ketan, if that's the case, please provide info about how to reproduce this, so far I'm unable to reproduce this issue with your testcase. Thanks, Mauro
Hi Mauro, Best way to reproduce this is to load the app above onto a device and launch it. Then don't tap anything, but rotate the device so the orientation changes, the whole UI will move according to the device orientation. Place the device back into Portrait orientation. now tap the label in the middle of the screen, push the device back button and now if you change the device orientation, the UI is fixed in PORTRAIT. The desired, expected behaviour is that the first window is fixed without having to launch a second window. I hope that helps reproduce the bug for you. Cheers, Ket
I tested using v8 on an HTC Wildfire S & Orange San Francisco (Blade) Devices. I have the test app above on a device and can record a video if it will make things clearer. Ta, Ket
Tested and confirmed on Samsung Galaxy S2 Android 2.3.6 with Ti SDK 3.1 GA and 3.2 CI.
I am able to reproduce this issue with the following environment; Pixel (7.1) Studio 4.9.0.201705302345 Ti SDK 6.1.1 GA Appc NPM 4.2.9 Appc CLI 6.2.2 Ti CLI 5.0.14 Alloy 1.9.11 Xcode 8.2 (8C38) Node v4.8.2 Java 1.8.0_131