{ "id": "90782", "key": "TIMOB-8868", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "5", "description": "All attempts at reproducing this issue failed, or not enough information was available to reproduce the issue. Reading the code produces no clues as to why this behavior would occur. If more information appears later, please reopen the issue.", "name": "Cannot Reproduce" }, "resolutiondate": "2012-06-13T14:28:28.000+0000", "created": "2012-04-23T17:26:31.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "Regression", "SupportTeam", "core" ], "versions": [ { "id": "12593", "name": "Release 2.0.0", "archived": false, "released": true, "releaseDate": "2012-03-30" } ], "issuelinks": [ { "id": "17209", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "89278", "key": "TIDOC-525", "fields": { "summary": "Document to explain the locking of orientation on Android", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "17210", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "91595", "key": "TIMOB-9057", "fields": { "summary": "Android: Bad performance when forcing the rotation of the screen ", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2017-03-27T18:24:14.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "*Code*\r\n{code} \r\nTitanium.UI.setBackgroundColor('white');\r\n\r\nvar openWinInLandscape = function() \r\n{\r\n\tvar win = Titanium.UI.createWindow({ \r\n\t backgroundColor:'yellow',\r\n\t orientationModes: [Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT] // works fine\r\n\t});\r\n\t\r\n\t/*win.addEventListener('close', function(e) \r\n\t{\r\n\t\tTi.App.fireEvent('setOrientationMode');\r\n\t});*/\r\n\t\r\n\treturn win;\r\n}\r\n\r\nvar tabGroup = Titanium.UI.createTabGroup();\r\n\r\nvar win1 = Titanium.UI.createWindow({ \r\n title:'Tab 1',\r\n backgroundColor:'#fff',\r\n fullscreen: false,\r\n orientationModes: [Ti.UI.PORTRAIT, Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT] // doesn't work\r\n});\r\n\r\nvar tab1 = Titanium.UI.createTab({ \r\n icon:'KS_nav_views.png',\r\n title:'Tab 1',\r\n window:win1\r\n});\r\n\r\nvar button = Ti.UI.createButton({\r\n\ttitle: 'Press me!',\r\n\twidth: 300,\r\n\theight: 40\r\n});\r\nbutton.addEventListener('click', function(e)\r\n{\r\n\tvar newWin = openWinInLandscape();\r\n\ttab1.open(newWin);\r\n});\r\n\r\n/*Ti.App.addEventListener('setOrientationMode', function(e) {\r\n\tTi.API.info('Global event fired: orientation activated');\r\n\twin1.orientationModes = [Ti.UI.PORTRAIT, Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT]; // doesn't work\r\n});*/\r\n\r\nwin1.add(button);\r\ntabGroup.addTab(tab1); \r\ntabGroup.open();\r\n\r\n{code}\r\n\r\n*Issue*\r\nThe code above has two separate ways ways to change the orientation of the window. They both dont seem to work, try it the way it currently is, then also try running the code by uncommenting the two other sections.\r\n\r\n*Expected behavior*\r\nNo matter which way you decide to use, it should change the orientation of the window. \r\n\r\n*Actual behavior - 1*\r\nIf you run the above code the way it is right now, the app doesn't change orientation. When you press the button, it will force open a new window in landscape mode (which works fine). Then when you press the back button, it should reset and be back its orientation, but it doesn't. It will still be stuck in landscape mode.\r\n\r\n*Actual behavior - 2*\r\nNow if you uncomment the two sections in the code, you will see that the same problem still exists. It does fire the global event (output can be seen in DDMS), however the changes are not reflected by the window.\r\n\r\n*Workaround*\r\n{code}\r\nTitanium.UI.setBackgroundColor('white');\r\n\r\nvar openWinInLandscape = function() \r\n{\r\n\tvar win = Titanium.UI.createWindow({ \r\n\t backgroundColor:'yellow',\r\n\t orientationModes: [Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT] // works fine\r\n\t});\r\n\t\r\n\treturn win;\r\n}\r\n\r\nvar tabGroup = Titanium.UI.createTabGroup();\r\n\r\nvar win1 = Titanium.UI.createWindow({ \r\n title:'Tab 1',\r\n backgroundColor:'#fff',\r\n fullscreen: false\r\n});\r\n\r\nwin1.addEventListener('click', function(e)\r\n{\r\n\tTi.API.info('Orientation activated');\r\n\twin1.orientationModes = [Ti.UI.PORTRAIT, Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT]; // workaround\r\n});\r\n\r\nvar tab1 = Titanium.UI.createTab({ \r\n icon:'KS_nav_views.png',\r\n title:'Tab 1',\r\n window:win1\r\n});\r\n\r\nvar button = Ti.UI.createButton({\r\n\ttitle: 'Press me!',\r\n\twidth: 300,\r\n\theight: 40\r\n});\r\nbutton.addEventListener('click', function(e)\r\n{\r\n\tvar newWin = openWinInLandscape();\r\n\ttab1.open(newWin);\r\n});\r\n\r\nwin1.add(button);\r\ntabGroup.addTab(tab1); \r\ntabGroup.open();\r\n{code}\r\n\r\nThe above code is a workaround of how it is supposed to work. You first have to tap anywhere on the white window, in order for it to execute the code. Once that is done, you can see that whenever you open the new yellow window, it's forced in landscape mode. If you now press the back button, you will see that the orientation is reset and assigned to the correct window object. It works just as expected and the white window changes orientations correctly!\r\n\r\n*Issue A in the workaround*\r\nIf you change the event listener from 'click' to 'open', you will see that the first time the app is run, the window behaves correctly. Then when you open the yellow window and press the back button, you will see that the orientation has been locked into landscape mode and doesn't work as expected.\r\n\r\n*Issue B in the workaround*\r\nIf you change the event listener from 'click' to 'focus', you will see the same behavior as in Issue A, with the exception that it doesn't seem to fire the focus event when you press the back button on the yellow window.\r\n\r\n*Notes*\r\n-Only tested on a HTC Sensation 4G.\r\n-Some of these issues don't seem to exist prior 2.0 SDK.", "attachment": [], "flagged": false, "summary": "Android: Ti.UI.Window issue with orientation modes in latest SDK", "creator": { "name": "jyounus", "key": "jyounus", "displayName": "Junaid Younus", "active": true, "timeZone": "Europe/London" }, "subtasks": [], "reporter": { "name": "jyounus", "key": "jyounus", "displayName": "Junaid Younus", "active": true, "timeZone": "Europe/London" }, "environment": "TiStudio: 2.0.1.201204132053\r\nTiSDK: 2.0.1GA2\r\nRuntime engine: V8\r\nDevice: HTC Sensation 4G", "comment": { "comments": [ { "id": "198376", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "I believe this was fixed recently via other work. Tested successfully on HTC Desire (2.2), Droid 2 (2.3), G-Slate (3.1). I believe the Sensation 4G is 2.3. Was indeed able to reproduce the fail case with the older version of our SDK from April, but not with current Titanium SDK 2.1.0.", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2012-06-13T14:28:07.000+0000", "updated": "2012-06-13T14:28:07.000+0000" }, { "id": "415899", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as I am unable to reproduce this issue with the following environment;\r\nPixel (7.1)\r\nMacOS 10.11.6 (15G31)\r\nStudio 4.8.1.201612050850\r\nTi SDK 6.0.3 GA\r\nAppc NPM 4.2.8\r\nAppc CLI 6.1.0\r\nTi CLI 5.0.11\r\nAlloy 1.9.5\r\nArrow 1.10.1\r\nXcode 8.2 (8C38)\r\nNode v4.6.0\r\nJava 1.7.0_80", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-27T18:24:14.000+0000", "updated": "2017-03-27T18:24:14.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }