{ "id": "119819", "key": "TIMOB-15126", "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": "15691", "description": "2013 Sprint 19", "name": "2013 Sprint 19", "archived": true, "released": true, "releaseDate": "2013-09-20" }, { "id": "15693", "description": "2013 Sprint 19 API", "name": "2013 Sprint 19 API", "archived": true, "released": true, "releaseDate": "2013-09-20" }, { "id": "15593", "description": "Release 3.1.3", "name": "Release 3.1.3", "archived": true, "released": true, "releaseDate": "2013-09-18" }, { "id": "14982", "description": "Release 3.2.0", "name": "Release 3.2.0", "archived": false, "released": true, "releaseDate": "2013-12-19" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2013-09-12T23:41:42.000+0000", "created": "2013-09-12T14:18:28.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "android", "defect", "menu", "module_android", "qe-testadded", "regression", "titanbeta", "triage" ], "versions": [], "issuelinks": [], "assignee": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2014-04-22T06:35:21.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": "h2.Problem\r\nUnder mobile SDK 3.1.2.GA, normal menus don't pop up any more when the menu button is pressed. Works fine in 3.1.1.GA. Therefore, this is a regression.\r\n\r\nh2.Testcase\r\nUsing the following code, run the app and press the menu button. With SDK 3.1.2.GA, no menu will appear. With SDK 3.1.1.GA, the menu will appear as normal.\r\n{panel:title=app.js}\r\n{code}\r\nvar win1=Ti.UI.createWindow({ layout:'vertical', \r\n navBarHidden:true, \r\n exitOnClose:true,\r\n url:'win1.js' });\r\nwin1.open();\r\n{code}\r\n{panel}\r\n{panel:title=win1.js}\r\n{code}\r\nvar win1=Ti.UI.currentWindow;\r\nvar Label1=Ti.UI.createLabel({ text:'Push the menu button' });\r\nwin1.add(Label1);\r\n\r\nfunction MenuHandler(evt)\r\n{\r\n switch (evt.source.order)\r\n {\r\n case 0 : alert('First Option');\r\n break;\r\n case 1 : alert('Second Option');\r\n break;\r\n }\r\n}\r\n\r\nfunction CreateMenu(evt)\r\n{\r\n var MenuItem1,MenuItem2;\r\n MenuItem1=evt.menu.add({title:'Option 1', icon:null, order:0, itemId:0});\r\n MenuItem2=evt.menu.add({title:'Option 2', icon:null, order:1, itemId:1});\r\n MenuItem1.addEventListener('click',MenuHandler);\r\n MenuItem2.addEventListener('click',MenuHandler);\r\n}\r\n\r\nwin1.activity.onCreateOptionsMenu=CreateMenu;\r\n{code}\r\n{panel}\r\n", "attachment": [], "flagged": false, "summary": "Android: Menus do not respond in regards to menu button being pressed", "creator": { "name": "bitshftr", "key": "bitshftr", "displayName": "Shawn Lipscomb", "active": true, "timeZone": "America/New_York" }, "subtasks": [], "reporter": { "name": "bitshftr", "key": "bitshftr", "displayName": "Shawn Lipscomb", "active": true, "timeZone": "America/New_York" }, "environment": "Ti SDK 3.1.2.GA\r\nTi Studio 3.1.2.201308091617\r\nWindows 7\r\nAndroid 2.3.3 emulator\r\nAndroid 4.2.2 emulator", "comment": { "comments": [ { "id": "270924", "author": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Investigating.\r\n\r\nIssue seems to be related to using an Android MenuItem in a Window using the 'url' property, thus being opened in a sub-context.\r\n\r\nThe following code is the one provided in the description, but without using the 'url' property and defining everything in a single context.\r\nThis is working as expected using also 3.1.2.GA and latest 3.1.3\r\n\r\n{code}\r\nvar win1 = Ti.UI.createWindow({\r\n\tlayout : 'vertical',\r\n\tnavBarHidden : true,\r\n\texitOnClose : true,\r\n\t// url : 'win1.js' //commenting out - using url opens a window in a sub-context\r\n});\r\n\r\nwin1.open();\r\n// commenting out the next line - currentWindow valid only when using a sub-context\r\n// var win1 = Ti.UI.currentWindow;\r\n\r\nvar Label1 = Ti.UI.createLabel({\r\n\ttext : 'Push the menu button'\r\n});\r\nwin1.add(Label1);\r\n\r\nfunction MenuHandler(evt) {\r\n\tswitch (evt.source.order) {\r\n\t\tcase 0 :\r\n\t\t\talert('First Option');\r\n\t\t\tbreak;\r\n\t\tcase 1 :\r\n\t\t\talert('Second Option');\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\nfunction CreateMenu(evt) {\r\n\tvar MenuItem1, MenuItem2;\r\n\tMenuItem1 = evt.menu.add({\r\n\t\ttitle : 'Option 1',\r\n\t\ticon : null,\r\n\t\torder : 0,\r\n\t\titemId : 0\r\n\t});\r\n\tMenuItem2 = evt.menu.add({\r\n\t\ttitle : 'Option 2',\r\n\t\ticon : null,\r\n\t\torder : 1,\r\n\t\titemId : 1\r\n\t});\r\n\tMenuItem1.addEventListener('click', MenuHandler);\r\n\tMenuItem2.addEventListener('click', MenuHandler);\r\n}\r\n\r\nwin1.activity.onCreateOptionsMenu = CreateMenu; \r\n{code}\r\n\r\n", "updateAuthor": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-09-12T19:45:15.000+0000", "updated": "2013-09-12T20:29:17.000+0000" }, { "id": "270945", "author": { "name": "bitshftr", "key": "bitshftr", "displayName": "Shawn Lipscomb", "active": true, "timeZone": "America/New_York" }, "body": "Federico, yes, I noticed that a simple \"all-app.js\" example worked. But this bug report is about it no longer working in url-based (secondary context) windows.", "updateAuthor": { "name": "bitshftr", "key": "bitshftr", "displayName": "Shawn Lipscomb", "active": true, "timeZone": "America/New_York" }, "created": "2013-09-12T20:54:11.000+0000", "updated": "2013-09-12T20:54:11.000+0000" }, { "id": "270983", "author": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "body": "master PR: https://github.com/appcelerator/titanium_mobile/pull/4683", "updateAuthor": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-09-12T23:11:16.000+0000", "updated": "2013-09-12T23:11:16.000+0000" }, { "id": "270990", "author": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "body": "3.1.X PR: https://github.com/appcelerator/titanium_mobile/pull/4684", "updateAuthor": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-09-12T23:44:50.000+0000", "updated": "2013-09-12T23:44:50.000+0000" }, { "id": "271095", "author": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified as fixed \n\nTiSDK 3.1.3.v20130912171547\nTiStudio 3.1.3.201309132456\nCLI 3.1.2 GA\n\nClosing", "updateAuthor": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-09-13T20:04:49.000+0000", "updated": "2013-09-13T20:04:49.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }