Skip to content

Commit

Permalink
Add workaround for display of cutout area in fullscreen mode [apache/…
Browse files Browse the repository at this point in the history
  • Loading branch information
tkem committed Mar 26, 2023
1 parent 332888c commit bd9389d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
</feature>
<icon src="res/icon.png" />
<platform name="android">
<hook src="hooks/android/windowLayoutInDisplayCutoutMode.js" type="after_platform_add" />
<resource-file src="res/android/colors.xml" target="/app/src/main/res/values/colors.xml" />
<icon background="@color/cdv_icon_background" density="mdpi" foreground="res/android/icon/mipmap-mdpi-icon.png" />
<icon background="@color/cdv_icon_background" density="hdpi" foreground="res/android/icon/mipmap-hdpi-icon.png" />
Expand Down
19 changes: 19 additions & 0 deletions hooks/android/windowLayoutInDisplayCutoutMode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const fs = require('fs');
const path = require("path");

module.exports = function (ctx) {
const xml = `<?xml version='1.0' encoding='utf-8'?>
<resources>
<style name="Theme.App.SplashScreen" parent="Theme.SplashScreen.IconBackground">
<item name="windowSplashScreenBackground">@color/cdv_splashscreen_background</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_cdv_splashscreen</item>
<item name="windowSplashScreenAnimationDuration">200</item>
<item name="postSplashScreenTheme">@style/Theme.AppCompat.NoActionBar</item>
<item name="android:windowLayoutInDisplayCutoutMode">never</item>
</style>
</resources>`

const themesXML = path.join(ctx.opts.projectRoot, 'platforms/android/app/src/main/res/values/themes.xml');

fs.writeFileSync(themesXML, xml);
};

0 comments on commit bd9389d

Please sign in to comment.