{ "id": "148467", "key": "TIMOB-19199", "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": "16925", "description": "WatchKit Support--all going into 5.0 now", "name": "Release 5.0.0", "archived": true, "released": true, "releaseDate": "2015-09-16" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2015-08-14T21:20:19.000+0000", "created": "2015-06-03T17:56:46.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "actionbar", "android", "picker" ], "versions": [], "issuelinks": [], "assignee": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "updated": "2015-08-18T22:51:59.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 our app, we have a picker added to the ActionBar with code like the following. Building with the 3.5.x branch SDKs, the picker is collapsed as expected. Building the same project with SDK 4.1.0.GA (or 4.0.1), the picker is expanded as shown in the attached graphic when the app is launched. Users have to tap outside the picker to collapse it.\r\n\r\n{code}\r\n$.tabGroup.addEventListener(\"open\", function () {\r\n var activity = $.tabGroup.getActivity();\r\n activity.onCreateOptionsMenu = function (e) {\r\n var settings, item, picker, menu, data = [];\r\n menu = e.menu;\r\n menu.clear();\r\n picker = Ti.UI.createPicker();\r\n data.push(\r\n Ti.UI.createPickerRow({\r\n title: 'Live',\r\n value: 'live'\r\n }));\r\n data.push(\r\n Ti.UI.createPickerRow({\r\n title: 'Ended',\r\n value: 'buyingended'\r\n }));\r\n picker.add(data);\r\n picker.addEventListener('change', pickLiveEnded);\r\n item = menu.add({\r\n title: \"Live\",\r\n showAsAction: Ti.Android.SHOW_AS_ACTION_ALWAYS\r\n });\r\n item.actionView = picker;\r\n picker.setSelectedRow(0, Alloy.Globals.selectedAuctionsPickerRow, false); // column, row, [animated]\r\n settings = menu.add({\r\n icon: '/images/gear.png',\r\n showAsAction: Ti.Android.SHOW_AS_ACTION_ALWAYS\r\n });\r\n settings.addEventListener('click', function () {\r\n Alloy.createController('account').getView().open({\r\n modal: true\r\n });\r\n });\r\n };\r\n activity.invalidateOptionsMenu();\r\n});\r\n{code}\r\n\r\nEdit: I added a graphic showing how it's supposed to look on launch, with picker collapsed. (I deleted the app name & icon from this new graphic.)", "attachment": [ { "id": "55719", "filename": "acv_main.png", "author": { "name": "timpoulsen", "key": "timpoulsen", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/Havana" }, "created": "2015-06-03T18:04:44.000+0000", "size": 67752, "mimeType": "image/png" }, { "id": "55718", "filename": "device-2015-06-01-163837.png", "author": { "name": "timpoulsen", "key": "timpoulsen", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/Havana" }, "created": "2015-06-03T17:50:13.000+0000", "size": 72358, "mimeType": "image/png" }, { "id": "56139", "filename": "picker expanded.png", "author": { "name": "timpoulsen", "key": "timpoulsen", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/Havana" }, "created": "2015-07-09T19:21:20.000+0000", "size": 35887, "mimeType": "image/png" } ], "flagged": false, "summary": "Android: Picker in ActionBar shown expanded on app launch with SDK 4.0.1, 4.1.0.GA", "creator": { "name": "timpoulsen", "key": "timpoulsen", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/Havana" }, "subtasks": [], "reporter": { "name": "timpoulsen", "key": "timpoulsen", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/Havana" }, "environment": "CLI 4.0.1\r\nSDK 4.0.1, 4.1.0.GA", "closedSprints": [ { "id": 451, "state": "closed", "name": "2015 Sprint 16 SDK", "startDate": "2015-08-01T00:30:05.052Z", "endDate": "2015-08-15T00:30:00.000Z", "completeDate": "2015-08-17T05:55:00.386Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "357379", "author": { "name": "timpoulsen", "key": "timpoulsen", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/Havana" }, "body": "Testing today with the new 4.1.0.GA release, the behavior is even worse. The picker now briefly appears in the top-left corner of the screen, after which it jumps to the correct locations. It remains expanded.\r\n\r\nSee https://goo.gl/photos/d1VeZe18LDiFohR26 \r\n\r\nIt should be rendered closed, and in the correct location.", "updateAuthor": { "name": "timpoulsen", "key": "timpoulsen", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/Havana" }, "created": "2015-07-09T19:22:21.000+0000", "updated": "2015-07-09T19:22:21.000+0000" }, { "id": "357381", "author": { "name": "timpoulsen", "key": "timpoulsen", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/Havana" }, "body": "Also: tap the picker, choose an option and the picker remains open. It should close after the user selects one of the items.", "updateAuthor": { "name": "timpoulsen", "key": "timpoulsen", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/Havana" }, "created": "2015-07-09T19:32:31.000+0000", "updated": "2015-07-09T19:32:31.000+0000" }, { "id": "358183", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-07-23T03:49:52.000+0000", "updated": "2015-07-23T03:49:52.000+0000" }, { "id": "358198", "author": { "name": "timpoulsen", "key": "timpoulsen", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/Havana" }, "body": "The code below demonstrates the biggest of the problems: the picker is drawn expanded in the top left corner when you open the app and each time you switch between tabs. However it does not jump into its proper location as my video above shows. Neither does the picker remain open in this sample. Some difference between our app's code and this example is probably the reason. \r\n\r\n{code}\r\n// this sets the background color of the master UIView (when there are no windows/tab groups on it)\r\nTitanium.UI.setBackgroundColor('#000');\r\n\r\n// create tab group\r\nvar tabGroup = Titanium.UI.createTabGroup();\r\n\r\n\r\n//\r\n// create base UI tab and root window\r\n//\r\nvar win1 = Titanium.UI.createWindow({ \r\n title:'Fruit',\r\n backgroundColor:'#fff'\r\n});\r\nvar tab1 = Titanium.UI.createTab({ \r\n icon:'KS_nav_views.png',\r\n title:'Fruit',\r\n window:win1\r\n});\r\n\r\nvar label1 = Titanium.UI.createLabel({\r\n\tcolor:'#999',\r\n\ttext:'Pick a fruit',\r\n\tfont:{fontSize:20,fontFamily:'Helvetica Neue'},\r\n\ttextAlign:'center',\r\n\twidth:'auto'\r\n});\r\n\r\nwin1.add(label1);\r\n\r\n//\r\n// create controls tab and root window\r\n//\r\nvar win2 = Titanium.UI.createWindow({ \r\n title:'Veggies',\r\n backgroundColor:'#fff'\r\n});\r\nvar tab2 = Titanium.UI.createTab({ \r\n icon:'KS_nav_ui.png',\r\n title:'Veggies',\r\n window:win2\r\n});\r\n\r\nvar label2 = Titanium.UI.createLabel({\r\n\tcolor:'#999',\r\n\ttext:'Pick a veggie',\r\n\tfont:{fontSize:20,fontFamily:'Helvetica Neue'},\r\n\ttextAlign:'center',\r\n\twidth:'auto'\r\n});\r\n\r\nwin2.add(label2);\r\n\r\n\r\n\r\n//\r\n// add tabs\r\n//\r\ntabGroup.addTab(tab1); \r\ntabGroup.addTab(tab2); \r\n\r\n\r\n/*\r\n\tCode below adds a picker to the ActionBar with different options\r\n\tfor each tab. In order to have different picker options on each\r\n\ttab, the picker is redrawn when you switch tabs but it maintains \r\n\tthe selection you chose previously.\r\n*/\r\nvar activeTab = 0,\r\n\tselectedPickerRow = {\r\n\t\ttab0: 0,\r\n\t\ttab1: 0\r\n\t};\r\nfunction doPickerChange(e) {\r\n\tif(activeTab === 0) {\r\n\t\tselectedPickerRow.tab0 = e.rowIndex;\r\n\t\tlabel1.text = 'You chose: ' + ((e.rowIndex) ? 'Banana' : 'Apple');\r\n\t} else {\r\n\t\tselectedPickerRow.tab1 = e.rowIndex;\r\n\t\tlabel2.text = 'You chose: ' + ((e.rowIndex) ? 'Beans' : 'Corn');\r\n\t}\r\n}\r\n\r\ntabGroup.addEventListener(\"open\", function () {\r\n\tvar activity = tabGroup.getActivity();\r\n\tactivity.onCreateOptionsMenu = function (e) {\r\n\t\tvar item, \r\n\t\t\tsettings,\r\n\t\t\tdata = [],\r\n\t\t\tmenu = e.menu, \r\n\t\t\tpicker = Ti.UI.createPicker();\r\n\t\tmenu.clear();\r\n\t\tif (activeTab === 0) {\r\n\t\t\tdata.push(\r\n\t\t\t\tTi.UI.createPickerRow({\r\n\t\t\t\t\ttitle: 'Apple',\r\n\t\t\t\t\tvalue: '0'\r\n\t\t\t\t}));\r\n\t\t\tdata.push(\r\n\t\t\t\tTi.UI.createPickerRow({\r\n\t\t\t\t\ttitle: 'Banana',\r\n\t\t\t\t\tvalue: '1'\r\n\t\t\t\t}));\r\n\t\t\tpicker.add(data);\r\n\t\t\tpicker.addEventListener('change', doPickerChange);\r\n\t\t\titem = menu.add({\r\n\t\t\t\ttitle: \"Apple\",\r\n\t\t\t\tshowAsAction: Ti.Android.SHOW_AS_ACTION_ALWAYS\r\n\t\t\t});\r\n\t\t\titem.actionView = picker;\r\n\t\t\tpicker.setSelectedRow(0, selectedPickerRow.tab0, false); // column, row, [animated]\r\n\t\t} else {\r\n\t\t\tdata.push(\r\n\t\t\t\tTi.UI.createPickerRow({\r\n\t\t\t\t\ttitle: 'Corn',\r\n\t\t\t\t\tvalue: '0'\r\n\t\t\t\t}));\r\n\t\t\tdata.push(\r\n\t\t\t\tTi.UI.createPickerRow({\r\n\t\t\t\t\ttitle: 'Beans',\r\n\t\t\t\t\tvalue: '1'\r\n\t\t\t\t}));\r\n\t\t\tpicker.add(data);\r\n\t\t\tpicker.addEventListener('change', doPickerChange);\r\n\t\t\titem = menu.add({\r\n\t\t\t\ttitle: \"Corn\",\r\n\t\t\t\tshowAsAction: Ti.Android.SHOW_AS_ACTION_ALWAYS\r\n\t\t\t});\r\n\t\t\titem.actionView = picker;\r\n\t\t\tpicker.setSelectedRow(0, selectedPickerRow.tab1, false); // column, row, [animated]\r\n\t\t}\r\n\t};\r\n\tactivity.invalidateOptionsMenu();\r\n});\r\n\r\nfunction redrawMenu() {\r\n\tvar activity = tabGroup.getActivity();\r\n\tactivity.invalidateOptionsMenu();\r\n}\r\ntabGroup.addEventListener(\"focus\", function (e) {\r\n\tactiveTab = e.index;\r\n\tredrawMenu();\r\n});\r\n\r\n\r\n// open tab group\r\ntabGroup.open();\r\n{code}\r\n\r\nWhen selecting a picker row with {{picker.setSelectedRow()}}, the picker should not be expanded. The row title of the selected row should be shown in the collapsed picker. Alternatively, if that can't be done, there should be a separate option to select the row without expanding the picker.", "updateAuthor": { "name": "timpoulsen", "key": "timpoulsen", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/Havana" }, "created": "2015-07-23T14:05:46.000+0000", "updated": "2015-07-23T14:05:46.000+0000" }, { "id": "358229", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "So the issue right now is that the {{picker.setSelectedRow()}} is also expanding the picker.\r\n\r\nWill look into separating or solving the selection of a picker and the expanding of the picker.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-07-24T02:10:41.000+0000", "updated": "2015-07-24T02:10:41.000+0000" }, { "id": "358230", "author": { "name": "timpoulsen", "key": "timpoulsen", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/Havana" }, "body": "And the picker is rendered in the top-left corner of the screen... !https://dl.dropboxusercontent.com/u/5989721/device-2015-07-23-222843.png!", "updateAuthor": { "name": "timpoulsen", "key": "timpoulsen", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/Havana" }, "created": "2015-07-24T02:33:00.000+0000", "updated": "2015-07-24T02:33:00.000+0000" }, { "id": "358231", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "I'm testing it with a Nexus 9 running 5.1.1. I don't see that. \r\nMay I know which version of Android and device you are using?", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-07-24T02:37:03.000+0000", "updated": "2015-07-24T02:37:03.000+0000" }, { "id": "358234", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "PR: https://github.com/appcelerator/titanium_mobile/pull/6982\r\nThis PR is to fix the expanded picker on selection issue.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-07-24T04:05:54.000+0000", "updated": "2015-07-24T04:05:54.000+0000" }, { "id": "358252", "author": { "name": "timpoulsen", "key": "timpoulsen", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/Havana" }, "body": "The screenshot I posted above was taken on a Galaxy Nexus running 4.2.2. While the picker is expanded on my S5 running 5.0, it's in the correct location. So, maybe showing the picker in the top-left on my GNex has something to do with AppCompat or the Titanium theme?? I haven't tested your PR yet, so these comments are based on 4.0.0.GA.", "updateAuthor": { "name": "timpoulsen", "key": "timpoulsen", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/Havana" }, "created": "2015-07-24T13:15:34.000+0000", "updated": "2015-07-24T13:15:34.000+0000" }, { "id": "360265", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified the fix.\r\n\r\nThe picker on the actionbar does not appear expanded & also does not appear on the left side on android 4.2.2.\r\n\r\nClosing.\r\n\r\nEnvironment:\r\nAppc Studio : 4.2.0.201508062204\r\nTi SDK : 5.0.0.v20150818082827\r\nTi CLI : 4.1.4\r\nAlloy : 1.6.2\r\nMAC Yosemite : 10.10.4\r\nAppc NPM : 4.1.0\r\nAppc CLI : 4.2.0-57\r\nNode: v0.10.37\r\nOne plus One - Android 5.0.1\r\nAndroid Emulator : Android 4.2.2\r\nNode : v0.10.37", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-08-18T22:51:53.000+0000", "updated": "2015-08-18T22:51:53.000+0000" } ], "maxResults": 10, "total": 10, "startAt": 0 } } }