{ "id": "87674", "key": "TIMOB-7953", "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": "2", "description": "The problem described is an issue which will never be fixed.", "name": "Won't Fix" }, "resolutiondate": "2012-03-13T09:56:32.000+0000", "created": "2012-03-09T17:42:26.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "Parity" ], "versions": [ { "id": "12677", "description": "Release 1.8 Service Pack 1", "name": "Release 1.8.1", "archived": true, "released": true, "releaseDate": "2012-01-31" }, { "id": "13070", "description": "Release 1.8 Service Pack 2", "name": "Release 1.8.2", "archived": true, "released": true, "releaseDate": "2012-02-29" } ], "issuelinks": [], "assignee": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-30T20:41:27.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": "After setting the resolution of the Android Virtual Device to 480x800, the emulator is returning incorrect platformHeight and platformWidth.\r\nh4. Expected Results : 320x533 \r\nThe value that its returning is 480x800 \r\nh4. Repro Steps\r\n\r\n1. Launch the Android AVD Manager by clicking its icon in the Titanium Studio toolbar\r\n2. Select the emulator.\r\n3. Click the 'Start' button. It opens the 'Launch Options' dialog\r\n4. Check the 'Scale display to real size' checkbox. It enables the 'Screen Size' and 'Monitor dpi' options in the middle\r\n5. Click the '?' button right to the 'Monitor dpi' field. It pops up the 'Monitor Density' dialog and enter dpi value 240.\r\n6. Set your current resolution as 480x800. Then click 'OK' button.\r\n7. Launch the emulator from the AVD Manager\r\n8. Go back to Titanium Studio and 'Launch' your app again. It will load into the running emulator. \r\n9. Run the below code and check the values in the console. Log file is also attached.\r\nh4. In android device\r\nh4. Repro Steps\r\n1. Run the below code.\r\n2. In the console the resolution of the screen (pixels) is returned but it should return the values in dp.\r\n{code}\r\nvar win = Ti.UI.createWindow({ \r\n\tbackgroundColor: '#fff'});\r\n\tTi.API.info (Ti.Platform.displayCaps.platformWidth);\r\n\tTi.API.info(Ti.Platform.displayCaps.platformHeight);\r\nwin.open();\r\n\r\n{code}\r\n", "attachment": [ { "id": "26117", "filename": "log.txt", "author": { "name": "nsharma", "key": "nsharma", "displayName": "Nikhil Sharma", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-03-09T17:42:26.000+0000", "size": 760, "mimeType": "text/plain" } ], "flagged": false, "summary": "Android: Device is returning platformWidth and platformHeight values in dp ", "creator": { "name": "nsharma", "key": "nsharma", "displayName": "Nikhil Sharma", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "nsharma", "key": "nsharma", "displayName": "Nikhil Sharma", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Titanium Studio, build: 1.0.9.201202141208\r\nTi SDK 2.0.x CI build\r\nLG Optimus v", "comment": { "comments": [ { "id": "186055", "author": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This looks like expected behavior given sample code...", "updateAuthor": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-03-12T14:01:37.000+0000", "updated": "2012-03-12T14:01:37.000+0000" }, { "id": "186075", "author": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This is expected behavior. getWidth()/Height() will return pixels, not dp. You can use the formula px = dp * (dpi / 160) to convert to dp. DisplayCaps.getDpi() will give you dpi of device/emulator. Closing as invalid.", "updateAuthor": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-03-12T14:17:33.000+0000", "updated": "2012-03-12T14:17:33.000+0000" }, { "id": "186212", "author": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Had a brief discussion regarding the behavior. This is expected, as DIP is the system unit on iOS and PX is the system unit on Android. platformWidth/platformHeight should be seen as system units. Closing as won't fix.\r\n", "updateAuthor": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-03-13T09:56:09.000+0000", "updated": "2012-03-13T09:56:09.000+0000" }, { "id": "186771", "author": { "name": "jpriebe", "key": "jpriebe", "displayName": "Jason Priebe", "active": true, "timeZone": "America/New_York" }, "body": "I have spent a couple of months coding in Ti, and I've been reading a LOT of documentation. I never *once* have seen that iOS and Android have different system units. Please document this thoroughly, both in the guides and the API docs.\r\n\r\nThis is a *fundamental* issue for building mobile UIs.\r\n\r\nA less determined developer than I would have given up and dropped Ti entirely with such a poorly documented API. In fact, if I had wrestled with these UI issues earlier in my proof-of-concept, I would probably not be a paying customer of Appcelerator.", "updateAuthor": { "name": "jpriebe", "key": "jpriebe", "displayName": "Jason Priebe", "active": true, "timeZone": "America/New_York" }, "created": "2012-03-16T03:59:20.000+0000", "updated": "2012-03-16T03:59:20.000+0000" }, { "id": "187667", "author": { "name": "bitshftr", "key": "bitshftr", "displayName": "Shawn Lipscomb", "active": true, "timeZone": "America/New_York" }, "body": "I agree that this should be documented better, but the results of platformWidth and platformHeight are correct.\r\n\r\nOn Android, they return the actual dimensions of the screen. By using dpi, one can calculate the effective dp units, and handle conversions both ways.\r\n\r\nOn iPhone, while I disagree with the fact that both normal and retina-display devices return 320x480, I understand why that's being done. You can check if (Ti.Platform.displayCaps.density == 'high') on the iPhone and know that you have to multiply the results of platformWidth and platformHeight by 2 to get the actual screen dimensions. Sometimes you need the actual number of retina pixels, and sometimes you don't.\r\n", "updateAuthor": { "name": "bitshftr", "key": "bitshftr", "displayName": "Shawn Lipscomb", "active": true, "timeZone": "America/New_York" }, "created": "2012-03-21T08:00:21.000+0000", "updated": "2012-03-21T08:00:21.000+0000" }, { "id": "416370", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as \"Won't Fix\". There has been no update for a number of years. If there is any problem, please open a new ticket.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-30T20:41:27.000+0000", "updated": "2017-03-30T20:41:27.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }