{ "id": "103017", "key": "TIMOB-11340", "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": "13505", "description": "Release 3.0.0", "name": "Release 3.0.0", "archived": true, "released": true, "releaseDate": "2012-12-14" }, { "id": "14162", "description": "Release 3.1.0", "name": "Release 3.1.0", "archived": true, "released": true, "releaseDate": "2013-04-16" }, { "id": "14165", "description": "2012 Sprint 21 API", "name": "2012 Sprint 21 API", "archived": true, "released": true, "releaseDate": "2012-10-22" }, { "id": "14273", "description": "2012 Sprint 21", "name": "2012 Sprint 21", "archived": true, "released": true, "releaseDate": "2012-10-22" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-10-15T21:39:30.000+0000", "created": "2012-10-10T01:19:01.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "api", "tabgroup" ], "versions": [ { "id": "13505", "description": "Release 3.0.0", "name": "Release 3.0.0", "archived": true, "released": true, "releaseDate": "2012-12-14" } ], "issuelinks": [ { "id": "21883", "type": { "id": "10001", "name": "Cloners", "inward": "is cloned into", "outward": "is cloned from" }, "inwardIssue": { "id": "103062", "key": "TIMOB-11356", "fields": { "summary": "Android: Keyboard doesn't close in ActionBar-style tab group", "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": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2012-12-04T00:28:00.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": "In 3.0, we have support for ActionBar-based tabs and menu items.\r\n\r\nHowever, to add a menu item to the action bar, we need to access the current activity. Attempting to access the window activity for the tab window doesn't work in 3.0, though it works in 2.X. Currently attempting to set the optionsmenu on the window activity in a tab group crashes for *both* 2.X and 4.X devices on 3.0.\r\n\r\nUsing Ti.Android.currentActivity fails in the same way.\r\n\r\nI think there are two issues here:\r\n\r\n* We don't seem to expose the activity associated with the tab group in any fashion I can see.\r\n* We have a regression that is causing the following code to throw an exception in 3.0.\r\n\r\n{code}\r\n//\r\n// create base UI tab and root window\r\n//\r\nvar tg = Ti.UI.createTabGroup();\r\nvar win1 = Titanium.UI.createWindow({\r\n\ttitle : 'Tab 1',\r\n\tbackgroundColor : '#fff',\r\n\tlayout : 'vertical'\r\n});\r\n\r\nvar label1 = Titanium.UI.createLabel({\r\n\tcolor : '#999',\r\n\ttext : 'I am Window 1',\r\n\tfont : {\r\n\t\tfontSize : 20,\r\n\t\tfontFamily : 'Helvetica Neue'\r\n\t},\r\n\ttextAlign : 'center',\r\n\twidth : 'auto'\r\n});\r\n\r\nvar tf = Titanium.UI.createTextField({\r\n\thintText : 'Hello',\r\n\twidth : 300,\r\n\tcolor : 'white',\r\n\tbackgroundColor: '#333',\r\n});\r\n\r\n\r\nwin1.add(label1);\r\nwin1.add(tf);\r\nif (Ti.Platform.name === 'android') {\r\n\twin1.addEventListener('open', function(e) {\r\n\t\tTi.API.info(\"win1.activity is: \" + win1.activity);\r\n\t\tTi.API.info(\"Ti.Android.currentActivity is: \" + Ti.Android.currentActivity);\r\n\t\t\r\n\t\twin1.activity.onCreateOptionsMenu = function(e) {\r\n\t\t\tvar menu = e.menu;\r\n\t\t\tvar menuItem = menu.add({\r\n\t\t\t\ttitle : \"Item 1\",\r\n\t\t\t\tshowAsAction : Ti.Android.SHOW_AS_ACTION_WITH_TEXT\r\n\t\t\t});\r\n\t\t\tmenuItem.icon = \"KS_nav_ui.png\";\r\n\t\t\tmenuItem.addEventListener(\"click\", function(e) {\r\n\t\t\t\tTi.API.info(\"I was clicked\");\r\n\t\t\t});\r\n\t\t};\r\n\t});\r\n}\r\n\r\nvar tab1 = Ti.UI.createTab({\r\n\ttitle : 'Quarks',\r\n\twindow : win1\r\n});\r\n\r\ntg.addTab(tab1);\r\n\r\nvar win2 = Titanium.UI.createWindow({\r\n\ttitle : 'Tab 2',\r\n\tbackgroundColor : '#f33',\r\n});\r\n\r\nvar tab2 = Ti.UI.createTab({\r\n\ttitle : 'Snoodles',\r\n\twindow : win2\r\n});\r\n\r\ntg.addTab(tab2);\r\ntg.open();\r\n{code}\r\n\r\nTested with SDK 3.0.0.v20121009034227.\r\nNexus 7 \r\nGalaxy S 2 (2.3.6).\r\n\r\nError message is:\r\n\r\n{code}\r\nE/TiExceptionHandler( 9242): (main) [170,233] ----- Titanium Javascript Runtime Error -----\r\nE/TiExceptionHandler( 9242): (main) [0,233] - In ti:/window.js:313,34\r\nE/TiExceptionHandler( 9242): (main) [0,233] - Message: Uncaught TypeError: Cannot call method 'extend' of undefined\r\nE/TiExceptionHandler( 9242): (main) [0,233] - Source: \t\t\tthis.window._internalActivity.extend(this.cachedActivityProxy);\r\n{code}\r\n", "attachment": [], "flagged": false, "summary": "Android: Can't add menu items to ActionBar-style tab group", "creator": { "name": "aevans", "key": "aevans", "displayName": "Arthur Evans", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "aevans", "key": "aevans", "displayName": "Arthur Evans", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "223322", "author": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Created [PR #3191 | https://github.com/appcelerator/titanium_mobile/pull/3191] to resolve the crash seen with this test case.\n\nRun the test case and verify there is no crash and you can see the menu item.", "updateAuthor": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-10-12T22:40:31.000+0000", "updated": "2012-10-12T22:40:31.000+0000" }, { "id": "223439", "author": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "body": "master PR: https://github.com/appcelerator/titanium_mobile/pull/3191", "updateAuthor": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-10-13T23:19:20.000+0000", "updated": "2012-10-13T23:19:20.000+0000" }, { "id": "223505", "author": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Created [PR #3231|https://github.com/appcelerator/titanium_mobile/pull/3231] to back port fix into 3.0 release.", "updateAuthor": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-10-14T23:58:07.000+0000", "updated": "2012-10-14T23:58:07.000+0000" }, { "id": "223508", "author": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "body": "3.0.X PR: https://github.com/appcelerator/titanium_mobile/pull/3231", "updateAuthor": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-10-15T01:06:27.000+0000", "updated": "2012-10-15T01:06:27.000+0000" }, { "id": "229738", "author": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested with 3.0.0.v201211300200208 on Galaxy S3 4.0.4", "updateAuthor": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-12-04T00:28:00.000+0000", "updated": "2012-12-04T00:28:00.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }