{ "id": "64044", "key": "TIMOB-3412", "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": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2017-06-08T23:29:21.000+0000", "created": "2011-04-15T03:44:00.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "android", "defect", "reported-1.6.0" ], "versions": [], "issuelinks": [], "assignee": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-06-08T23:29: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": "{html}

Given a native android project (non-titanium) with the\nfollowing:

\n\n
\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"fill_parent\" \n    android:layout_height=\"fill_parent\" \n    android:orientation=\"vertical\" >\n<ImageView \n    android:src=\"@drawable/test\" \n    android:id=\"@+id/iv\" \n    android:layout_width=\"wrap_content\" \n    android:layout_height=\"wrap_content\"\n/>\n</LinearLayout>\n
\n\n

When rendered, the image view will be 75 x 75 pixels (50 * 1.5),\nbecause the graphic file was in the mdpi (medium\ndensity) drawable folder and the device is a high density device,\nso Android automatically scales it up.

\n
\n

Given a Titanium project with the\nfollowing:

\n\n
\nTitanium.UI.setBackgroundColor('#000');\nvar win = Titanium.UI.createWindow({  \n    title:'Test',\n    backgroundColor:'#000',\n    exitOnClose: true\n});\n\nvar iv = Ti.UI.createImageView({\n    left: 0, top: 0, height: 'auto', width: 'auto',\n    image: Ti.App.Android.R.drawable.test\n});\nwin.add(iv);\n\nvar btn = Ti.UI.createButton({\n    top: '50%', height: 'auto', width: 'auto', left: 0,\n    title: 'Get dimensions'\n});\nbtn.addEventListener('click', function(){\n    var size = iv.size;\n    Ti.API.info(\"ImageView dimensions: \" + size.width + \"x\" + size.height);\n});\nwin.add(btn);\nwin.open();\n
\n

When run, and when clicking the \"Get dimensions\" button, the\nlogcat output will show that the rendered width and height remain\nat 50x50, so the image was not scaled up\nautomatically. I believe it should have been.

\n

Expected outcome: The logcat output from the\nabove Titanium project should show \"ImageView dimensions:\n75x75\".

{html}", "attachment": [], "flagged": false, "summary": "Android: Auto width/height resource drawables should be sized as they are in native Android", "creator": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "comment": { "comments": [ { "id": "130660", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "{html}

The reason: TiDrawableReference (responsible for fetching and\nscaling images), when it gets images that are resource drawables,\nuses Resources.openRawResource() and checks the bounds of that raw\ndrawable -- which are 50x50. It doesn't know where the resource\ncomes from (i.e., from which drawable-?dpi resource folder it comes\nfrom), so even if it tried to scale it (which it doesn't even try),\nit wouldn't know whether it should scale it and by how much to\nscale it.

{html}", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T03:44:00.000+0000", "updated": "2011-04-15T03:44:00.000+0000" }, { "id": "421578", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as there has been no input for the last 6 years. Any problems, please file a new ticket.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-06-08T23:29:21.000+0000", "updated": "2017-06-08T23:29:21.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }