{ "id": "127307", "key": "TIMOB-16599", "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": [], "resolution": null, "resolutiondate": null, "created": "2014-03-06T14:36:16.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "api", "broken" ], "versions": [ { "id": "15856", "description": "Release 3.2.1", "name": "Release 3.2.1", "archived": false, "released": true, "releaseDate": "2014-02-10" } ], "issuelinks": [ { "id": "35757", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "87096", "key": "TIMOB-7880", "fields": { "summary": "Android: showTimePickerDialog() is broken in 1.8.1", "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": null, "updated": "2018-02-28T20:03:19.000+0000", "status": { "description": "This issue was once resolved, but the resolution was deemed incorrect. From here issues are either marked assigned or resolved.", "name": "Reopened", "id": "4", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "So, the issue is that showTimePickerDialog does nothing when I call it and it throws no errors.\r\n\r\nshowDatePickerDialog works as expected.\r\n\r\nAnd here's the code ->\r\n\r\n{code:xml|title=addJob.xml}\r\n\r\n\t\r\n \r\n \r\n \r\n \r\n\t\r\n\r\n{code}\r\n\r\n{code:javascript|title=addJob.js}\r\nvar window = $.getView();\r\n\r\nif (Ti.UI.Android){\r\n\twindow.windowSoftInputMode = Ti.UI.Android.SOFT_INPUT_ADJUST_PAN;\r\n}\r\n\r\nvar datePickerController = Alloy.createController('fields/datePickerDialog');\r\nvar startTimePickerController = Alloy.createController('fields/timePickerDialog');\r\n\r\nfunction openDatePicker(e){\r\n\tdatePickerController.showForTextField(e.source);\r\n}\r\n\r\nfunction openStartTimePicker(e){\r\n\tstartTimePickerController.showForTextField(e.source);\r\n}\r\n{code}\r\n\r\n{code:xml|title=fields/timePickerDialog.xml}\r\n\r\n \r\n\r\n{code}\r\n\r\n{code:javascript|title=fields/timePickerDialog.js}\r\nvar args = arguments[0] || null;\r\n\r\nvar timePicker = $.getView();\r\n\r\nif(args){\r\n\ttimePicker.applyProperties(args);\r\n}\r\n\r\nfunction showForTextField(textField, opts){\r\n\r\n\topts = opts || {};\r\n\r\n\topts.callback = function(e) {\r\n\t\tif(!e.cancel) {\r\n\t\t\tvar timeValue = e.value;\r\n\t\t\ttextField.value = timeValue.getHours() + ':' + timeValue.getMinutes();\r\n\t\t\ttextField.blur();\r\n\t\t}\r\n\t};\r\n\r\n\ttimePicker.showTimePickerDialog(opts);\r\n}\r\n\r\nexports.showForTextField = showForTextField;\r\n{code}\r\n\r\n{code:xml|title=fields/datePickerDialog.xml}\r\n\r\n \r\n\r\n{code}\r\n\r\n{code:javascript|title=fields/datePickerDialog.js}\r\nvar args = arguments[0] || null;\r\n\r\nvar datePicker = $.getView();\r\n\r\nif(args){\r\n\tdatePicker.applyProperties(args);\r\n}\r\n\r\nfunction showForTextField(textField, opts){\r\n\r\n\topts = opts || {};\r\n\r\n\topts.callback = function(e) {\r\n\t\tif(!e.cancel) {\r\n\t\t\tvar dateValue = e.value;\r\n\t\t\ttextField.value = dateValue.getDate() + '/'\r\n\t\t\t\t+ (dateValue.getMonth() + 1) + '/'\r\n\t\t\t\t+ dateValue.getFullYear();\r\n\t\t\ttextField.blur();\r\n\t\t}\r\n\t};\r\n\r\n\tdatePicker.showDatePickerDialog(opts);\r\n}\r\n\r\nexports.showForTextField = showForTextField;\r\n{code}", "attachment": [], "flagged": false, "summary": "Android: showTimePickerDialog doesn't work", "creator": { "name": "lsdriscoll", "key": "lsdriscoll", "displayName": "Lee Driscoll", "active": true, "timeZone": "Europe/London" }, "subtasks": [], "reporter": { "name": "lsdriscoll", "key": "lsdriscoll", "displayName": "Lee Driscoll", "active": true, "timeZone": "Europe/London" }, "environment": "OS: Debian 7 64bit\r\nDevice: Nexus 5\r\nTi: 3.2.1 GA\r\n", "comment": { "comments": [ { "id": "296268", "author": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Moving this ticket to engineering as I can reproduce the issue with the following test case. Note that this appears to be a duplicate of TIMOB-7880 but I did not want to reopen such an old ticket.\n\n{code}\nTi.UI.backgroundColor = 'white';\nvar win = Ti.UI.createWindow({\n exitOnClose: true,\n layout: 'vertical'\n});\n \nvar picker = Ti.UI.createPicker({\n type: Ti.UI.PICKER_TYPE_TIME\n});\n \nwin.open();\n \nfunction callbackFunction(e) \n{\n if (e.cancel) {\n Ti.API.info('User canceled dialog');\n } else {\n Ti.API.info('User selected time: ' + e.value);\n }\n}\n \npicker.showTimePickerDialog({\n format24: true,\n title: \"Current Time\",\n callback: callbackFunction\n});\n{code}", "updateAuthor": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-03-10T07:03:00.000+0000", "updated": "2014-03-10T07:03:00.000+0000" }, { "id": "296961", "author": { "name": "bijuexalture", "key": "bijuexalture", "displayName": "Biju pm", "active": true, "timeZone": "Asia/Kolkata" }, "body": " {code}\r\nTi.UI.backgroundColor = 'white';\r\nvar win = Ti.UI.createWindow({\r\n exitOnClose: true,\r\n layout: 'vertical'\r\n});\r\n \r\nwin.addEventListener(\"open\",function(){\r\n \r\n \r\nvar picker = Ti.UI.createPicker({\r\n type: Ti.UI.PICKER_TYPE_TIME\r\n});\r\n picker.showTimePickerDialog({\r\n format24: true,\r\n title: \"Current Time\",\r\n callback : callbackFunction\r\n});\r\n });\r\n \r\nwin.open(); \r\nfunction callbackFunction(e) \r\n{\r\n if (e.cancel) {\r\n alert('User canceled dialog');\r\n } else {\r\n alert('User selected time: ' + e.value);\r\n }\r\n}\r\n\r\n {code}", "updateAuthor": { "name": "bijuexalture", "key": "bijuexalture", "displayName": "Biju pm", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2014-03-13T09:32:48.000+0000", "updated": "2014-03-13T09:32:48.000+0000" }, { "id": "296974", "author": { "name": "lsdriscoll", "key": "lsdriscoll", "displayName": "Lee Driscoll", "active": true, "timeZone": "Europe/London" }, "body": "What's the resolution here?\r\n\r\nThe ticket's been closed but nothing's been done.", "updateAuthor": { "name": "lsdriscoll", "key": "lsdriscoll", "displayName": "Lee Driscoll", "active": true, "timeZone": "Europe/London" }, "created": "2014-03-13T10:54:25.000+0000", "updated": "2014-03-13T10:54:25.000+0000" }, { "id": "296975", "author": { "name": "bijuexalture", "key": "bijuexalture", "displayName": "Biju pm", "active": true, "timeZone": "Asia/Kolkata" }, "body": "for avoiding this bug .We can use the above TestCase.\nReason of this bug is creation of activity . \nwe can call showTimePickerDialog only after window opened\n ", "updateAuthor": { "name": "bijuexalture", "key": "bijuexalture", "displayName": "Biju pm", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2014-03-13T11:08:10.000+0000", "updated": "2014-03-13T11:08:10.000+0000" }, { "id": "296976", "author": { "name": "lsdriscoll", "key": "lsdriscoll", "displayName": "Lee Driscoll", "active": true, "timeZone": "Europe/London" }, "body": "but the example you posted calls showTimePickerDialog BEFORE the window has opened.", "updateAuthor": { "name": "lsdriscoll", "key": "lsdriscoll", "displayName": "Lee Driscoll", "active": true, "timeZone": "Europe/London" }, "created": "2014-03-13T11:15:54.000+0000", "updated": "2014-03-13T11:15:54.000+0000" }, { "id": "296977", "author": { "name": "bijuexalture", "key": "bijuexalture", "displayName": "Biju pm", "active": true, "timeZone": "Asia/Kolkata" }, "body": "No. thats call inside the window open Listener \n{code}\nwin.addEventListener(\"open\",function(){\n \n \nvar picker = Ti.UI.createPicker({\n type: Ti.UI.PICKER_TYPE_TIME\n});\n picker.showTimePickerDialog({\n format24: true,\n title: \"Current Time\",\n callback : callbackFunction\n});\n });\n{code}\n", "updateAuthor": { "name": "bijuexalture", "key": "bijuexalture", "displayName": "Biju pm", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2014-03-13T11:32:52.000+0000", "updated": "2014-03-13T11:32:52.000+0000" }, { "id": "296978", "author": { "name": "lsdriscoll", "key": "lsdriscoll", "displayName": "Lee Driscoll", "active": true, "timeZone": "Europe/London" }, "body": "My apologies, I was thrown by the indenting.\r\n\r\nTypical usage of this component would be to launch from a click on a text field.\r\n\r\nAs per my original example, the window has been opened and the click event of the showTimePickerDialog fails to work.\r\n\r\nWhilst the code you posted fixes the example post by Ritu, I don't think it could be applied to my example as I'm already opening the window before calling showTimePickerDialog. Perhaps this is an Alloy specific bug.", "updateAuthor": { "name": "lsdriscoll", "key": "lsdriscoll", "displayName": "Lee Driscoll", "active": true, "timeZone": "Europe/London" }, "created": "2014-03-13T12:02:35.000+0000", "updated": "2014-03-13T12:02:35.000+0000" }, { "id": "296979", "author": { "name": "lsdriscoll", "key": "lsdriscoll", "displayName": "Lee Driscoll", "active": true, "timeZone": "Europe/London" }, "body": "Looking further at this, the simplified example posted by Ritu has very little to do with the bug I posted considering that it doesn't use the Alloy framework.", "updateAuthor": { "name": "lsdriscoll", "key": "lsdriscoll", "displayName": "Lee Driscoll", "active": true, "timeZone": "Europe/London" }, "created": "2014-03-13T12:13:14.000+0000", "updated": "2014-03-13T12:13:14.000+0000" }, { "id": "366661", "author": { "name": "cr0ybot", "key": "cr0ybot", "displayName": "Cory Hughart", "active": true, "timeZone": "America/New_York" }, "body": "This is still an issue. Why is this \"low priority\"?\r\n\r\nFor those who land here searching for a workaround, I was able to get the time picker dialog to appear by creating it immediately before using it (in other words, not pre-creating it, then calling it later). This worked for me using SDK 5.0.2.GA.\r\n\r\n{code:javascript}\r\nfunction openTimePicker() {\r\n Ti.API.info('Showing android time picker...');\r\n var timePicker = Ti.UI.createPicker({\r\n type: Ti.UI.PICKER_TYPE_TIME\r\n });\r\n timePicker.showTimePickerDialog({\r\n callback: function (e) {\r\n if (e.cancel) {\r\n Ti.API.info('Time picker cancelled');\r\n activeDateField.blur();\r\n }\r\n else {\r\n activeDateField.value = e.value;\r\n activeDateField.blur();\r\n }\r\n }\r\n });\r\n}\r\n{code}\r\n", "updateAuthor": { "name": "cr0ybot", "key": "cr0ybot", "displayName": "Cory Hughart", "active": true, "timeZone": "America/New_York" }, "created": "2015-10-13T16:10:27.000+0000", "updated": "2015-10-13T16:22:17.000+0000" } ], "maxResults": 10, "total": 10, "startAt": 0 } } }