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

[Color] Update from 1.10.0 to 1.11.0 many components require android:background #4135

Closed
mywalkb opened this issue Apr 1, 2024 · 12 comments
Closed

Comments

@mywalkb
Copy link

mywalkb commented Apr 1, 2024

Description: I have an activity with more fragments, after the update from 1.10.0 to 1.11.0 or 1.12.0-beta01, the background color of some components is wrong, when I use system colors, while is correct if I force a color.
Some screenshots what happens after update. System color is blue.

As workaround I set android:background="?android:colorBackground" to some components in layout, but I understand which a wrong way to solve my issue.

Expected behavior:
Here before update

Source code: No changes to code

Android API version: 34 tested also 33 same result

Material Library version: 1.11.0

Device: AVD Android 14

@mywalkb mywalkb added the bug label Apr 1, 2024
@hunterstich
Copy link
Contributor

Hi @mywalkb. Thanks for filing an issue.

For some reason I'm unable to see the images you've uploaded. Do you mind re-attaching the screenshots of the issue?

@mywalkb
Copy link
Author

mywalkb commented Apr 1, 2024

Hi @hunterstich, thank you for your fast reply and sorry for my bad images and slow fix.
I uploaded to external host, because the images have just become so private that not even I can see them anymore, while I was preparing the issue something else happened to me but I thought it was my fault and how I had pasted the link, but no, it seems they are only valid in session.
However I saw that github has uploaded them to its servers.
When in doubt, also post direct links, to avoid them getting lost again

After update to 1.11.0
https://i.ibb.co/SrgqMDH/after1.png
https://i.ibb.co/7QJQsCZ/after2.png

Before update to 1.11.0 with version 1.10.0
https://i.ibb.co/Bt446Hv/before1.png
https://i.ibb.co/KVvqX5s/before2.png

@diegobarle-dev
Copy link

The issue also happening with MaterialDatePicker.Builder.datePicker() but I'm unable to fix it with styles.
Screenshot 2024-04-03 at 10 16 48

Adding the following partially fixes the problem but there are still gaps

    <style name="ThemeOverlay.App.MaterialCalendar" parent="@style/ThemeOverlay.MaterialComponents.MaterialCalendar">
        <item name="materialCalendarHeaderSelection">@style/HeaderSelection1</item>
    </style>
    <style name="HeaderSelection1" parent="Widget.MaterialComponents.MaterialCalendar.HeaderSelection">
        <item name="android:background">@color/error_red</item>
    </style>
    val datePicker = MaterialDatePicker.Builder.datePicker()
            .setTitleText(R.string.date_picker_select_date)
            .setSelection(dateValidator.initialDate)
            .setCalendarConstraints(constraintsBuilder.build())
            .setTheme(R.style.ThemeOverlay_App_MaterialCalendar)
            .build()

Screenshot 2024-04-03 at 10 25 33

@mywalkb
Copy link
Author

mywalkb commented Apr 3, 2024

I'm glad to know I'm not the only one with the issue.
I hope @hunterstich can give us a suggestion.

@diegobarle-dev
Copy link

Update: After analysing my codebase I realised that some of the styles defined in my project were somehow overriding the ones defined by the material library (still not sure how that was possible if they were not being referenced upon build). After getting rid of the styles defined in my project the MaterialDatePicker UI seems to be displaying correctly on com.google.android.material:material:1.11.0

@hunterstich
Copy link
Contributor

@mywalkb do you have dynamic colors enabled? Do you mind attaching a sample that reproduces the issue?

@mywalkb
Copy link
Author

mywalkb commented Apr 3, 2024

@hunterstich yes I have dynamic colors enabled.
I don't have an example to reproduces the issue, but it's an opensource project mywalkb/LSPosed_mod.
Is not only an app, but a more complex project.
The source of app is here mywalkb/LSPosed_mod/tree/main/app/src/main.
In this action zip you can find manager.apk which has the issue with version 1.11.0, while in this action zip you can find manage.apk which has no issue with version 1.10.0, because I choose to revert the update.

@hunterstich
Copy link
Contributor

@mywalkb Are the two different screenshots running on a device with different wallpapers?

@mywalkb
Copy link
Author

mywalkb commented Apr 4, 2024

@hunterstich no, is the same AVD without changes. I installed, run, screenshot, no changes.

@paulfthomas
Copy link
Member

@pekingme any idea regarding this?

@pekingme
Copy link
Contributor

@mywalkb Thanks for reporting. Please prepare a simple sample can reproduce the issue.

I have taken a look at your project. The AppTheme.Light inherits from Theme.Material3.DynamicColors.Light.Rikka. This is not a default Material3 theme. Are you using another lib wrapping Material? It's impossible to identify the issues with external complexities. Can you try to depend on Material directly and use a default Material theme as parent?

I'll mark this closed. We'll take another look with a repro sample.

@mywalkb
Copy link
Author

mywalkb commented Apr 15, 2024

Are you using another lib wrapping Material?

Yes, it's true, but the issue appear when I update from 1.10.0 to 1.11.0 and no other changes are done.
I'll try to use Material directly.
Thank you for your time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants