Add a LottieAnimationView overload for ZipInputStream
diff --git a/lottie/src/main/java/com/airbnb/lottie/LottieAnimationView.java b/lottie/src/main/java/com/airbnb/lottie/LottieAnimationView.java
index 42f8345..dce36e8 100644
--- a/lottie/src/main/java/com/airbnb/lottie/LottieAnimationView.java
+++ b/lottie/src/main/java/com/airbnb/lottie/LottieAnimationView.java
@@ -36,11 +36,13 @@
import java.io.ByteArrayInputStream;
import java.io.InputStream;
+import java.io.PushbackInputStream;
import java.lang.ref.WeakReference;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.zip.ZipInputStream;
/**
* This view will load, deserialize, and display an After Effects animation exported with
@@ -508,6 +510,9 @@
* Sets the animation from an arbitrary InputStream.
* This will load and deserialize the file asynchronously.
* <p>
+ * If this is a Zip file, wrap your InputStream with a ZipInputStream to use the overload
+ * designed for zip files.
+ * <p>
* This is particularly useful for animations loaded from the network. You can fetch the
* bodymovin json from the network and pass it directly here.
* <p>
@@ -518,6 +523,19 @@
}
/**
+ * Sets the animation from a ZipInputStream.
+ * This will load and deserialize the file asynchronously.
+ * <p>
+ * This is particularly useful for animations loaded from the network. You can fetch the
+ * bodymovin json from the network and pass it directly here.
+ * <p>
+ * Auto-closes the stream.
+ */
+ public void setAnimation(ZipInputStream stream, @Nullable String cacheKey) {
+ setCompositionTask(LottieCompositionFactory.fromZipStream(stream, cacheKey));
+ }
+
+ /**
* Load a lottie animation from a url. The url can be a json file or a zip file. Use a zip file if you have images. Simply zip them together and
* lottie
* will unzip and link the images automatically.