@@ -448,14 +448,29 @@ protected void showLoadingScreen(View view) {
448
448
}
449
449
}
450
450
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
+ }
458
469
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.
459
474
if (mLottieView != null || mImageView != null ) {
460
475
// we already have a splash screen
461
476
return mLottieView != null ? mLottieView : mImageView ;
@@ -480,13 +495,14 @@ protected View getLoadingScreen() {
480
495
// (Gives error "The specified child already has a parent.
481
496
// You must call removeView() on the child's parent first.")
482
497
}
498
+ setBackgroundColor (mLottieView );
483
499
return mLottieView ;
484
500
}
485
501
catch (NotFoundException e ) {
486
502
Log .v ("SDL" , "couldn't find lottie layout or animation, trying static splash" );
487
503
}
488
504
489
- // try to load the static image then
505
+ // no lottie asset, try to load the static image then
490
506
int presplashId = this .resourceManager .getIdentifier ("presplash" , "drawable" );
491
507
InputStream is = this .getResources ().openRawResource (presplashId );
492
508
Bitmap bitmap = null ;
@@ -500,23 +516,8 @@ protected View getLoadingScreen() {
500
516
501
517
mImageView = new ImageView (this );
502
518
mImageView .setImageBitmap (bitmap );
519
+ setBackgroundColor (mImageView );
503
520
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
- }
520
521
mImageView .setLayoutParams (new ViewGroup .LayoutParams (
521
522
ViewGroup .LayoutParams .FILL_PARENT ,
522
523
ViewGroup .LayoutParams .FILL_PARENT ));
0 commit comments