{ "id": "104058", "key": "TIMOB-11604", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "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-17T17:18:12.000+0000", "created": "2012-10-29T21:33:50.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "api", "module_actionbar", "qe-port", "qe-testadded", "triage" ], "versions": [ { "id": "13505", "description": "Release 3.0.0", "name": "Release 3.0.0", "archived": true, "released": true, "releaseDate": "2012-12-14" } ], "issuelinks": [ { "id": "24690", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "108104", "key": "TIMOB-12340", "fields": { "summary": "Backport TIMOB-11604 to 3.0.2", "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": "5", "description": "The sub-task of the issue", "name": "Sub-task", "subtask": true } } } } ], "assignee": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2014-04-30T22:58:49.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": "To enable native-style search functionality, we should support the Android search widget (SearchView), which can be embedded in the action bar, as an alternative to the Ti SearchBar component. This could be implemented either using a lot of magic (so that if a search bar is inserted into the action bar and a table view, it appears in the action bar and acts on the table view), or it could be implemented as a separate object that can only be used in the action bar, and the user could link it up to a (hidden) search bar inserted into a table view. \r\n\r\nThe latter approach is cleaner, but requires a little more work on the part of the user.\r\n\r\nTesting code:\r\n{code}\r\nvar searchView = Ti.UI.Android.createSearchView();\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: 'blue',\r\n fullscreen: false,\r\n activity: {\r\n onCreateOptionsMenu: function(e) {\r\n var menu = e.menu;\r\n var menuItem = menu.add({\r\n actionView : searchView,\r\n icon: Ti.Android.R.drawable.ic_menu_search,\r\n showAsAction: Ti.Android.SHOW_AS_ACTION_IF_ROOM | Ti.Android.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW\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});\r\n\r\n\r\n// create table view data object\r\nvar data = [];\r\n\r\ndata[0] = Ti.UI.createTableViewRow({hasChild:true,title:'Row 1'});\r\ndata[1] = Ti.UI.createTableViewRow({hasDetail:true,title:'Row 2'});\r\ndata[2] = Ti.UI.createTableViewRow({hasCheck:true,title:'Row 3'});\r\ndata[3] = Ti.UI.createTableViewRow({title:'Row 4'});\r\n\r\n// create table view\r\nvar tableview = Titanium.UI.createTableView({\r\n\tdata:data,\r\n\tsearch:searchView,\r\n searchAsChild: false\r\n});\r\n\r\n\r\n// create table view event listener\r\ntableview.addEventListener('click', function(e)\r\n{\r\n\t// event data\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({title:'Table View',message:'row ' + row + ' index ' + index + ' section ' + section + ' row data ' + rowdata}).show();\r\n});\r\n\r\nvar hide = Titanium.UI.createButtonBar({\r\n\tlabels:['Hide', 'Show'],\r\n\tbackgroundColor:'#336699',\r\n\theight:25,\r\n\twidth:120\r\n});\r\n\r\n\r\n// add table view to the window\r\nwin.add(tableview);\r\n\r\nhide.addEventListener('click', function(e)\r\n{\r\n\tTi.API.info(\"search hidden = \"+tableview.searchHidden);\r\n\tif (e.index === 0)\r\n\t{\r\n\t\ttableview.searchHidden = true;\r\n\t}\r\n\telse if (e.index === 1)\r\n\t{\r\n\t\ttableview.scrollToTop(0,{animated:true});\r\n\t}\r\n});\r\n\r\nwin.open();\r\n{code}\r\n\r\n1. Run the above code with target API 11 - add this line in manifest section in tiapp.xml:\r\n{code}\r\n \r\n{code}\r\n\r\n2. Click on the search icon (top right corner) and make sure you can search for the tableview content", "attachment": [], "flagged": false, "summary": "Android: Support search widget in action bar", "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": "230468", "author": { "name": "aevans", "key": "aevans", "displayName": "Arthur Evans", "active": true, "timeZone": "America/Los_Angeles" }, "body": "BTW, I have the basics of this working as a module. Pretty simple, but available if it's of any use.", "updateAuthor": { "name": "aevans", "key": "aevans", "displayName": "Arthur Evans", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-12-07T22:49:07.000+0000", "updated": "2012-12-07T22:49:07.000+0000" }, { "id": "233234", "author": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR #3659", "updateAuthor": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-04T10:16:48.000+0000", "updated": "2013-01-04T10:16:48.000+0000" }, { "id": "234840", "author": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Expanded test case to test events:\r\n{code}\r\nvar searchView = Ti.UI.Android.createSearchView({\r\n\thintText: \"hint\",\r\n\tsubmitEnabled: true\r\n});\r\n\r\nsearchView.addEventListener(\"blur\", function(){\r\n\tTi.API.info(\"******************* searchView: blur\");\r\n});\r\n\r\nsearchView.addEventListener(\"focus\", function(){\r\n\tTi.API.info(\"******************* searchView: focus\");\r\n});\r\n\r\nsearchView.addEventListener(\"change\", function(){\r\n\tTi.API.info(\"******************* searchView: change\");\r\n});\r\n\r\nsearchView.addEventListener(\"cancel\", function(){\r\n\tTi.API.info(\"******************* searchView: cancel\");\r\n});\r\n\r\nsearchView.addEventListener(\"submit\", function(){\r\n\tTi.API.info(\"******************* searchView: submit\");\r\n});\r\n\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: 'blue',\r\n fullscreen: false,\r\n activity: {\r\n onCreateOptionsMenu: function(e) {\r\n var menu = e.menu;\r\n var menuItem = menu.add({\r\n actionView : searchView,\r\n icon: Ti.Android.R.drawable.ic_menu_search,\r\n showAsAction: Ti.Android.SHOW_AS_ACTION_IF_ROOM | Ti.Android.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW\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});\r\n \r\n \r\n// create table view data object\r\nvar data = [];\r\n \r\ndata[0] = Ti.UI.createTableViewRow({hasChild:true,title:'Row 1'});\r\ndata[1] = Ti.UI.createTableViewRow({hasDetail:true,title:'Row 2'});\r\ndata[2] = Ti.UI.createTableViewRow({hasCheck:true,title:'Row 3'});\r\ndata[3] = Ti.UI.createTableViewRow({title:'Row 4'});\r\n \r\n// create table view\r\nvar tableview = Titanium.UI.createTableView({\r\n data:data,\r\n search:searchView,\r\n searchAsChild: false\r\n});\r\n \r\n \r\n// create table view event listener\r\ntableview.addEventListener('click', function(e)\r\n{\r\n // event data\r\n var index = e.index;\r\n var section = e.section;\r\n var row = e.row;\r\n var rowdata = e.rowData;\r\n Titanium.UI.createAlertDialog({title:'Table View',message:'row ' + row + ' index ' + index + ' section ' + section + ' row data ' + rowdata}).show();\r\n});\r\n \r\nvar hide = Titanium.UI.createButtonBar({\r\n labels:['Hide', 'Show'],\r\n backgroundColor:'#336699',\r\n height:25,\r\n width:120\r\n});\r\n \r\n \r\n// add table view to the window\r\nwin.add(tableview);\r\n \r\nhide.addEventListener('click', function(e)\r\n{\r\n Ti.API.info(\"search hidden = \"+tableview.searchHidden);\r\n if (e.index === 0)\r\n {\r\n tableview.searchHidden = true;\r\n }\r\n else if (e.index === 1)\r\n {\r\n tableview.scrollToTop(0,{animated:true});\r\n }\r\n});\r\n \r\nwin.open();\r\n{code}", "updateAuthor": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-17T17:32:36.000+0000", "updated": "2013-01-21T19:02:02.000+0000" }, { "id": "236161", "author": { "name": "sbhadauria", "key": "sbhadauria", "displayName": "Shyam Bhadauria", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Search widget is working and returning the searched row from the tableview.\r\nEnvironment used for verification -\r\nTitanium SDK: 3.1.0.v20130126182604\r\nTitanium SDK: 3.0.2.v20130126230207\r\nTitanium  Studio:3.0.1.201212181159\r\nDevice: Samung GALAXY Tab 620 Android 3.2", "updateAuthor": { "name": "sbhadauria", "key": "sbhadauria", "displayName": "Shyam Bhadauria", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-28T10:38:21.000+0000", "updated": "2013-01-28T10:38:21.000+0000" }, { "id": "276340", "author": { "name": "lsdriscoll", "key": "lsdriscoll", "displayName": "Lee Driscoll", "active": true, "timeZone": "Europe/London" }, "body": "Please consider re-opening this ticket. This functionality needs to be tested on a window within a TabGroup as I am certain this does not work.\r\n\r\njobSearchList.js\r\n{code:javascript}\r\nvar jobSearch = Alloy.createController(\"jobSearch\").getView();\r\n\r\n$.jobSearchList.searchAsChild = false;\r\n$.jobSearchList.search = jobSearch;\r\n\r\n$.jobSearchListWindow.addEventListener('open', function(e){\r\n \r\n if( OS_ANDROID ){\r\n var activity = $.jobSearchListWindow.activity;\r\n \r\n activity.actionBar.setDisplayHomeAsUp(true);\r\n activity.actionBar.onHomeIconItemSelected = function() {\r\n $.jobSearchListWindow.close(Alloy.Globals.Transitions.FADE);\r\n };\r\n \r\n // Menu Item Specific Code\r\n activity.onCreateOptionsMenu = function(e) {\r\n // Search Field\r\n var searchField = e.menu.add({\r\n actionView: jobSearch\r\n });\r\n \r\n searchField.expandActionView(); \r\n };\r\n \r\n activity.invalidateOptionsMenu();\r\n }\r\n \r\n});\r\n{code}\r\n\r\nindex.js\r\n{code:javascript}\r\n$.mainTabGroup.addEventListener('open', function(e) {\r\n\r\n if( OS_ANDROID ){\r\n var activity = $.mainTabGroup.activity,\r\n jobSearchListWindow = Alloy.createController(\"jobSearchList\").getView();\r\n\r\n // Menu Item Specific Code\r\n activity.onCreateOptionsMenu = function(e) {\r\n var menu = e.menu;\r\n \r\n // Search Button\r\n var searchButton = menu.add({\r\n title : \"Search Jobs\",\r\n icon : Ti.Android.R.drawable.ic_menu_search,\r\n showAsAction: Ti.Android.SHOW_AS_ACTION_ALWAYS\r\n });\r\n searchButton.addEventListener('click', function(e){\r\n $.mainTabGroup.activeTab.open(jobSearchListWindow);\r\n });\r\n };\r\n\r\n activity.invalidateOptionsMenu();\r\n }\r\n});\r\n{code}\r\n\r\njobSearchList.xml\r\n{code:xml}\r\n\r\n\t\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n{code}", "updateAuthor": { "name": "lsdriscoll", "key": "lsdriscoll", "displayName": "Lee Driscoll", "active": true, "timeZone": "Europe/London" }, "created": "2013-10-23T13:43:09.000+0000", "updated": "2013-10-23T13:43:09.000+0000" }, { "id": "300322", "author": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "updateAuthor": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "created": "2014-04-08T23:55:43.000+0000", "updated": "2014-04-08T23:55:43.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }