{ "id": "102215", "key": "TIMOB-11169", "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": [ { "id": "14157", "description": "Sprint 2012-20 API", "name": "Sprint 2012-20 API", "archived": true, "released": true, "releaseDate": "2012-10-08" }, { "id": "14272", "description": "2012 Sprint 20", "name": "2012 Sprint 20", "archived": true, "released": true, "releaseDate": "2012-10-08" } ], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2012-10-02T00:35:03.000+0000", "created": "2012-09-26T18:15:04.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "core" ], "versions": [ { "id": "14096", "description": "Release 2.1.2", "name": "Release 2.1.2", "archived": true, "released": true, "releaseDate": "2012-08-31" } ], "issuelinks": [], "assignee": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2013-03-13T18:55:34.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "h3. Description:\r\nA window inside a tab group is present. On swiping to the right or left, this window needs to be replaced with another one. The way this is supposed to be accomplished, is by opening a new window in the same tab stack and close the current window at the same time. Because it cannot happen at the same exact time, the next window is said to open before the current window closes.\r\n\r\nh3. The problem:\r\nTo make this happen smoothly, the animation of the window open or close is removed by: tab.open( win, { animated: false });\r\nBut, if the current window is closed _after_ the next window opens, then nothing happens. If the current window is closed _before_ the it works, but there is a small flicker.\r\nNote: The current window will close and the next will open with the sample test case, but if the current window is the root window, it will not close. It looks like the root window cannot be closed.\r\n\r\nh3. The code\r\n{code}\r\n// Global Object\r\nvar App = {};\r\nfunction log(a) {\r\n\tTi.API.info(a);\r\n}\r\n\r\n/**\r\n * Creates a new window with a colored box\r\n * @param {String} color\r\n * @return Ti.UI.Window\r\n */\r\nfunction Window(color) {\r\n\tlog('Window created: '+color);\r\n\tvar win = Ti.UI.createWindow({\r\n\t\tfullscreen: false,\r\n\t\tbackButtonTitle: '' // for our workaround, remove the back button\r\n\t});\r\n\t\r\n\tvar box = Ti.UI.createView({\r\n\t\twidth: '300dp',\r\n\t\theight: '300dp',\r\n\t\tbackgroundColor: color\r\n\t});\r\n\t\r\n\twin.addEventListener('swipe', function(e){\r\n\t\tlog('swipe');\r\n\t\tif(e.direction == 'left') {\r\n\t\t\tlog('left');\r\n\r\n\t\t\t// work around:\r\n\t\t\t// close the window in the tab with no animation before opening the next\r\n\t\t\t// side effect, root window cannot be closed \r\n\t\t\tApp.Tab.close(win, {animated: false});\r\n\t\t\tlog('add to tab');\r\n\r\n\t\t\tApp.Tab.open(Window('green'), {animated: false});\r\n\r\n\t\t\t// old code\r\n\t\t\t// uncomment to see the bug\r\n\t\t\t// win.close();\r\n\r\n\t\t} else {\r\n\t\t\tlog('right');\r\n\t\t\t\r\n\t\t\t// work around:\r\n\t\t\t// close the window in the tab with no animation before opening the next\r\n\t\t\t// side effect, root window cannot be closed \r\n\t\t\tApp.Tab.close(win, {animated: false});\r\n\t\t\tlog('add to tab');\r\n\r\n\t\t\tApp.Tab.open(Window('red'), {animated: false});\r\n\r\n\t\t\t// old code\r\n\t\t\t// uncomment to see the bug\r\n\t\t\t// win.close();\r\n\t\t}\r\n\t});\r\n\twin.add(box);\r\n\treturn win;\r\n}\r\n\r\n/**\r\n * Starts the app!\r\n */\r\n(function(){\r\n\tApp.TabGroup = Ti.UI.createTabGroup();\r\n\tApp.Tab = Ti.UI.createTab({\r\n\t\twindow: Window('blue')\r\n\t})\r\n\tApp.TabGroup.addTab(App.Tab);\r\n\tApp.TabGroup.open();\r\n})();\r\n{code}", "attachment": [], "flagged": false, "summary": "iOS: Opening window in tab with animated false, stops closing the previous window ", "creator": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "environment": "Ti SDK 2.1.2.GA", "comment": { "comments": [ { "id": "221697", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Can not close the root window of a tab.\r\nObviously the developer is trying to open windows in a tab but does not want the \r\nnav controller functionality.\r\n\r\nCan be done by creating a dummy window as root window of tab and then just opening and closing regular windows ( Ideally you should just be swapping out views instead of windows. So replace win.open() with win.add() )\r\n\r\nUse this code to accomplish the same\r\n{code}\r\n// Global Object\r\nvar App = {};\r\nfunction log(a) {\r\n    Ti.API.info(a);\r\n}\r\n \r\n/**\r\n * Creates a new window with a colored box\r\n * @param {String} color\r\n * @return Ti.UI.Window\r\n */\r\nfunction Window(color) {\r\n    log('Window created: '+color);\r\n    var win = Ti.UI.createWindow({\r\n        fullscreen: false,\r\n    });\r\n     \r\n    var box = Ti.UI.createView({\r\n        width: '300dp',\r\n        height: '300dp',\r\n        backgroundColor: color\r\n    });\r\n    \r\n    win.addEventListener('swipe', function(e){\r\n        log('swipe');\r\n        if(e.direction == 'left') {\r\n            log('left');\r\n \r\n            // work around:\r\n            // close the window in the tab with no animation before opening the next\r\n            // side effect, root window cannot be closed \r\n            //App.Tab.close(win, {animated: false});\r\n            log('add to tab');\r\n \r\n\t\t\tvar newWin = Window('green');\r\n            newWin.open();\r\n\t\t\tApp.Tab.currentWin.close();\r\n\t\t\tApp.Tab.currentWin = newWin;\r\n \r\n        } else {\r\n            log('right');\r\n             \r\n            // work around:\r\n            // close the window in the tab with no animation before opening the next\r\n            // side effect, root window cannot be closed \r\n            //App.Tab.close(win, {animated: false});\r\n            log('add to tab');\r\n \t\t\t\r\n\t\t\tvar newWin = Window('red');\r\n            newWin.open();\r\n\t\t\tApp.Tab.currentWin.close();\r\n\t\t\tApp.Tab.currentWin = newWin;\r\n        }\r\n    });\r\n\t\r\n    win.add(box);\r\n    return win;\r\n}\r\n \r\n/**\r\n * Starts the app!\r\n */\r\n(function(){\r\n    App.TabGroup = Ti.UI.createTabGroup();\r\n\tApp.baseWin = Ti.UI.createWindow();\r\n    App.Tab = Ti.UI.createTab({\r\n        window: App.baseWin\r\n    })\r\n    App.TabGroup.addTab(App.Tab);\r\n\r\n\tApp.TabGroup.addEventListener('open',function(){\r\n\t\tApp.Tab.currentWin = Window('blue');\r\n\t\tApp.Tab.currentWin.open();\r\n\t});\r\n\tApp.TabGroup.open();\r\n\r\n})();\r\n{code}", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-10-02T00:35:03.000+0000", "updated": "2012-10-02T00:35:03.000+0000" }, { "id": "229718", "author": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing as invalid", "updateAuthor": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-12-04T00:06:03.000+0000", "updated": "2012-12-04T00:06:03.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }