Skip to content

Commit

Permalink
Fixing a bug where a draggable proxy with no initial configuration op…
Browse files Browse the repository at this point in the history
…tions would immediately cause an application to crash. Bumping android version.
  • Loading branch information
animecyc committed Jan 2, 2014
1 parent f7c1c51 commit 1a09396
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 25 deletions.
2 changes: 1 addition & 1 deletion android/manifest
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 2.0.0
version: 2.0.1
apiversion: 2
description: Ti.Draggable
author: Seth Benjamin
Expand Down
38 changes: 14 additions & 24 deletions android/src/ti/draggable/ConfigProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,30 +59,20 @@ public ConfigProxy(KrollDict config)
{
super();

Object[] maps = null;

if (config != null)
{
if (config.containsKeyAndNotNull("maps"))
{
maps = (Object[]) config.get("maps");
}
}

properties.put("enabled", TiConvert.toBoolean(config, "enabled", true));
properties.put("ensureRight", TiConvert.toBoolean(config, "ensureRight", false));
properties.put("ensureBottom", TiConvert.toBoolean(config, "ensureBottom", false));
properties.put("minLeft", config.containsKeyAndNotNull("minLeft") ? TiConvert.toDouble(config, "minLeft") : null);
properties.put("maxLeft", config.containsKeyAndNotNull("minLeft") ? TiConvert.toDouble(config, "maxLeft") : null);
properties.put("minTop", config.containsKeyAndNotNull("minTop") ? TiConvert.toDouble(config, "minTop") : null);
properties.put("maxTop", config.containsKeyAndNotNull("maxTop") ? TiConvert.toDouble(config, "maxTop") : null);
properties.put("axis", config.containsKeyAndNotNull("axis") ? TiConvert.toString(config, "axis") : null);
properties.put("maps", maps);

dimensions.put("minLeft", config.containsKeyAndNotNull("minLeft") ? TiConvert.toTiDimension(config, "minLeft", TiDimension.TYPE_LEFT) : null);
dimensions.put("maxLeft", config.containsKeyAndNotNull("minLeft") ? TiConvert.toTiDimension(config, "maxLeft", TiDimension.TYPE_LEFT) : null);
dimensions.put("minTop", config.containsKeyAndNotNull("minTop") ? TiConvert.toTiDimension(config, "minTop", TiDimension.TYPE_TOP) : null);
dimensions.put("maxTop", config.containsKeyAndNotNull("maxTop") ? TiConvert.toTiDimension(config, "maxTop", TiDimension.TYPE_TOP) : null);
properties.put("enabled", config != null && config.containsKeyAndNotNull("enabled") ? TiConvert.toBoolean(config, "enabled", true) : true);
properties.put("ensureRight", config != null && config.containsKeyAndNotNull("ensureRight") ? TiConvert.toBoolean(config, "ensureRight", false) : false);
properties.put("ensureBottom", config != null && config.containsKeyAndNotNull("ensureBottom") ? TiConvert.toBoolean(config, "ensureBottom", false) : false);
properties.put("minLeft", config != null && config.containsKeyAndNotNull("minLeft") ? TiConvert.toDouble(config, "minLeft") : null);
properties.put("maxLeft", config != null && config.containsKeyAndNotNull("minLeft") ? TiConvert.toDouble(config, "maxLeft") : null);
properties.put("minTop",config != null && config.containsKeyAndNotNull("minTop") ? TiConvert.toDouble(config, "minTop") : null);
properties.put("maxTop", config != null && config.containsKeyAndNotNull("maxTop") ? TiConvert.toDouble(config, "maxTop") : null);
properties.put("axis", config != null && config.containsKeyAndNotNull("axis") ? TiConvert.toString(config, "axis") : null);
properties.put("maps", config != null && config.containsKeyAndNotNull("maps") ? (Object[]) config.get("maps") : null);

dimensions.put("minLeft", config != null && config.containsKeyAndNotNull("minLeft") ? TiConvert.toTiDimension(config, "minLeft", TiDimension.TYPE_LEFT) : null);
dimensions.put("maxLeft", config != null && config.containsKeyAndNotNull("minLeft") ? TiConvert.toTiDimension(config, "maxLeft", TiDimension.TYPE_LEFT) : null);
dimensions.put("minTop", config != null && config.containsKeyAndNotNull("minTop") ? TiConvert.toTiDimension(config, "minTop", TiDimension.TYPE_TOP) : null);
dimensions.put("maxTop", config != null && config.containsKeyAndNotNull("maxTop") ? TiConvert.toTiDimension(config, "maxTop", TiDimension.TYPE_TOP) : null);

setModelListener(this);
}
Expand Down

0 comments on commit 1a09396

Please sign in to comment.