nambicompany / expandable-fab

A highly customizable 'speed dial' FloatingActionButton implementation.
https://nambicompany.github.io/expandable-fab/
MIT License
200 stars 21 forks source link

ExpandableFab does not use colorAccent when Theme.MaterialComponents.DayNight is the app theme #2

Closed alvindizon closed 4 years ago

alvindizon commented 4 years ago

The ExpandableFab's efab_color doesn't use colorAccent despite setting it to colorSecondary, it just uses the color black. Tested it on API 25, here's my styles.xml

    <style name="AppTheme" parent="Theme.MaterialComponents.DayNight">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/color_primary</item>
        <item name="colorPrimaryVariant">@color/color_primary_variant</item>
        <item name="colorSecondary">@color/color_secondary_variant</item>
        <item name="colorSecondaryVariant">@color/color_secondary</item>
        <item name="colorOnSurface">@color/color_on_surface</item>

        <item name="colorPrimaryDark">?colorPrimaryVariant</item>
        <item name="colorAccent">?colorSecondary</item>
    </style>

My colors.xml:

<resources>
    <color name="color_primary">#6200EE</color>
    <color name="color_primary_variant">#3700B3</color>
    <color name="color_secondary">#03DAC5</color>
    <color name="color_secondary_variant">#036C62</color>
    <color name="shimmer_base_0">#c2c2c2</color>
    <color name="shimmer_highlight_0">#ffffff</color>
    <color name="color_on_surface">#000000</color>
    <color name="color_divider">#1F000000</color>
    <color name="color_tinted_surface">#ffffff</color>
    <color name="color_on_surface_secondary">#9e9e9e</color>
</resources>

I know I can just as easily specify my FAB's preferred color or I might just be misunderstanding something, but just thought I should let you guys know what I encountered.

kabumere commented 4 years ago

Hey @alvindizon, thanks for bringing that to our attention. This has been fixed in v1.0.1 which is currently available on Maven Central and JCenter (also reflected in the latest commits on master branch should you wish to clone).

This fix allows the use of colorSecondary as well if colorAccent is undefined in the current theme, so you shouldn't have to define both in your case (unless you personally need both in your app). Relevant documentation has also been updated on the project website.

Let me know if v1.0.1 fixes the issue for you.

alvindizon commented 4 years ago

Thanks, I'll check v1.0.1 out.

alvindizon commented 4 years ago

Just tried v1.0.1, it fixed the issue. Thanks.