breautek commented on issue #1880:
URL:
https://github.com/apache/cordova-android/issues/1880#issuecomment-3823815520
I had a look at some of my own projects where I used the `resource-file`
directive and it looks like it's relative to the platform root directory
(`.e.g` `/platforms/android`).
So:
```xml
<platform name="android">
<resource-file src="MyCustomTheme.xml"
target="res/values/MyCustomTheme.xml" />
</platform>
```
should really be
```xml
<platform name="android">
<resource-file src="MyCustomTheme.xml"
target="app/src/main/res/values/MyCustomTheme.xml" />
</platform>
```
I tested this and it probably brought the file to it's correct spot in the
native project. That would eliminate the need for the `<edit-config>` hacks.
> It depends on context, views, etc. Splash and main screen behave also
different, idk... not yet.
Note that the style declared in the `AndroidManifest` must be
`android:theme="@style/Theme.App.SplashScreen"` for the native splashscreens to
work properly. So the edit-config to manipulate the theme declared inside
`AndroidManifest.xml` is what is breaking the splashscreen. The
`AndroidPostSplashScreenTheme` preference simply maps to
`postSplashScreenTheme` theme item, which android's splashscreen api reads and
sets the activity theme once its done.
> I just wondered if Cordova Android offers an official way to configure
these stuff.
Only a very small subset of native features are exposed via configuration
preferences, generally things that are platform-agnostic. There are
platform-specific, usually prefixed accordingly if the community feels it is
important enough.
But more advanced configuration, are typically reserved with using
preparation hooks. Or in this case, `resource-file` since all you need is to
supply your own theme resource. It is still the "Cordova" way to do it, as
Cordova will roll in your customizations within it's own build system. If you
were to try to manually manipulate files within `platforms/android`, more than
likely the cordova build system will overwrite your changes.
Cordova currently doesn't implement it's own theme, by default it is just
using one of the android SDK supplied themes and historically this has been a
sensible default. If `<item
name="android:windowLayoutInDisplayCutoutMode">always</item>` becomes the norm,
we can definitely look at adding it in as a default, though it will become a
breaking change I think, requiring Cordova to supply it's own theme and then
end-users would need to extend from the cordova theme.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]