Skip to content

Not respecting DayNight themes and colors under values-night folder #1935

@ArcherEmiya05

Description

@ArcherEmiya05

Welcome to FirebaseUI and thanks for submitting an issue!

Please take a look at open issues, as well as resolved issues, to see if your issue is either already being addressed, or has been solved by someone else.

If not, please feel free to fill in the following info so we can help faster!

Step 1: Are you in the right place?

  • For issues or feature requests related to the code in this repository file a GitHub issue.
  • For general technical questions, post a question on StackOverflow tagged appropriately.
  • For general Firebase discussion, use the firebase-talk google group
  • For help troubleshooting your application that does not fall under one of the above categories, reach out to the personalized Firebase support channel

Step 2: Describe your environment

  • Android device: Xiaomi REDMI NOTE2, Xiaomi Mi9T Pro
  • Android OS version: L, Q
  • Google Play Services version: 4.3.5
  • Firebase/Play Services SDK version: 20.0^
  • FirebaseUI version: 7.1.1

Step 3: Describe the problem:

Steps to reproduce:

Overriding theme with Material DayNight or just a simple AppCompat theme is not followed during dark mode

AuthUI.getInstance().createSignInIntentBuilder().setTheme(R.style.AuthStyle)

Observed Results:

Using values folder with values and values-night containing colors.xml and themes.xml to manage light and dark mode theming and coloring.
FirebaseUI does no respect any of the values as it appears that it does not understand it at all specially during dark mode.

Expected Results:

Friendly, adaptive, customizable or can be override.

Relevant Code:

I am using Firebase UI and overriding its theme with this code.

val builder = AuthUI.getInstance().createSignInIntentBuilder()
            .setTheme(R.style.AuthStyle)
            .setLogo(R.mipmap.ic_launcher)
            .setIsSmartLockEnabled(true)
            .setAvailableProviders(getProviderList())
        builder.setTosAndPrivacyPolicyUrls(
            "https://firebase.google.com/terms/",
            "https://firebase.google.com/policies/analytics"
        )

Unfortunately when using Dark Mode the windowBackground does not apply and backgroundTint nor materialThemeOverlay does not work as well for the Button.

Here is my complete theme.xml code

<style name="AuthStyle" parent="Theme.MaterialComponents.DayNight">

        <!--Override action bar and status bar-->
        <item name="colorAccent">@color/colorAccent</item>
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>

        <item name="android:colorControlNormal">@color/colorAccent</item> <!--Spinner or non focus field underline color-->
        <item name="android:colorFocusedHighlight">@color/colorAccent</item>

        <!--Override Toolbar title text when using MaterialComponent-->
        <item name="toolbarStyle">@style/AppToolbar</item>

        <item name="materialButtonStyle">@style/AuthButton</item> <!--Customize Firebase UI button when using MaterialComponent-->

        <!--Override main background-->
        <item name="android:windowBackground">@color/whitePrimaryDark</item>

        <!--Description text color-->
        <item name="android:textColorTertiary">@color/primaryDarkWhite</item>
<!--        <item name="android:textColorPrimary">@color/colorPrimary</item>-->

        <!--Override resend code text color-->
        <item name="android:textColorSecondary">?android:textColorTertiary</item> <!--This override spinner item text too when using MaterialComponent-->

    </style>

    <!--Extend MaterialComponent Button when using MaterialComponents as app main theme-->
    <style name="AuthButton" parent="Widget.MaterialComponents.Button">
        <item name="android:minHeight">48dip</item>
        <item name="android:minWidth">64dip</item>
        <item name="android:textStyle">bold</item>
        <item name="android:textColor">@color/whitePrimaryDark</item>
        <item name="materialThemeOverlay">@style/ThemeOverlay.App.Button</item>
    </style>

    <!--Override-->
<style name="ThemeOverlay.App.Button" parent="">
    <item name="colorPrimary">@color/primaryDarkAccent</item>
</style>

These colors uses different hex code which is separated using folder values and values-night containing two colors.xml file. Firebase UI (Phone Auth) does not respect it at all during night mode. I tried also separating AuthStyle light and night using same approach with themes.xml which did not working as well.

primaryDarkAccent //This color switch between (light) colorPrimaryDark and (night) colorAccent
whitePrimaryDark //This color switch between (light) @android:color/white and (night) colorPrimaryDark
primaryDarkWhite //This color switch between (light) colorPrimaryDark and (night) colorAccent @android:color/white

For button tinting, it only uses colorPrimary defined on AuthStyle not my defined color values with overlay but that is only during light mode. Dark/night mode seems not really follow the defined colors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions