Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18767] Android: displayCaps.density returns "medium" on "xxxhigh" devices

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2015-04-14T23:53:15.000+0000
Affected Version/sRelease 3.5.1, Release 4.0.0
Fix Version/sRelease 4.0.0, Release 4.0.2
ComponentsAndroid
Labelsn/a
ReporterFokke Zandbergen
AssigneeHieu Pham
Created2015-03-30T07:32:37.000+0000
Updated2015-04-28T23:57:38.000+0000

Description

Ti.Platform.displayCaps.density returns medium when the device is xxxhigh because the [code](https://github.com/appcelerator/titanium_mobile/blob/master/android/modules/platform/src/java/ti/modules/titanium/platform/DisplayCapsProxy.java#L61-L80) doesn't check for 640 dpi and defaults to medium. Perhaps the logic could be made more future proof by defaulting to the highest if the dpi is > then the highest on record?

Comments

  1. Fokke Zandbergen 2015-03-30

    PR on master: https://github.com/appcelerator/titanium_mobile/pull/6754
  2. Ingo Muschenetz 2015-03-30

    Unsure if duplicate or just related.
  3. Fokke Zandbergen 2015-03-30

    Yes, indeed TIMOB-18083 is the symptom of this issue.
  4. Fokke Zandbergen 2015-03-30

    I have closed the other one as this has the PR and describes the actual problem.
  5. Hieu Pham 2015-04-10

    master PR: https://github.com/appcelerator/titanium_mobile/pull/6776
  6. Fokke Zandbergen 2015-04-15

    [~hpham] shouldn't 213 return tv and 280, 400 and 560 that same number so we follow the mapping of the constants on http://developer.android.com/reference/android/util/DisplayMetrics.html?
  7. Fokke Zandbergen 2015-04-16

    Ah, now I see. That matches the behaviour I saw in https://university.appcelerator.com/video/o2EhzZhe/Working-with-densityspecific-images where it selected the high (indeed not xhigh) image when I ran Genymotion at 213.
  8. Hieu Pham 2015-04-17

    Fix a typo for TV density master PR: https://github.com/appcelerator/titanium_mobile/pull/6788
  9. Ewan Harris 2015-04-28

    Verified using Mac OSX 10.10.3 Appc Studio: 4.0.0.201504272049 Titanium SDK build: 4.0.0.v20150427093413 Appc CLI (NPM): 0.3.51 Appc CLI (Registry): 0.2.273 Nexus 6 (5.0.1) Ti.Platform.displayCaps.density now returns xxxhigh on xxxhigh devices, Closing ticket.

JSON Source