{ "id": "152253", "key": "TIMOB-19763", "fields": { "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "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": "14826", "description": "Release 5.1.0-remaining iOS9 features, Android M features", "name": "Release 5.1.0", "archived": false, "released": true, "releaseDate": "2015-11-20" }, { "id": "16997", "name": "Release 5.2.0", "archived": false, "released": true, "releaseDate": "2016-02-23" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2015-11-04T19:04:26.000+0000", "created": "2015-10-22T14:38:26.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [], "versions": [ { "id": "14826", "description": "Release 5.1.0-remaining iOS9 features, Android M features", "name": "Release 5.1.0", "archived": false, "released": true, "releaseDate": "2015-11-20" } ], "issuelinks": [], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2015-11-06T20:08:19.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "Our current implementation of [Ti.UI.iOS.PreviewContext.preview|https://appcelerator.github.io/appc-docs/latest/#!/api/Titanium.UI.iOS.PreviewContext-property-preview] does not allow you to render a specific preview for a list item / row when used with [ListView.previewContext|https://appcelerator.github.io/appc-docs/latest/#!/api/Titanium.UI.ListView-property-previewContext] or the same property for TableView. This is because the view must be created when you create the previewContext object.\r\n\r\nThe wrapped [UIPreviewAction|https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIPreviewAction_Class/index.html#//apple_ref/occ/instp/UIPreviewAction/handler] has a handler handler to construct the view when it is actually required. It seems like we should make our {{preview}} property a callback as well that receives the section and item index/id and either returns a view directly or via another callback passed to it.", "attachment": [], "flagged": false, "summary": "iOS: Support item-specific peek for previewContext on ListView", "creator": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "subtasks": [], "reporter": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "environment": "SDK 5.1.0", "closedSprints": [ { "id": 517, "state": "closed", "name": "2015 Sprint 22 SDK", "startDate": "2015-10-24T00:30:42.059Z", "endDate": "2015-11-07T01:30:00.000Z", "completeDate": "2015-11-09T02:37:29.441Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "367539", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "This is a known issue. Our architecture currently does not allow us to have a callback as parameter, that returns something. It is related to threading, because the value would be returned in a different thread then we can access it. As soon as that is solved, I will replace {{preview}} as a {{Ti.UI.View}} with something like:\r\n\r\n{code}\r\npreview: function(e) {\r\n var item = list.getItemAt(e.sectionIndex, e.itemIndex);\r\n var imageView = Ti.UI.createImageView({image: item.data.image});\r\n\r\n return imageView;\r\n}\r\n{code}\r\n\r\n[~fokkezb] If you know of any function, that already behaves the same, let me know!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-10-22T15:36:17.000+0000", "updated": "2015-10-22T15:36:17.000+0000" }, { "id": "367560", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Nope, don't think we have such a thing. I guess once we default to running JS on the main thread we could do this.", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2015-10-22T19:36:04.000+0000", "updated": "2015-10-22T19:36:04.000+0000" }, { "id": "368621", "author": { "name": "janvankampen", "key": "janvankampen", "displayName": "Jan van Kampen", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Nasty, nasty hack to display row specific data right now:\r\n\r\n{code:java}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: \"white\"\r\n});\r\n\r\n// The view to be previewed while popping.\r\nvar previewView = Ti.UI.createView({\r\n backgroundColor: \"blue\"\r\n});\r\nvar lbl = Ti.UI.createLabel({\r\n\ttext:'a',\r\n\tcolor:'#ffffff'\r\n});\r\npreviewView.add(lbl);\r\n\r\n// The window to be opened after popping the preview.\r\nvar detailWindow = Ti.UI.createWindow({\r\n backgroundColor: \"yellow\"\r\n});\r\n\r\ndetailWindow.add(Ti.UI.createLabel({\r\n text: \"You made it!\"\r\n}));\r\n\r\n\r\n// Create the preview context\r\nvar context = Ti.UI.iOS.createPreviewContext({\r\n preview: previewView,\r\n contentHeight: 300, // When unspecified, we use the available height\r\n pop: function(e) { // Called after popping the preview\r\n //Something\r\n }\r\n});\r\n\r\n// Assign the preview context\r\nvar table = Ti.UI.createTableView({\r\n previewContext: context, // Will be ignored on unsupported devices\r\n});\r\n\r\n//MAGIC\r\ntable.addEventListener(\"touchstart\", function(e) {\r\n\tlbl.text = e.row.title;\r\n});\r\n\r\n\r\nvar items = [];\r\n\r\nfor(var i = 1; i <= 5; i++) {\r\n items.push(\r\n Ti.UI.createTableViewRow({\r\n \ttitle:i+\"a\"\r\n })\r\n );\r\n}\r\n\r\n\r\ntable.data = items;\r\n\r\nwin.add(table);\r\nwin.open();\r\n{code}", "updateAuthor": { "name": "janvankampen", "key": "janvankampen", "displayName": "Jan van Kampen", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-11-02T12:24:59.000+0000", "updated": "2015-11-02T12:28:12.000+0000" }, { "id": "368635", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Thanks [~janvankampen] - still needs to be fixed soon though ;)", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2015-11-02T14:18:18.000+0000", "updated": "2015-11-02T14:18:18.000+0000" }, { "id": "368854", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "We removed the {{pop}} callback and introduced {{peek}} and {{pop}} events that are fired before displaying the preview and before \"popping\" the view. Also added the {{itemId}} to identifier a {{Ti.UI.ListItem}} directly. This should solve the above problem pretty well.\r\n\r\n*PR master*: https://github.com/appcelerator/titanium_mobile/pull/7388\r\n*PR 5_1_X*: https://github.com/appcelerator/titanium_mobile/pull/7397\r\n\r\n*Demo*:\r\n{code:java}\r\nvar actions = [];\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: \"white\"\r\n});\r\n\r\n// The view to be previewed while popping.\r\nvar previewView = Ti.UI.createView({\r\n backgroundColor: \"blue\"\r\n});\r\n\r\n// The window to be opened after popping the preview.\r\nvar detailWindow = Ti.UI.createWindow({\r\n backgroundColor: \"yellow\"\r\n});\r\n\r\ndetailWindow.add(Ti.UI.createLabel({\r\n text: \"You made it!\"\r\n}));\r\n\r\n// The actions to be added to the preview context.\r\nvar action = Ti.UI.iOS.createPreviewAction({\r\n title: \"Preview Action\",\r\n style: Ti.UI.iOS.PREVIEW_ACTION_STYLE_DEFAULT\r\n});\r\n\r\naction.addEventListener(\"click\", function(e) {\r\n Ti.API.warn(e);\r\n alert(\r\n \"Title: \" + e.title +\r\n \"\\nStyle: \" + e.style +\r\n \"\\nIndex: \" + e.index +\r\n \"\\nSectionIndex: \" + e.sectionIndex +\r\n \"\\nItemIndex: \" + e.itemIndex\r\n );\r\n});\r\n\r\nactions.push(action);\r\n\r\n// Create the preview context\r\nvar context = Ti.UI.iOS.createPreviewContext({\r\n preview: previewView,\r\n actions: actions, // Can have both Ti.UI.iOS.PreviewAction + Ti.UI.iOS.PreviewActionGroup\r\n contentHeight: 300 // When unspecified, we use the available height\r\n});\r\n\r\ncontext.addEventListener(\"peek\", function(e) {\r\n Ti.API.warn(\"Peek\");\r\n Ti.API.warn(e);\r\n});\r\n\r\ncontext.addEventListener(\"pop\", function(e) {\r\n Ti.API.warn(\"Pop\");\r\n Ti.API.warn(e);\r\n});\r\n\r\n// Assign the preview context\r\nvar listView = Ti.UI.createListView({\r\n previewContext: context, // Will be ignored on unsupported devices\r\n});\r\n\r\nvar sections = [];\r\n\r\nfor(var i = 1; i <= 2; i++) {\r\n var items = [];\r\n var section = Ti.UI.createListSection({\r\n headerTitle: \"Section \" + i\r\n });\r\n for(var j = 1; j <= 5; j++) {\r\n items.push({\r\n properties: {\r\n itemId: \"test\" + i + j,\r\n title: \"Cell #\" + j\r\n }\r\n });\r\n }\r\n section.setItems(items);\r\n sections.push(section);\r\n}\r\nlistView.setSections(sections);\r\n\r\nwin.add(listView);\r\nwin.open();\r\n{code}", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-11-03T19:10:14.000+0000", "updated": "2015-11-04T02:45:11.000+0000" }, { "id": "368968", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "[~hansknoechel] Added some comments on the PR here:\r\nhttps://github.com/appcelerator/titanium_mobile/pull/7397\r\n\r\nI've also created an RC version of the 3D Touch sample app (stil have to update the README):\r\nhttps://github.com/appcelerator-developer-relations/appc-sample-3dtouch/tree/RC\r\n\r\nIt works, but with some notes:\r\n\r\n* You can't set the {{preview}} property in the {{peek}} event. You *can* set it after creation so it's not creation-only but we do need to point this out in the API reference.\r\n* If you change the preview view in the {{peek}} event more often then not I can see the previous state of the view before I see my changes. This causes an unpleasant flickering :(", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2015-11-04T11:39:37.000+0000", "updated": "2015-11-04T12:44:05.000+0000" }, { "id": "368985", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~fokkezb] Will adjust the {{creation-only}} key anyway, since it changed and now can be adjusted. The flickering is because the {{peek}} event is fired directly before the preview is shown, so the user might think of a way to animate / handle this right.\r\n\r\nEDIT: The property is not marked as {{creation-only}}, but I added some notes to use this preview.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-11-04T15:41:59.000+0000", "updated": "2015-11-04T16:14:09.000+0000" }, { "id": "369172", "author": { "name": "benutzername", "key": "benutzername", "displayName": "Sebastian Klaus", "active": true, "timeZone": "Europe/Berlin" }, "body": "Works great as always. I have a short questions. When will I get into the \"pop\" event?\r\n\r\nIn the example code, I don't do ever.", "updateAuthor": { "name": "benutzername", "key": "benutzername", "displayName": "Sebastian Klaus", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-11-06T08:42:38.000+0000", "updated": "2015-11-06T08:42:38.000+0000" }, { "id": "369173", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "When you press even harder after seeing the peek", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2015-11-06T08:45:57.000+0000", "updated": "2015-11-06T08:45:57.000+0000" }, { "id": "369174", "author": { "name": "benutzername", "key": "benutzername", "displayName": "Sebastian Klaus", "active": true, "timeZone": "Europe/Berlin" }, "body": "aaahhh.... clear. thanks", "updateAuthor": { "name": "benutzername", "key": "benutzername", "displayName": "Sebastian Klaus", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-11-06T08:46:47.000+0000", "updated": "2015-11-06T08:46:47.000+0000" }, { "id": "369205", "author": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "body": "Verified as fixed, Tested that the implemented features work correctly, using 6S & 6S Plus devices. However I discovered a bug where the app will immediately crash if attempting to use 3D touch on images within the native gallery {{App > Add Picture}}. I have created a separate ticket regarding this issue: \r\n\r\nTIMOB-19888 .\r\n\r\nMac OSX El Capitan 10.11 (15A284) \r\nTi SDK: 5.1.0.v20151104190037 \r\nAppc NPM: 4.2.1 \r\nAppc CLI: 5.1.0-42 \r\nTi CLI: 5.0.4 \r\nAlloy: 1.7.23 \r\nXcode 7.1(7B91b) \r\nNode v0.12.7 \r\nproduction\r\n\r\n*Closing ticket.*", "updateAuthor": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "created": "2015-11-06T20:07:49.000+0000", "updated": "2015-11-06T20:08:00.000+0000" } ], "maxResults": 11, "total": 11, "startAt": 0 } } }