From 606b59fcc4237303d87871c543b8bb63de9f9e7c Mon Sep 17 00:00:00 2001 From: Nico L Date: Wed, 8 Jul 2020 01:39:55 +0200 Subject: [PATCH] feat(android): start animatable layers when splash drawable is layered (#2733) --- .../src/main/java/com/getcapacitor/Splash.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/android/capacitor/src/main/java/com/getcapacitor/Splash.java b/android/capacitor/src/main/java/com/getcapacitor/Splash.java index 480638b73..7f533ea34 100644 --- a/android/capacitor/src/main/java/com/getcapacitor/Splash.java +++ b/android/capacitor/src/main/java/com/getcapacitor/Splash.java @@ -9,6 +9,7 @@ import android.graphics.PixelFormat; import android.graphics.drawable.Animatable; import android.graphics.drawable.Drawable; +import android.graphics.drawable.LayerDrawable; import android.os.Handler; import android.view.Gravity; import android.view.View; @@ -60,6 +61,18 @@ private static void buildViews(Context c, CapConfig config) { ((Animatable) splash).start(); } + if(splash instanceof LayerDrawable){ + LayerDrawable layeredSplash = (LayerDrawable) splash; + + for(int i = 0; i < layeredSplash.getNumberOfLayers(); i++){ + Drawable layerDrawable = layeredSplash.getDrawable(i); + + if(layerDrawable instanceof Animatable) { + ((Animatable) layerDrawable).start(); + } + } + } + splashImage = new ImageView(c); splashImage.setFitsSystemWindows(true);