{ "id": "107968", "key": "TIMOB-12307", "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": "14164", "description": "Release 3.0.2", "name": "Release 3.0.2", "archived": true, "released": true, "releaseDate": "2013-02-19" }, { "id": "14162", "description": "Release 3.1.0", "name": "Release 3.1.0", "archived": true, "released": true, "releaseDate": "2013-04-16" }, { "id": "15079", "description": "2013 Sprint 02 API", "name": "2013 Sprint 02 API", "archived": true, "released": true, "releaseDate": "2013-01-28" }, { "id": "14812", "description": "2013 Sprint 02", "name": "2013 Sprint 02", "archived": true, "released": true, "releaseDate": "2013-01-28" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2013-01-18T17:34:25.000+0000", "created": "2013-01-16T15:33:53.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "api", "module_android", "qe-testadded" ], "versions": [ { "id": "13505", "description": "Release 3.0.0", "name": "Release 3.0.0", "archived": true, "released": true, "releaseDate": "2012-12-14" } ], "issuelinks": [ { "id": "24719", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "62144", "key": "TIMOB-1512", "fields": { "summary": "Android: OptionMenu is not working with TabGroup", "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": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2013-01-24T05:49: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": "Starting from API 11, menuItem methods must be run from the main thread, otherwise a Java exception will occur. MenuItemProxy needs to be refactor to address this issue.\r\n\r\nTesting code: \r\n{code}\r\n\r\nvar win1 = Ti.UI.createWindow({\r\n backgroundColor: 'blue',\r\n fullscreen: false\r\n});\r\nvar tab1 = Ti.UI.createTab({\r\n window: win1,\r\n title: 'Tab 1'\r\n});\r\n\r\nvar win2 = Ti.UI.createWindow({\r\n backgroundColor: 'yellow'\r\n});\r\nvar tab2 = Ti.UI.createTab({\r\n window: win2,\r\n title: 'Tab 2'\r\n});\r\n\r\nvar tabGroup = Ti.UI.createTabGroup({\r\n\tactivity: {\r\n onCreateOptionsMenu: function(e) {\r\n var menu = e.menu;\r\n var menuItem = menu.add({\r\n title : \"Item 1\",\r\n itemId: 1\r\n });\r\n var menuItem2 = menu.add({\r\n title : \"Item 2\",\r\n itemId: 2\r\n });\r\n menuItem.addEventListener(\"click\", function(e) {\r\n Ti.API.info(\"I was clicked\");\r\n });\r\n },\r\n \r\n onPrepareOptionsMenu: function(e) {\r\n \tvar menu = e.menu;\r\n \tif (tab1.active) {\r\n \t\tmenu.findItem(1).setVisible(false);\r\n \t\tvar menuItem2 = menu.findItem(2);\r\n \t\tmenuItem2.setVisible(true);\r\n \t\tTi.API.info(\"item2 is checked: \" + menuItem2.isChecked());\r\n \t\tTi.API.info(\"item2 is enabled: \" + menuItem2.isEnabled());\r\n \t\r\n \t}\r\n \t\r\n \tif (tab2.active) {\r\n \t var menuItem = menu.findItem(1);\r\n \t\tmenuItem.setVisible(true);\r\n \t\tTi.API.info(\"item1 is checked: \" + menuItem.isChecked());\r\n \t\tTi.API.info(\"item1 is enabled: \" + menuItem.isEnabled());\r\n \t\tmenu.findItem(2).setVisible(false);\r\n \t}\r\n }\r\n }\r\n});\r\n \r\ntabGroup.addTab(tab1);\r\ntabGroup.addTab(tab2);\r\ntabGroup.open();\r\n\r\n{code}\r\n\r\n1. Run app.js\r\n2. Click on menu/optionMenu button: you should see Item 2 in tab1 and Item 1 in tab2. You should also see \"is checked\" and \"is enabled\" in logcat.", "attachment": [], "flagged": false, "summary": "Android: Refactor MenuItemProxy", "creator": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "234997", "author": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR: https://github.com/appcelerator/titanium_mobile/pull/3619\r\n3_0_X PR: https://github.com/appcelerator/titanium_mobile/pull/3740", "updateAuthor": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-18T17:37:11.000+0000", "updated": "2013-01-18T17:38:08.000+0000" }, { "id": "235685", "author": { "name": "amittal", "key": "amittal", "displayName": "Anshu Mittal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested with: \r\nSDK:3.1.0.v20130123144204,3.0.2.v20130123192623\r\nStudio:3.0.1.201212181159\r\nDevice: Android Nexus7(v 4.1)", "updateAuthor": { "name": "amittal", "key": "amittal", "displayName": "Anshu Mittal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-24T05:49:23.000+0000", "updated": "2013-01-24T05:49:23.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }