{ "id": "170319", "key": "TIMOB-25515", "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": "17609", "description": "", "name": "Release 7.0.0", "archived": false, "released": true, "releaseDate": "2017-12-07" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2017-11-16T00:50:27.000+0000", "created": "2017-11-15T04:25:23.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "android", "scrollview" ], "versions": [ { "id": "17608", "name": "Release 6.1.0", "archived": false, "released": true, "releaseDate": "2017-05-26" } ], "issuelinks": [], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-11-16T01:56:21.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": "*Summary:*\r\nThe Android ScrollView.scrollTo() method always operates in pixels when set up to be animated. Meaning that it ignores the \"ti.ui.defaultunit\" property's configured units (such as \"dp\") in the \"tiapp.xml\" file.\r\n\r\nNote that ScrollView.scrollTo() when not set up to animated does respect the \"ti.ui.defaultunit\" property.\r\n\r\n*Steps to reproduce:*\r\n\r\n# Open your project's \"tiapp.xml\" file.\r\n# Add a \"ti.ui.defaultunit\" property set to \"dp\" as shown below.\r\n# Create an \"app.js\" file using the below code.\r\n# Build and run the app on Android.\r\n# Tap the \"Scroll to Middle\" button.\r\n\r\n{code:xml}\r\n\r\n\r\n\tdp\r\n\r\n{code}\r\n\r\n{code:javascript}\r\nvar window = Ti.UI.createWindow();\r\nvar scrollView = Ti.UI.createScrollView(\r\n{\r\n\tlayout: \"vertical\",\r\n\tscrollType: \"vertical\",\r\n\tshowHorizontalScrollIndicator: false,\r\n\tshorVerticalScrollIndicator: true,\r\n\twidth: Ti.UI.FILL,\r\n\theight: Ti.UI.FILL,\r\n});\r\nvar firstView = Ti.UI.createLabel(\r\n{\r\n\ttext: \"First View\",\r\n\ttextAlign: Ti.UI.TEXT_ALIGNMENT_CENTER,\r\n\tcolor: \"white\",\r\n\tbackgroundColor: \"blue\",\r\n\tborderColor: \"white\",\r\n\tborderWidth: \"1dp\",\r\n\twidth: \"100%\",\r\n\theight: \"75%\",\r\n});\r\nscrollView.add(firstView);\r\nvar middleView = Ti.UI.createLabel(\r\n{\r\n\ttext: \"Middle View\",\r\n\ttextAlign: Ti.UI.TEXT_ALIGNMENT_CENTER,\r\n\tcolor: \"white\",\r\n\tbackgroundColor: \"#008800\",\r\n\tborderColor: \"white\",\r\n\tborderWidth: \"1dp\",\r\n\twidth: \"100%\",\r\n\theight: \"75%\",\r\n});\r\nscrollView.add(middleView);\r\nvar lastView = Ti.UI.createLabel(\r\n{\r\n\ttext: \"Last View\",\r\n\ttextAlign: Ti.UI.TEXT_ALIGNMENT_CENTER,\r\n\tcolor: \"white\",\r\n\tbackgroundColor: \"purple\",\r\n\tborderColor: \"white\",\r\n\tborderWidth: \"1dp\",\r\n\twidth: \"100%\",\r\n\theight: \"75%\",\r\n});\r\nscrollView.add(lastView);\r\nwindow.add(scrollView);\r\nvar button = Ti.UI.createButton(\r\n{\r\n\ttitle: \"Scroll to Middle\",\r\n\tbottom: \"10dp\",\r\n\tright: \"10dp\",\r\n});\r\nbutton.addEventListener(\"click\", function(e) {\r\n\tscrollView.scrollTo(0, firstView.size.height, { animated: true });\r\n});\r\nwindow.add(button);\r\nwindow.open();\r\n{code}\r\n\r\n*Result:*\r\nThe top of the \"middle\" view fails to be scrolled to the top of the scroll view.\r\n\r\nThis is because the view's height was returned in \"dp\" units but the scrollTo() method interpretted it as \"pixels\" instead.\r\n\r\n*Expected Result:*\r\nThe scrollTo() method must respect the project's \"ti.ui.defaultunit\" setting.\r\n\r\n*Work-Around:*\r\nThis issue can be worked-around by doing 1 of the following...\r\n* Do not use animated scrolling.\r\n* Set \"ti.ui.defaultunit\" to pixels.\r\n", "attachment": [], "flagged": false, "summary": "Android: ScrollView.scrollTo() ignores \"ti.ui.defaultunit\" when animated", "creator": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "430654", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR (master): https://github.com/appcelerator/titanium_mobile/pull/9601", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-11-15T05:15:57.000+0000", "updated": "2017-11-15T05:15:57.000+0000" }, { "id": "430705", "author": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "body": "FR passed; waiting for CR before merging.", "updateAuthor": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-11-15T10:51:09.000+0000", "updated": "2017-11-15T10:51:09.000+0000" }, { "id": "430765", "author": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR merged.", "updateAuthor": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-11-16T00:50:27.000+0000", "updated": "2017-11-16T00:50:27.000+0000" }, { "id": "430775", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified the fix in SDK 7.0.0.v20171115153702.\r\nClosing.\r\n", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-11-16T01:56:15.000+0000", "updated": "2017-11-16T01:56:15.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }