material-components / material-components-android

Modular and customizable Material Design UI components for Android
Apache License 2.0
16.38k stars 3.07k forks source link

Request: offer API to tell us if Material You (Monet) is supported on the current device or not #2772

Closed AndroidDeveloperLB closed 2 years ago

AndroidDeveloperLB commented 2 years ago

Is your feature request related to a problem? Please describe. Yes, because some devices don't support it, so we could offer alternative UI and also warn about it not being supported.

Describe the solution you'd like To have a boolean being returned to us, to see if the current device supports it.

Describe alternatives you've considered I don't think there is a way...

Additional context Requested here too: https://issuetracker.google.com/issues/234050622

dsn5ft commented 2 years ago

Hi @AndroidDeveloperLB, I think the DynamicColors.isDynamicColorAvailable() method should be what you are looking for?

AndroidDeveloperLB commented 2 years ago

@dsn5ft Looking at the code, it returns true for BuildCompat.isAtLeastT() . Does it mean that all Android devices from Android 13 will have it? I thought that OEMs can still avoid using it, no?

dsn5ft commented 2 years ago

All Android devices from T+ will be required to support it!

AndroidDeveloperLB commented 2 years ago

@dsn5ft Even far-east ones? Even Samsung, Xiaomi, OnePlus, Vivo,... ? Even Chinese models? They will all have to have the Material-You , that affects the OS ? What do you mean by "will be required" ?

dsn5ft commented 2 years ago

It means the dynamic system colors like @android:color/system_accent1_600 are guaranteed to be populated with valid colors. It doesn't mean that the OS has to use them in their system UI.

AndroidDeveloperLB commented 2 years ago

@dsn5ft Populated based on the wallpaper colors (including from both image wallpapers and live-wallpaper apps) , right? Meaning that all apps could benefit them if the developers wish it, right? But again, will this be for all OEMs, including all I've mentioned?

dsn5ft commented 2 years ago

Populated based on the wallpaper colors (including from both image wallpapers and live-wallpaper apps) , right?

I'm not sure about live-wallpapers but I would think so. Also, it doesn't have to be a wallpaper, it could be a color palette choice by the user.

Meaning that all apps could benefit them if the developers wish it, right? But again, will this be for all OEMs, including all I've mentioned?

Yes, I believe so.

AndroidDeveloperLB commented 2 years ago

@dsn5ft I see. Is there an Intent too, to reach the wallpaper settings to choose the color-palette and also choose that it will be based on the live wallpaper? Is there also an API to check what is the source of the dynamic colors (chosen by user, chosen from image-wallpaper, or chosen by live wallpaper) ?
Suppose my app is a live wallpaper app, can I check that the colors are originated from my app (when it's set) ?

If not, can you please add such APIs ?

dsn5ft commented 2 years ago

I don't think those APIs exist, and we can't add them since they would have to be in the OS, not the Material library.

Feel free to file a "Framework" feature request here:

https://source.android.com/setup/contribute/report-bugs

AndroidDeveloperLB commented 2 years ago

Meaning here: https://issuetracker.google.com/issues/new?component=192705&template=845803

ok thanks

AndroidDeveloperLB commented 2 years ago

@dsn5ft For the Intent, I actually requested here:

https://issuetracker.google.com/issues/216364001

For querying of the source of the dynamic colors, requested now:

https://issuetracker.google.com/issues/236994615

And for querying about whether the current live wallpaper is the source:

https://issuetracker.google.com/issues/236994616