Skip to content

Commit

Permalink
Allow AnimatableIntegerValue to parse decimal values
Browse files Browse the repository at this point in the history
Fixes #72
  • Loading branch information
Gabriel Peal committed Feb 9, 2017
1 parent 151a1e0 commit e7664e2
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ class AnimatableIntegerValue extends BaseAnimatableValue<Integer, Integer> {
}

@Override protected Integer valueFromObject(Object object, float scale) throws JSONException {
if (object instanceof Integer) {
if (object instanceof Float) {
return Math.round((Float) object * scale);
} else if (object instanceof Double) {
return (int) Math.round((Double) object * scale);
} else if (object instanceof Integer) {
return Math.round((Integer) object * scale);
} else if (object instanceof JSONArray && ((JSONArray) object).get(0) instanceof Integer) {
return Math.round(((JSONArray) object).getInt(0) * scale);
Expand Down

0 comments on commit e7664e2

Please sign in to comment.