Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24344] Android: hdpi is mapped to incorrect value 213 in DisplayCapsProxy.java

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionFixed
Resolution Date2017-02-07T01:40:12.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.1.0
ComponentsAndroid
Labelsn/a
ReporterShuo Liang
AssigneeGary Mathews
Created2017-01-25T02:12:01.000+0000
Updated2017-02-09T22:46:26.000+0000

Description

DisplayCapsProxy.getDensity() maps DisplayMetrics.densityDpi to density strings. The value of 213 is incorrectly mapped to "high". In google's android docs, 213 is "tvdpi", not "hdpi". This can cause layout errors in cases where we have to explicitly deal with pixels and you are using getDensity() to determine the ratio of dp to px. For example, the ScrollView.scrollTo() function requires values in pixels. To get pixels, we have to convert dp to px, and we use the density strings to perform this conversion. If we get the value "high", we multiply by 1.5. But on a device that has a densityDpi of 213, we should be using 1.33 instead. We need a different value for density on devices that use tvdpi, like the LG G Pad 8.0 LG-V480.

Comments

  1. Gary Mathews 2017-01-31

    master: https://github.com/appcelerator/titanium_mobile/pull/8808
  2. Lokesh Choudhary 2017-02-09

    Verified the fix is present in SDK 6.1.0.v20170209111025. Closing.

JSON Source