Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Android theme settings get overridden #5258

Closed
NePheus opened this issue Nov 19, 2021 · 7 comments
Closed

bug: Android theme settings get overridden #5258

NePheus opened this issue Nov 19, 2021 · 7 comments

Comments

@NePheus
Copy link

NePheus commented Nov 19, 2021

Bug Report

Capacitor Version

3.1.2

Platform(s)

Android

Current Behavior

Theme settings in the styles.xml get overriden. i.e.

<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>

are not working, maybe because they are 'resetted' anywhere programmatically? In capacitor 3.1.1 it works fine and after updating to 3.1.2 this settings are not working anymore. Maybe depending to #4841?

Expected Behavior

Custom theme settings in styles.xml should be working.

@jcesarmobile
Copy link
Member

can you provide a sample app where the issue can be reproduced?

@NePheus
Copy link
Author

NePheus commented Jan 6, 2022

Basically you can take any capacitor sample app and just add the lines from my first ticket:

<resources>
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

    <style name="AppTheme.NoActionBarLaunch" parent="Theme.AppCompat.NoActionBar">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
        <item name="android:windowTranslucentStatus">true</item> <!-- <- add this line -->
        <item name="android:windowTranslucentNavigation">true</item> <!-- <- add this line -->
        <item name="android:background">@drawable/splashscreen</item>
        <item name="android:navigationBarColor">@color/bg</item>
    </style>
</resources>

And when you run it on Android with capacitor <= 3.1.1 everything works fine and you see that the system status und navigation bar are transparent. When updating to capacitor >= 3.1.2 the settings are ignored and the status und navigation bar are not transparent anymore.

@jcesarmobile
Copy link
Member

Please, can you create any sample app and introduce those changes and share the app?

@NePheus
Copy link
Author

NePheus commented Jan 6, 2022

Ok, yes of course.

@jcesarmobile
Copy link
Member

Just noticed that you are adding the changes to NoActionBarLaunch theme, which is the theme used for the splash screen, once the splash screen is dismissed the app switches to NoActionBar theme, that's the App theme. So it makes sense that your changes get overridden, you should add those lines to NoActionBar theme instead.

In your example there is no NoActionBar theme, it should be there

<style name="AppTheme.NoActionBar" parent="Theme.AppCompat.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:background">@null</item>
</style>

@NePheus
Copy link
Author

NePheus commented Jan 11, 2022

You are correct, sorry for that. Didnt know why my file ended like this. Thank you!

@ionitron-bot
Copy link

ionitron-bot bot commented Nov 10, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Nov 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants