diff --git a/android/platform/android/res/layout/layout_lottie.xml b/android/platform/android/res/layout/layout_lottie.xml
index 9c5b3e0..7834548 100644
--- a/android/platform/android/res/layout/layout_lottie.xml
+++ b/android/platform/android/res/layout/layout_lottie.xml
@@ -1,3 +1,3 @@
-
+
diff --git a/android/src/ti/animation/LottieViewProxy.java b/android/src/ti/animation/LottieViewProxy.java
index c8ad53a..4f718d1 100644
--- a/android/src/ti/animation/LottieViewProxy.java
+++ b/android/src/ti/animation/LottieViewProxy.java
@@ -50,6 +50,7 @@ public class LottieViewProxy extends TiViewProxy
private TiApplication appContext;
private KrollFunction callbackUpdate = null;
private KrollFunction callbackComplete = null;
+ private KrollFunction callbackReady = null;
private Resources resources;
private String loadFile = "";
private String assetFolder = "";
@@ -63,6 +64,8 @@ public class LottieViewProxy extends TiViewProxy
private JSONObject jsonObject;
private int width = 0;
private int height = 0;
+ private boolean useSoftwareRendering = false;
+
protected static final int MSG_STARTANIMATION = KrollProxy.MSG_LAST_ID + 101;
@Kroll.constant public static final int ANIMATION_START = 1;
@@ -141,7 +144,12 @@ public LottieView(TiViewProxy proxy) {
lottieView.addAnimatorUpdateListener(new AnimatorUpdateListener());
lottieView.addAnimatorListener(new AnimatorListener());
- lottieView.setLayerType(View.LAYER_TYPE_HARDWARE,null);
+ if (useSoftwareRendering){
+ lottieView.setLayerType(View.LAYER_TYPE_SOFTWARE,null);
+ } else {
+ lottieView.setLayerType(View.LAYER_TYPE_HARDWARE,null);
+ }
+
if (loadFile != ""){
setFile(loadFile);
@@ -208,7 +216,11 @@ public void handleCreationDict(KrollDict options)
}
if (options.containsKey("disableHardwareAcceleration")){
if (options.getBoolean("disableHardwareAcceleration")){
- lottieView.setLayerType(View.LAYER_TYPE_SOFTWARE,null);
+ if (isReady){
+ lottieView.setLayerType(View.LAYER_TYPE_SOFTWARE,null);
+ } else {
+ useSoftwareRendering = true;
+ }
}
}
}
@@ -315,6 +327,8 @@ public void addEventListener(String evt, KrollFunction kf) {
callbackUpdate =(KrollFunction) kf;
} else if (evt.equals("complete")) {
callbackComplete =(KrollFunction) kf;
+ } else if (evt.equals("ready")) {
+ callbackReady =(KrollFunction) kf;
}
}
@@ -370,6 +384,11 @@ public void onCompositionLoaded(LottieComposition composition) {
if (isAutoStart){
lottieView.playAnimation();
}
+
+ if (callbackReady != null) {
+ HashMap event = new HashMap();
+ callbackReady.call(getKrollObject(), event);
+ }
}
});
}