{ "id": "172744", "key": "TIMOB-26853", "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": [], "resolution": { "id": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2021-04-27T22:36:30.000+0000", "created": "2018-12-14T07:54:21.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [], "versions": [], "issuelinks": [ { "id": "59258", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "outwardIssue": { "id": "165312", "key": "TIMOB-24313", "fields": { "summary": "TiAPI: Add \"scalingMode\" property to Ti.UI.ImageView", "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": "Medium", "id": "3" }, "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false } } } } ], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2021-04-27T22:36:30.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": [], "description": "For Android platform, currently Ti ImageView automatically calculates the ScaleType based on the defined width-height properties in *updateScaleType* method.\r\n\r\nBut many times we need the support to define scale types ourselves including the other scale-types as well like *CENTER_CROP / FIT_END / FIT_START / MATRIX*.\r\n\r\n*CENTER_CROP* is needed more than other scale-types in most of the apps.\r\n\r\nIt would also be awesome to have same support on iOS for scale-types if it's possible natively.", "attachment": [], "flagged": false, "summary": "Add ScaleType support for ImageView", "creator": { "name": "prashant_saini", "key": "prashant_saini", "displayName": "Prashant Saini", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "prashant_saini", "key": "prashant_saini", "displayName": "Prashant Saini", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "445488", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello [~prashant_saini], Please share the native docs on this feature. We will consider it. Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2019-01-19T13:39:15.000+0000", "updated": "2019-01-19T13:39:15.000+0000" }, { "id": "445492", "author": { "name": "prashant_saini", "key": "prashant_saini", "displayName": "Prashant Saini", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Here's the sample code from the Hyperloop which works as expected. You just need to put any *wheel.png* file in *android - res - drawable* folder.\r\n\r\n\r\n\r\n{noformat}\r\n\r\n\r\nvar Activity = require('android.app.Activity');\r\nvar ImageView = require('android.widget.ImageView');\r\nvar LayoutParams = require('android.widget.FrameLayout.LayoutParams');\r\nvar ViewGroupLayoutParams = require('android.view.ViewGroup.LayoutParams');\r\nvar nativeImageView;\r\n\r\nvar i = 0;\r\nvar scaleTypes = [\r\n ImageView.ScaleType.CENTER_CROP,\r\n ImageView.ScaleType.CENTER_INSIDE,\r\n ImageView.ScaleType.FIT_CENTER,\r\n ImageView.ScaleType.FIT_END,\r\n ImageView.ScaleType.FIT_START,\r\n ImageView.ScaleType.FIT_XY,\r\n ImageView.ScaleType.MATRIX\r\n];\r\n\r\n// rotate through the scale-types\r\nfunction changeScaleType(e){\r\n if (i > (scaleTypes.length - 1)) {\r\n i = 0;\r\n }\r\n\r\n nativeImageView.setScaleType(scaleTypes[i]);\r\n ++i;\r\n}\r\n\r\nvar win = Ti.UI.createWindow({backgroundColor : 'white'});\r\nvar view = Ti.UI.createView({\r\n top : 20,\r\n width : 450,\r\n height : 300,\r\n backgroundColor : '#888'\r\n}); \r\nvar btn = Ti.UI.createButton({\r\n title : 'Change Scale Type',\r\n bottom : 40\r\n});\r\n\r\nwin.addEventListener('open', function() {\r\n var act = new Activity(Ti.Android.currentActivity);\r\n var nativeImageView = new ImageView(act);\r\n var params = new LayoutParams(ViewGroupLayoutParams.MATCH_PARENT, ViewGroupLayoutParams.MATCH_PARENT);\r\n (params != null) && nativeImageView.setLayoutParams(params);\r\n nativeImageView.setImageResource(Ti.App.Android.R.drawable.wheel);\r\n\r\n view.add(nativeImageView);\r\n btn.addEventListener('click', changeScaleType);\r\n});\r\n\r\nwin.add(btn);\r\nwin.add(view);\r\nwin.open();\r\n\r\n\r\n{noformat}\r\n", "updateAuthor": { "name": "prashant_saini", "key": "prashant_saini", "displayName": "Prashant Saini", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-01-19T17:47:14.000+0000", "updated": "2019-01-19T17:47:14.000+0000" }, { "id": "445493", "author": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "body": "As a starting point you could have a look at the old (closed) PR: https://github.com/appcelerator/titanium_mobile/pull/8755\r\nIt only adds {{aspectFill}} but could be extended to accept all other options", "updateAuthor": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "created": "2019-01-19T18:02:20.000+0000", "updated": "2019-01-19T18:02:20.000+0000" }, { "id": "445798", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello [~prashant_saini], Can you please follow up Michael's comment. You should follow up in there. Since we already have a ticket in TIMOB for aspectFill, I believe we could extend to accept other options. If the request is excepted there. we can close this one. Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2019-02-01T15:03:04.000+0000", "updated": "2019-02-01T15:03:04.000+0000" }, { "id": "446035", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello [~prashant_saini], I see you haven't followed up in the TIMOB-24313 ticket. Can you please do that. I think we can extend the options presented there. Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2019-02-12T22:22:25.000+0000", "updated": "2019-02-12T22:22:25.000+0000" }, { "id": "458630", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing as duplicate of [TIMOB-24313].", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2021-04-27T22:36:21.000+0000", "updated": "2021-04-27T22:36:21.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }