[TIMOB-8443] Android: setting orientationModes on a Ti.UI.TabGroup does not work
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Reopened |
Resolution | Unresolved |
Affected Version/s | Release 1.8.0.1 |
Fix Version/s | Sprint 2012-13 API, Release 3.0.0, Sprint 2012-19 API, 2012 Sprint 19 |
Components | Android |
Labels | api, module_tabgroup, parity, qe-testadded |
Reporter | Opie Cyrus |
Assignee | Hieu Pham |
Created | 2012-03-30T09:39:39.000+0000 |
Updated | 2018-09-28T15:06:27.000+0000 |
Description
Setting orientationModes on a tab group proxy seems to have no effect. This can be observed in the tab layout in KS by trying to force orientationModes.
A work around is to set the orientation in the tiapp.xml via:
" "
A fix should be investigated though to allow for setting the orientation modes in a programmatic way. In addition, it appears that setting the orientation modes for a window on a tab have no effect either.
TabGroup orientationMode example
1. Run the code bellow in an application. 2. Initially the orientations of the group should be locked in both left and right landscape. 3. Click the 'Toggle orientationModes' button. 4. You should now be able to orientate the group in all modes (ex: landscape, portrait). 5. Click the toggle button again. Should lock the group back into landscape only mode. 6. Repeat until you are satisfied.
var modes = [Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT];
var modesEnabled = true;
var tabGroup = Ti.UI.createTabGroup({
orientationModes: modes
});
var tabWindow = Ti.UI.createWindow();
tabGroup.addTab(Ti.UI.createTab({window: tabWindow, title: 'Lonely tab'}));
var toggleModesButton = Ti.UI.createButton({
title: 'Toggle orientationModes'
});
toggleModesButton.addEventListener('click', function() {
tabGroup.orientationModes = modesEnabled ? [ ] : modes;
modesEnabled = !modesEnabled;
});
tabWindow.add(toggleModesButton);
tabGroup.open();
On hold until we can have a parity discussion on supporting setting orientation modes per a tab.
This ticket will only focus on fixing orientation modes on the group. This will NOT fix setting orientation modes per a tab window. Another ticket should be opened to address that issue.
Created [PR #2543](https://github.com/appcelerator/titanium_mobile/pull/2543) to resolve issue.
Verified fix with: Titanium Studio, build: 2.1.1.201207271312 Titanium SDK: 2.2.0 HTC EVO 4.0.3
reopened to correct comment
Re-opening to edit label
Occurs on: Titanium SDK: 2.1.2.v20120816171609 Titanium Studio: 2.1.2.201208192014 Device: Samsung GALAXY Note (2.3.6) Fixed with: SDK version: 2.2.0
Re-opening due to regression seen in a newer PR: https://github.com/appcelerator/titanium_mobile/pull/2794#issuecomment-8430975 ...but not caused by that newer PR. Namely: If you set targetSdkVersion to 14 and run this fail case, app crashes right away with: https://gist.github.com/64ba7b65be6e668b4fb6 I'll put it in Sprint 19, but of course feel free to move it won't make it.
Tested with: SDK: 3.1.3.v20130916153052 Appcelertaor Studio: 3.1.3.201309132456 OS: OSX 10.8.4 Device: iPod touch2(iOS7) Xcode: 5.0 GM seed alloy@1.2.2-cr CLI version : 3.1.2 Clicking the 'toggle orientation mode' does not make the app support Portrait orientation mode.
Clicking the 'toggle orientation mode does not make the app stay on Portrait only mode then it can be changed to any any orientation.