{ "id": "131958", "key": "TIMOB-17480", "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": "16586", "description": "Release 3.4.2", "name": "Release 3.4.2", "archived": false, "released": true, "releaseDate": "2017-03-11" }, { "id": "16704", "description": "Release 3.5.0", "name": "Release 3.5.0", "archived": false, "released": true, "releaseDate": "2015-01-13" }, { "id": "16593", "description": "Release 4.0.0", "name": "Release 4.0.0", "archived": false, "released": true, "releaseDate": "2015-05-21" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2014-11-25T18:58:36.000+0000", "created": "2014-06-19T10:55:09.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "TCSupport", "actionView", "invalidateOptionsMenu()", "menuItem", "module_android", "qe-manualtest", "qe-testadded", "regression" ], "versions": [ { "id": "15422", "description": "Release 3.3.0", "name": "Release 3.3.0", "archived": false, "released": true, "releaseDate": "2014-07-16" } ], "issuelinks": [ { "id": "42659", "type": { "id": "10020", "name": "Depends", "inward": "is dependent of", "outward": "depends on" }, "inwardIssue": { "id": "128872", "key": "TIMOB-16838", "fields": { "summary": "Android: Add searchAsChild to ListView to support Search View in Action Bar", "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": "Medium", "id": "3" }, "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false } } } } ], "assignee": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2014-11-25T18:59: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": " Android menuItem with actionView can’t handle invalidateOptionsMenu() with Titanium SDK 3.3.0.GA.\r\n\r\nh5. TESTING ENVIRONMENT:\r\n\r\nMac OS X 10.9\r\nTi CLI 3.3.0\r\nTitanium SDK: 3.3.0.RC, 3.3.0.GA and 3.2.3.GA\r\nAndroid emulator and device 4.4.3\r\n\r\nh5. TEST CODE\r\n\r\n{code}\r\nvar searchView = Ti.UI.Android.createSearchView();\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor : 'blue',\r\n\tfullscreen : false,\r\n\tactivity : {\r\n\t\tonCreateOptionsMenu : function(e) {\r\n\t\t\tvar menu = e.menu;\r\n\t\t\tvar menuItem = menu.add({\r\n\t\t\t\tactionView : searchView,\r\n\t\t\t\ticon : Ti.Android.R.drawable.ic_menu_search,\r\n\t\t\t\tshowAsAction : Ti.Android.SHOW_AS_ACTION_IF_ROOM | Ti.Android.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW\r\n\t\t\t});\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 data = [];\r\n\r\ndata[0] = Ti.UI.createTableViewRow({\r\n\thasChild : true,\r\n\ttitle : 'Row 1'\r\n});\r\ndata[1] = Ti.UI.createTableViewRow({\r\n\thasDetail : true,\r\n\ttitle : 'Row 2'\r\n});\r\ndata[2] = Ti.UI.createTableViewRow({\r\n\thasCheck : true,\r\n\ttitle : 'Row 3'\r\n});\r\ndata[3] = Ti.UI.createTableViewRow({\r\n\ttitle : 'Row 4'\r\n});\r\n\r\nvar tableview = Titanium.UI.createTableView({\r\n\tdata : data,\r\n\tsearch : searchView,\r\n\tsearchAsChild : false\r\n});\r\n\r\ntableview.addEventListener('click', function(e) {\r\n\t// event data\r\n\twin.getActivity().invalidateOptionsMenu();\r\n\tvar index = e.index;\r\n\tvar section = e.section;\r\n\tvar row = e.row;\r\n\tvar rowdata = e.rowData;\r\n\tTitanium.UI.createAlertDialog({\r\n\t\ttitle : 'Table View',\r\n\t\tmessage : 'row ' + row + ' index ' + index + ' section ' + section + ' row data ' + rowdata\r\n\t}).show();\r\n});\r\n\r\nwin.add(tableview);\r\nwin.open();\r\n{code}\r\n\r\nh5. STEPS TO TEST\r\n•\tCreate a new project\r\n•\tUpdate app.js file with sample code\r\n•\tRun on android emulator/device\r\n•\tClick the search button, see the searchView appear and works fine.\r\n•\tClick a row, see the alert (win.getActivity().invalidateOptionsMenu(); i called)\r\n•\tClick the search button again, now the searchView is not displayed\r\n\r\nh5. EXPECTED RESULT\r\nIt’s not working as expected in Ti SDK 3.3.0 but works fine in 3.2.3.GA\r\n\r\n\r\n", "attachment": [ { "id": "49092", "filename": "app.js", "author": { "name": "thomas.neerup@eg.dk", "key": "thomas.neerup@eg.dk", "displayName": "Thomas Neerup", "active": true, "timeZone": "Europe/Copenhagen" }, "created": "2014-06-19T10:55:11.000+0000", "size": 1844, "mimeType": "application/javascript" } ], "flagged": false, "summary": "Android: Android menuItem with actionView can't handle invalidateOptionsMenu()", "creator": { "name": "thomas.neerup@eg.dk", "key": "thomas.neerup@eg.dk", "displayName": "Thomas Neerup", "active": true, "timeZone": "Europe/Copenhagen" }, "subtasks": [], "reporter": { "name": "thomas.neerup@eg.dk", "key": "thomas.neerup@eg.dk", "displayName": "Thomas Neerup", "active": true, "timeZone": "Europe/Copenhagen" }, "environment": "Android\r\nMobile SDK 3.3.0.GA", "closedSprints": [ { "id": 220, "state": "closed", "name": "2014 Sprint 20 SDK", "startDate": "2014-09-29T22:32:25.224Z", "endDate": "2014-10-13T18:25:00.000Z", "completeDate": "2014-10-13T18:25:45.560Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "311251", "author": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "body": "After the system calls onCreateOptionsMenu(), it retains an instance of the Menu you populate and will not call onCreateOptionsMenu() again unless the menu is invalidated for some reason. However, you should use onCreateOptionsMenu() only to create the initial menu state and not to make changes during the activity lifecycle.\r\n\r\nIf you want to modify the options menu based on events that occur during the activity lifecycle, you can do so in the onPrepareOptionsMenu() method. This method passes you the Menu object as it currently exists so you can modify it, such as add, remove, or disable items. (Fragments also provide an onPrepareOptionsMenu() callback.)\r\n\r\nOn Android 3.0 and higher, the options menu is considered to always be open when menu items are presented in the action bar. When an event occurs and you want to perform a menu update, you must call invalidateOptionsMenu() to request that the system call onPrepareOptionsMenu().\r\n\r\nRef: http://developer.android.com/guide/topics/ui/menus.html#ChangingTheMenu", "updateAuthor": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "created": "2014-06-27T10:27:36.000+0000", "updated": "2014-06-27T10:27:36.000+0000" }, { "id": "311482", "author": { "name": "thomas.neerup@eg.dk", "key": "thomas.neerup@eg.dk", "displayName": "Thomas Neerup", "active": true, "timeZone": "Europe/Copenhagen" }, "body": "I am aware of the onPrepareOptionsMenu callback. But consider the case of an application with 2 tabs. On both tabs there is a tableview and both tableviews have a searchview in the menus actionview. Now since the menu is attached to the tabcontroller Not the individual tabs, the menu needs to be rebuild when switching between the tabs. \r\nHow can this be done?\r\nJust to be clear, this worked in 3.2.3, but not in 3.3.0.\r\n", "updateAuthor": { "name": "thomas.neerup@eg.dk", "key": "thomas.neerup@eg.dk", "displayName": "Thomas Neerup", "active": true, "timeZone": "Europe/Copenhagen" }, "created": "2014-06-28T08:46:41.000+0000", "updated": "2014-06-28T08:46:41.000+0000" }, { "id": "317857", "author": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "body": "Thanks for your report. The Platform team will be setting the priority on this bug. ", "updateAuthor": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "created": "2014-08-10T08:03:10.000+0000", "updated": "2014-08-10T08:03:10.000+0000" }, { "id": "319439", "author": { "name": "jithinv@exalture.com", "key": "jithinv@exalture.com", "displayName": "jithinpv", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Issue reproduces in \r\nTitanium SDK version 3.4.0 master, 3.3.0.GA\r\n\r\nWorks fine in \r\nTitanium SDK version 3.2.3.GA\r\n\r\nTitanium Studio, build: 3.3.0.201407100905\r\nTitanium Command-Line Interface\r\nCLI version 3.3.0, \r\nAndroid device : Motorola Moto G, Android version : 4.4.4", "updateAuthor": { "name": "jithinv@exalture.com", "key": "jithinv@exalture.com", "displayName": "jithinpv", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-08-20T09:18:36.000+0000", "updated": "2014-08-20T09:18:36.000+0000" }, { "id": "319820", "author": { "name": "aslan", "key": "aslan", "displayName": "Aslan", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Any chance to fix it? As this is regression it affects my existing application. Thanks.", "updateAuthor": { "name": "aslan", "key": "aslan", "displayName": "Aslan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-08-21T22:45:01.000+0000", "updated": "2014-08-23T08:11:39.000+0000" }, { "id": "326550", "author": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Master PR : https://github.com/appcelerator/titanium_mobile/pull/6048", "updateAuthor": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-09-30T23:44:56.000+0000", "updated": "2014-09-30T23:44:56.000+0000" }, { "id": "326560", "author": { "name": "thomas.neerup@eg.dk", "key": "thomas.neerup@eg.dk", "displayName": "Thomas Neerup", "active": true, "timeZone": "Europe/Copenhagen" }, "body": "Any chance this could become part of the 3.4.1 Release? this affects my existing application. ", "updateAuthor": { "name": "thomas.neerup@eg.dk", "key": "thomas.neerup@eg.dk", "displayName": "Thomas Neerup", "active": true, "timeZone": "Europe/Copenhagen" }, "created": "2014-10-01T06:24:20.000+0000", "updated": "2014-10-01T06:24:20.000+0000" }, { "id": "326938", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified the fix on latest 3.5.0 sdk & is fixed. \r\nNot closing as its not been backported to 3.4.1 sdk.\r\n\r\nEnvironment:\r\nAppc Studio : 3.4.0.201409261245\r\nTi SDK : 3.5.0.v20141002192515\r\nMac OSX : 10.9.4\r\nAlloy : 1.5.1\r\nCLI - 3.4.0\r\nCode Processor: 1.1.1\r\nNexus 5 - Android 4.4.4", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-10-03T21:23:57.000+0000", "updated": "2014-10-03T22:26:16.000+0000" }, { "id": "330879", "author": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "body": "3.4.X PR: https://github.com/appcelerator/titanium_mobile/pull/6316", "updateAuthor": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-11-05T19:44:14.000+0000", "updated": "2014-11-05T19:44:14.000+0000" }, { "id": "333664", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified the fix on latest master 3.6.0 sdk & is fixed.\r\n\r\nClosing\r\n\r\nEnvironment:\r\nAppc Studio : 3.4.1.201410281743\r\nTi SDK : 3.6.0.v20141125064916\r\nCLI : 3.4.1\r\nAlloy : 1.5.1 GA\r\nCode Processor : 1.1.1\r\nMAC Yosemite : 10.10\r\nNexus 5 - Android 5.0", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-11-25T18:41:25.000+0000", "updated": "2014-11-25T18:41:25.000+0000" } ], "maxResults": 12, "total": 12, "startAt": 0 } } }