@@ -448,14 +448,29 @@ protected void showLoadingScreen(View view) {
448448 }
449449 }
450450
451- protected View getLoadingScreen () {
452- // load the bitmap
453- // 1. if the image is valid and we don't have layout yet, assign this bitmap
454- // as main view.
455- // 2. if we have a layout, just set it in the layout.
456- // 3. If we have an mImageView already, then do nothing because it will have
457- // already been made the content view or added to the layout.
451+ protected void setBackgroundColor (View view ) {
452+ /*
453+ * Set the presplash loading screen background color
454+ * https://developer.android.com/reference/android/graphics/Color.html
455+ * Parse the color string, and return the corresponding color-int.
456+ * If the string cannot be parsed, throws an IllegalArgumentException exception.
457+ * Supported formats are: #RRGGBB #AARRGGBB or one of the following names:
458+ * 'red', 'blue', 'green', 'black', 'white', 'gray', 'cyan', 'magenta', 'yellow',
459+ * 'lightgray', 'darkgray', 'grey', 'lightgrey', 'darkgrey', 'aqua', 'fuchsia',
460+ * 'lime', 'maroon', 'navy', 'olive', 'purple', 'silver', 'teal'.
461+ */
462+ String backgroundColor = resourceManager .getString ("presplash_color" );
463+ if (backgroundColor != null ) {
464+ try {
465+ view .setBackgroundColor (Color .parseColor (backgroundColor ));
466+ } catch (IllegalArgumentException e ) {}
467+ }
468+ }
458469
470+ protected View getLoadingScreen () {
471+ // If we have an mLottieView or mImageView already, then do
472+ // nothing because it will have already been made the content
473+ // view or added to the layout.
459474 if (mLottieView != null || mImageView != null ) {
460475 // we already have a splash screen
461476 return mLottieView != null ? mLottieView : mImageView ;
@@ -480,13 +495,14 @@ protected View getLoadingScreen() {
480495 // (Gives error "The specified child already has a parent.
481496 // You must call removeView() on the child's parent first.")
482497 }
498+ setBackgroundColor (mLottieView );
483499 return mLottieView ;
484500 }
485501 catch (NotFoundException e ) {
486502 Log .v ("SDL" , "couldn't find lottie layout or animation, trying static splash" );
487503 }
488504
489- // try to load the static image then
505+ // no lottie asset, try to load the static image then
490506 int presplashId = this .resourceManager .getIdentifier ("presplash" , "drawable" );
491507 InputStream is = this .getResources ().openRawResource (presplashId );
492508 Bitmap bitmap = null ;
@@ -500,23 +516,8 @@ protected View getLoadingScreen() {
500516
501517 mImageView = new ImageView (this );
502518 mImageView .setImageBitmap (bitmap );
519+ setBackgroundColor (mImageView );
503520
504- /*
505- * Set the presplash loading screen background color
506- * https://developer.android.com/reference/android/graphics/Color.html
507- * Parse the color string, and return the corresponding color-int.
508- * If the string cannot be parsed, throws an IllegalArgumentException exception.
509- * Supported formats are: #RRGGBB #AARRGGBB or one of the following names:
510- * 'red', 'blue', 'green', 'black', 'white', 'gray', 'cyan', 'magenta', 'yellow',
511- * 'lightgray', 'darkgray', 'grey', 'lightgrey', 'darkgrey', 'aqua', 'fuchsia',
512- * 'lime', 'maroon', 'navy', 'olive', 'purple', 'silver', 'teal'.
513- */
514- String backgroundColor = resourceManager .getString ("presplash_color" );
515- if (backgroundColor != null ) {
516- try {
517- mImageView .setBackgroundColor (Color .parseColor (backgroundColor ));
518- } catch (IllegalArgumentException e ) {}
519- }
520521 mImageView .setLayoutParams (new ViewGroup .LayoutParams (
521522 ViewGroup .LayoutParams .FILL_PARENT ,
522523 ViewGroup .LayoutParams .FILL_PARENT ));
0 commit comments