Only update lottie drawable if composition changes (#150)

diff --git a/lottie/src/main/java/com/airbnb/lottie/LottieAnimationView.java b/lottie/src/main/java/com/airbnb/lottie/LottieAnimationView.java
index 701c69c..44f6755 100644
--- a/lottie/src/main/java/com/airbnb/lottie/LottieAnimationView.java
+++ b/lottie/src/main/java/com/airbnb/lottie/LottieAnimationView.java
@@ -256,7 +256,14 @@
       Log.v(TAG, "Set Composition \n" + composition);
     }
     lottieDrawable.setCallback(this);
-    lottieDrawable.setComposition(composition);
+
+    boolean isNewComposition = lottieDrawable.setComposition(composition);
+    if (!isNewComposition) {
+      // We can avoid re-setting the drawable, and invalidating the view, since the composition
+      // hasn't changed.
+      return;
+    }
+
     // If you set a different composition on the view, the bounds will not update unless
     // the drawable is different than the original.
     setImageDrawable(null);
diff --git a/lottie/src/main/java/com/airbnb/lottie/LottieDrawable.java b/lottie/src/main/java/com/airbnb/lottie/LottieDrawable.java
index 326178e..ad84ad5 100644
--- a/lottie/src/main/java/com/airbnb/lottie/LottieDrawable.java
+++ b/lottie/src/main/java/com/airbnb/lottie/LottieDrawable.java
@@ -115,7 +115,10 @@
     }
   }
 
-  void setComposition(LottieComposition composition) {
+  /**
+   * @return True if the composition is different from the previously set composition, false otherwise.
+   */
+  boolean setComposition(LottieComposition composition) {
     if (getCallback() == null) {
       throw new IllegalStateException(
           "You or your view must set a Drawable.Callback before setting the composition. This " +
@@ -123,6 +126,11 @@
               "Either call ImageView.setImageDrawable() before setComposition() or call " +
               "setCallback(yourView.getCallback()) first.");
     }
+
+    if (this.composition == composition) {
+      return false;
+    }
+
     clearComposition();
     this.composition = composition;
     setSpeed(speed);
@@ -130,6 +138,7 @@
     buildLayersForComposition(composition);
 
     setProgress(getProgress());
+    return true;
   }
 
   private void clearComposition() {