{ "id": "79001", "key": "TIMOB-4947", "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": "12081", "description": "", "name": "Sprint 2011-41", "archived": true, "released": true, "releaseDate": "2011-10-17" }, { "id": "12470", "description": "", "name": "Release 1.7.4", "archived": true, "released": true, "releaseDate": "2011-10-31" }, { "id": "11331", "description": "", "name": "Release 1.8.0", "archived": true, "released": true, "releaseDate": "2011-10-31" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-01-04T16:45:28.000+0000", "created": "2011-08-09T07:35:05.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "module_window", "qe-testadded" ], "versions": [ { "id": "11971", "description": "iOS5 and select Android fixes", "name": "Release 1.7.3", "archived": true, "released": true, "releaseDate": "2011-10-18" } ], "issuelinks": [], "assignee": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2014-06-19T12:46:23.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": "The {{close}} event is not fired when window {{close()}} method is called for heavyweight windows (enabling modal or fullscreen etc). However, lightweight windows work as expected. I (the reporter) have tested this with all versions from 1.7.x branch, 1.8.0 latest also has this issue, while this works with 1.6.x branch. Here is code that reproduces this issue:\r\n\r\n{code:lang=javascript|title=app.js}\r\nvar win = Ti.UI.createWindow({\r\n\tmodal: true,\r\n\t// fullscreen:'true',\r\n\tbackgroundColor: '#000'\r\n});\r\n\r\nvar button = Ti.UI.createButton({\r\n\twidth: 300,\r\n\ttitle: 'Close window, log events!'\r\n});\r\n\r\nwin.add(button);\r\nwin.open();\r\n\r\nbutton.addEventListener('click', function() {\r\n\tTi.API.info('Button click event fired');\r\n\twin.close();\r\n});\r\n\r\nwin.addEventListener('close', function() {\r\n\tTi.API.info('Window close event fired');\r\n});\r\n{code}\r\n\r\nNo output is generated when this code is run and the button is clicked. Comment out the modal and fullscreen properties and the output will be generated as expected.\r\n\r\nIf a delay is introduced, using setTimeout(), the event for heavyweight windows is also fired:\r\n\r\n{code:lang=javascript|title=app.js}\r\nvar win = Ti.UI.createWindow({\r\n // modal: true,\r\n // fullscreen:'true',\r\n backgroundColor: '#000'\r\n});\r\n\r\nvar button = Ti.UI.createButton({\r\n width: 300,\r\n title: 'Close window, log events!'\r\n});\r\n\r\nwin.add(button);\r\nwin.open();\r\n\r\nbutton.addEventListener('click', function() {\r\n Ti.API.info('Button click event fired');\r\n setTimeout(function(){\r\n win.close(); // *** INSIDE setTimeout() ***\r\n }, 1000);\r\n\r\n});\r\n\r\nwin.addEventListener('close', function() {\r\n Ti.API.info('Window close event fired');\r\n});\r\n{code}\r\n\r\nAlso note that the event is not fired if the windows is simply opened and immediately closed:\r\n\r\n{code:lang=javascript|title=app.js}\r\nvar win = Ti.UI.createWindow({\r\n // modal: true,\r\n fullscreen:'true',\r\n backgroundColor: '#000'\r\n});\r\n\r\nwin.open();\r\nwin.close();\r\n\r\nwin.addEventListener('close', function() {\r\n Ti.API.info('Window close event fired');\r\n});\r\n{code}\r\n\r\nHowever, it works as expected if wrapped in setTimeout():\r\n\r\n{code:lang=javascript|title=app.js}\r\nvar win = Ti.UI.createWindow({\r\n // modal: true,\r\n fullscreen:'true',\r\n backgroundColor: '#000'\r\n});\r\n\r\nwin.open();\r\nsetTimeout(function(){\r\n win.close();\r\n}, 1000);\r\n\r\n\r\nwin.addEventListener('close', function() {\r\n Ti.API.info('Window close event fired');\r\n});\r\n{code}\r\n\r\nQ/A topics: \r\n[http://developer.appcelerator.com/question/123902/close-event-not-fired-when-window-is-closed-from-button-event-handler]\r\n[http://developer.appcelerator.com/question/123821/android-window-close-event-not-firing]", "attachment": [], "flagged": false, "summary": "Android: Window close event not fired for heavyweight window", "creator": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "subtasks": [], "reporter": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "environment": "Tested using the following systems, with identical results.\r\n\r\nSystem 1:\r\n* Titanium SDK version: 1.7.3 (08/05/11 10:17 32b4803...)\r\n* Android 2.2 on Samsung Galaxy Tab v7\r\n* Windows XP\r\n\r\nSystem 2:\r\n* Titanium 1.7.3 (2011/08/05 10:18 )\r\n* Android 2.1-update1\r\n* Ubuntu 10.04\r\n* Titanium Studio, build: 1.0.4.201108041935", "comment": { "comments": [ { "id": "165905", "author": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I wasn't able to reproduce this with both modal and fullscreen enabled. For the other scenario, there is typically a small delay after you initially create a window. If you immediately close a window right after you open one, it may not fire a close event. Also, in the example mentioned above, the event listener is added after the window is closed, which is why the event listener code is never triggered.", "updateAuthor": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-09-13T15:01:32.000+0000", "updated": "2011-09-13T15:01:32.000+0000" }, { "id": "167570", "author": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Hi Allen.\r\n\r\n\r\nFocus on the first example. In it, window is closed when button is clicked (so window close event handler is attached at that time), but \"close\" event is not fired.\r\n\r\nHere is my original use case that I tested with (and again right now with latest 1.7.3) and it doesn't work as expected:\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n modal: true,\r\n backgroundColor: '#000'\r\n});\r\n \r\nwin.addEventListener('close', function() {\r\n Ti.API.info('Close event fired');\r\n});\r\n \r\nvar button = Ti.UI.createButton({\r\n width: 300,\r\n title: 'Close window!'\r\n});\r\n \r\nbutton.addEventListener('click', function() {\r\n win.close();\r\n});\r\n \r\nwin.add(button);\r\n \r\nwin.open();\r\n{code}\r\n\r\nIf you run this example, there is no output in the console.\r\n\r\nIf you comment out \"modal: true\", the output is produced as expected.", "updateAuthor": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2011-10-03T04:18:56.000+0000", "updated": "2011-10-03T04:18:56.000+0000" }, { "id": "169639", "author": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "With latest 1.8 build, I can confirm that this issue is fixed.\r\n\r\n\r\nTnx :)", "updateAuthor": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2011-10-19T00:44:52.000+0000", "updated": "2011-10-19T00:44:52.000+0000" }, { "id": "169921", "author": { "name": "mpettiford", "key": "mpettiford", "displayName": "Michael Pettiford", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested with 1.7.4.v20111019130614 with TiStudio 1.0.6.201110171921 on OSX Lion 10.7.2\r\nNexus S with OS version 2.3.6 -- G Slate with OS version 3.1 -- HTC hero with OS version 2.1\r\nAndroid emulator with OS version 2.1 and 2.3.3\r\n\r\nWindow close event is fired after button click and log is displaying respective output (i.e. 'Close event fired')\r\n\r\nKeeping open to confirm with 1.8 before closing", "updateAuthor": { "name": "mpettiford", "key": "mpettiford", "displayName": "Michael Pettiford", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-10-20T13:50:40.000+0000", "updated": "2011-10-20T13:50:40.000+0000" }, { "id": "175298", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified fixed with SDK 1.8.0.1.v20111207112258 in both Rhino and V8 on Nexus S 2.3.6 and Droid 3 2.3.4 using Titanium Studio, build: 1.0.7.201112061404.", "updateAuthor": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-12-07T17:02:09.000+0000", "updated": "2011-12-07T17:02:09.000+0000" }, { "id": "178054", "author": { "name": "mpettiford", "key": "mpettiford", "displayName": "Michael Pettiford", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Reopening/closing to add/remove labels", "updateAuthor": { "name": "mpettiford", "key": "mpettiford", "displayName": "Michael Pettiford", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-04T16:45:09.000+0000", "updated": "2012-01-04T16:45:09.000+0000" }, { "id": "283498", "author": { "name": "shameerj", "key": "shameerj", "displayName": "Shameer Jan", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Anvil testcase PR https://github.com/appcelerator/titanium_mobile/pull/4967\n", "updateAuthor": { "name": "shameerj", "key": "shameerj", "displayName": "Shameer Jan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-12-10T06:17:52.000+0000", "updated": "2013-12-10T06:17:52.000+0000" } ], "maxResults": 8, "total": 8, "startAt": 0 } } }