File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,8 @@ public class UnityWebViewPostprocessBuild
2323 public void OnPostGenerateGradleAndroidProject ( string basePath ) {
2424 var changed = false ;
2525 var androidManifest = new AndroidManifest ( GetManifestPath ( basePath ) ) ;
26+ changed = ( androidManifest . SetApplicationTheme ( "@style/UnityThemeSelector" ) || changed ) ;
27+ changed = ( androidManifest . SetActivityTheme ( "@style/UnityThemeSelector.Translucent" ) || changed ) ;
2628 changed = ( androidManifest . SetHardwareAccelerated ( true ) || changed ) ;
2729#if UNITYWEBVIEW_ANDROID_USES_CLEARTEXT_TRAFFIC
2830 changed = ( androidManifest . SetUsesCleartextTraffic ( true ) || changed ) ;
@@ -166,6 +168,25 @@ internal bool SetUsesCleartextTraffic(bool enabled) {
166168 return changed ;
167169 }
168170
171+ internal bool SetApplicationTheme ( string theme ) {
172+ bool changed = false ;
173+ if ( ApplicationElement . GetAttribute ( "theme" , AndroidXmlNamespace ) != theme ) {
174+ ApplicationElement . SetAttribute ( "theme" , AndroidXmlNamespace , theme ) ;
175+ changed = true ;
176+ }
177+ return changed ;
178+ }
179+
180+ internal bool SetActivityTheme ( string theme ) {
181+ bool changed = false ;
182+ var activity = GetActivityWithLaunchIntent ( ) as XmlElement ;
183+ if ( activity . GetAttribute ( "theme" , AndroidXmlNamespace ) != theme ) {
184+ activity . SetAttribute ( "theme" , AndroidXmlNamespace , theme ) ;
185+ changed = true ;
186+ }
187+ return changed ;
188+ }
189+
169190 internal bool SetHardwareAccelerated ( bool enabled ) {
170191 bool changed = false ;
171192 var activity = GetActivityWithLaunchIntent ( ) as XmlElement ;
You can’t perform that action at this time.
0 commit comments