Export latest Android changes

This commit is contained in:
Martin Konicek
2015-09-17 14:33:23 +01:00
parent 3b4845f93c
commit 27ab039b6a
32 changed files with 685 additions and 792 deletions

View File

@@ -67,6 +67,17 @@ public class CatalystStylesDiffMap {
return mBackingMap.isNull(name) ? restoreNullToDefaultValue : (int) mBackingMap.getDouble(name);
}
// Colors have values between 0x00000000 and 0xFFFFFFFF, which fits in an integer, but is sent as
// a double over the bridge. Because color values can be higher than Integer.MAX_VALUE, it is not
// correct to convert doubles to int directly, since they can be truncated to Integer.MAX_VALUE
// instead of being converted to negative values. Converting from double to long maintains the
// initial value, and is then correctly converted to int. This is the expected behavior according
// to the java spec, see http://stackoverflow.com/questions/10641559 for more.
public int getColorInt(String name, int restoreNullToDefaultValue) {
return mBackingMap.isNull(name) ? restoreNullToDefaultValue :
(int) (long) mBackingMap.getDouble(name);
}
@Nullable
public String getString(String name) {
return mBackingMap.getString(name);