@@ -346,7 +346,7 @@ function updateProjectAccordingTo (platformConfig, locations) {
346346 * @param {Object } locations A map of locations for this platform
347347 */
348348function updateProjectStrings ( platformConfig , locations ) {
349- // Update app name by editing res/values/strings .xml
349+ // Update app name by editing res/values/cdv_strings .xml
350350 const strings = xmlHelpers . parseElementtreeSync ( locations . strings ) ;
351351
352352 const name = platformConfig . name ( ) ;
@@ -377,7 +377,7 @@ function warnForDeprecatedSplashScreen (cordovaProject) {
377377 * @param {Object } locations A map of locations for this platform
378378 */
379379function updateProjectTheme ( platformConfig , locations ) {
380- // res/values/themes .xml
380+ // res/values/cdv_themes .xml
381381 const themes = xmlHelpers . parseElementtreeSync ( locations . themes ) ;
382382 const splashScreenTheme = themes . find ( 'style[@name="Theme.App.SplashScreen"]' ) ;
383383
@@ -408,13 +408,17 @@ function updateProjectTheme (platformConfig, locations) {
408408 if ( ! splashBg ) {
409409 splashBg = platformConfig . getPreference ( 'BackgroundColor' , this . platform ) ;
410410 }
411+ if ( ! splashBg ) {
412+ splashBg = '@color/cdv_splashscreen_background' ;
413+ }
411414
412- // use the user defined value for "colors.xml"
413- updateProjectSplashScreenBackgroundColor ( splashBg , locations ) ;
415+ events . emit ( 'verbose' , 'The Android Splash Screen background color was set to: ' +
416+ ( splashBg === '@color/cdv_splashscreen_background' ? 'Default' : splashBg )
417+ ) ;
414418
415419 // force the themes value to `@color/cdv_splashscreen_background`
416420 const splashBgNode = splashScreenTheme . find ( 'item[@name="windowSplashScreenBackground"]' ) ;
417- splashBgNode . text = '@color/cdv_splashscreen_background' ;
421+ splashBgNode . text = splashBg ;
418422
419423 [
420424 // Splash Screen
@@ -471,7 +475,7 @@ function updateProjectTheme (platformConfig, locations) {
471475 break ;
472476
473477 case 'windowSplashScreenIconBackgroundColor' :
474- // use the user defined value for "colors .xml"
478+ // use the user defined value for "cdv_colors .xml"
475479 updateProjectSplashScreenIconBackgroundColor ( cdvConfigPrefValue , locations ) ;
476480
477481 // force the themes value to `@color/cdv_splashscreen_icon_background`
@@ -495,7 +499,7 @@ function updateProjectTheme (platformConfig, locations) {
495499 break ;
496500
497501 case 'postSplashScreenTheme' :
498- themeTargetNode . text = cdvConfigPrefValue || '@style/Theme.AppCompat.NoActionBar ' ;
502+ themeTargetNode . text = cdvConfigPrefValue || '@style/Theme.Cordova.App.DayNight ' ;
499503 break ;
500504
501505 default :
@@ -507,29 +511,13 @@ function updateProjectTheme (platformConfig, locations) {
507511 events . emit ( 'verbose' , 'Wrote out Android application themes to ' + locations . themes ) ;
508512}
509513
510- /**
511- * @param {String } splashBackgroundColor SplashScreen Background Color Hex Code
512- * be used to update project
513- * @param {Object } locations A map of locations for this platform
514- */
515- function updateProjectSplashScreenBackgroundColor ( splashBackgroundColor , locations ) {
516- if ( ! splashBackgroundColor ) { splashBackgroundColor = '#FFFFFF' ; }
517-
518- // res/values/colors.xml
519- const colors = xmlHelpers . parseElementtreeSync ( locations . colors ) ;
520- colors . find ( 'color[@name="cdv_splashscreen_background"]' ) . text = splashBackgroundColor . replace ( / ' / g, '\\\'' ) ;
521-
522- fs . writeFileSync ( locations . colors , colors . write ( { indent : 4 } ) , 'utf-8' ) ;
523- events . emit ( 'verbose' , 'Wrote out Android application SplashScreen Color to ' + locations . colors ) ;
524- }
525-
526514/**
527515 * @param {String } splashIconBackgroundColor SplashScreen Icon Background Color Hex Code
528516 * be used to update project
529517 * @param {Object } locations A map of locations for this platform
530518 */
531519function updateProjectSplashScreenIconBackgroundColor ( splashIconBackgroundColor , locations ) {
532- // res/values/colors .xml
520+ // res/values/cdv_colors .xml
533521 const colors = xmlHelpers . parseElementtreeSync ( locations . colors ) ;
534522 // node name
535523 const name = 'cdv_splashscreen_icon_background' ;
@@ -627,12 +615,12 @@ function updateProjectSplashScreenImage (locations, themeKey, cdvConfigPrefKey,
627615
628616 // copy the png to correct mipmap folder with name of ic_cdv_splashscreen.png
629617 // delete ic_cdv_splashscreen.xml from drawable folder
630- // update themes .xml windowSplashScreenAnimatedIcon value to @mipmap /ic_cdv_splashscreen
618+ // update cdv_themes .xml windowSplashScreenAnimatedIcon value to @mipmap /ic_cdv_splashscreen
631619 cleanupAndSetProjectSplashScreenImage ( cdvConfigPrefValue , destFilePath , possiblePreviousDestFilePath ) ;
632620 } else if ( iconExtension === '.xml' ) {
633621 // copy the xml to drawable folder with name of ic_cdv_splashscreen.xml
634622 // delete ic_cdv_splashscreen.png from mipmap folder
635- // update themes .xml windowSplashScreenAnimatedIcon value to @drawable /ic_cdv_splashscreen
623+ // update cdv_themes .xml windowSplashScreenAnimatedIcon value to @drawable /ic_cdv_splashscreen
636624 cleanupAndSetProjectSplashScreenImage ( cdvConfigPrefValue , destFilePath , possiblePreviousDestFilePath ) ;
637625 } else {
638626 // use the default destFilePath & possiblePreviousDestFilePath, no update require.
0 commit comments