Skip to content

Commit

Permalink
feat(android): start animatable layers when splash drawable is layered (
Browse files Browse the repository at this point in the history
  • Loading branch information
tntwist authored Jul 7, 2020
1 parent 1cbca1b commit 606b59f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions android/capacitor/src/main/java/com/getcapacitor/Splash.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 606b59f

Please sign in to comment.