[TIMOB-24344] Android: hdpi is mapped to incorrect value 213 in DisplayCapsProxy.java
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | None |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2017-02-07T01:40:12.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 6.1.0 |
Components | Android |
Labels | n/a |
Reporter | Shuo Liang |
Assignee | Gary Mathews |
Created | 2017-01-25T02:12:01.000+0000 |
Updated | 2017-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.
master: https://github.com/appcelerator/titanium_mobile/pull/8808
Verified the fix is present in SDK 6.1.0.v20170209111025. Closing.