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

[Switches] MD2 Switches still in use #2527

Closed
Maitreya29 opened this issue Jan 21, 2022 · 20 comments
Closed

[Switches] MD2 Switches still in use #2527

Maitreya29 opened this issue Jan 21, 2022 · 20 comments

Comments

@Maitreya29
Copy link

Maitreya29 commented Jan 21, 2022

Is your feature request related to a problem? Please describe.
It's been months since A12 came out, Google apps already use new switches (and inconsistently to remember that) but MD lib doesn't

Describe the solution you'd like
People have already made issues for this, the team just said the switches are not finalised but it has been months, you guys approved a whole new design language but couldn't approve switches? Not to forget the system is using those too. Give us the current design switches and if you change your mind later update them please I'm sick and tired if my apps looking inconsistent with the System.

@githubcatw
Copy link

githubcatw commented Jan 21, 2022

+1, it is a shame that a company as big as Google, with their large design team, couldn't finalize a switch design in months despite approving the M3 design language.

Edit: and don't forget that MDC 1.5 is stable now, with no switch redesign. When I posted an issue about this MDC 1.5 was in alpha so it was excusable as an alpha bug that will get fixed, whereas now it's less excusable.

@Maitreya29
Copy link
Author

+1, it is a shame that a company as big as Google, with their large design team, couldn't finalize a switch design in months despite approving the M3 design language.

Edit: and don't forget that MDC 1.5 is stable now, with no switch redesign. When I posted an issue about this MDC 1.5 was in alpha so it was excusable as an alpha bug that will get fixed, whereas now it's less excusable.

Agreed, if google can use it in their own apps we should be able to too. At this point it's like they've forgotten it or just wanna keep it closed or something. I thought material was aimed at bringing consistency over the platform unlike the holo era but all we have rn is platform and google apps having those switches while devs get overlooked. Funny thing is even google can't pick a side they're using 3 total switches. The one from Settings in some apps, MD2 in some and then a variation of the settings one with different tinted switches in others, kinda funny.

@githubcatw
Copy link

Agreed, if google can use it in their own apps we should be able to too. At this point it's like they've forgotten it or just wanna keep it closed or something. I thought material was aimed at bringing consistency over the platform unlike the holo era but all we have rn is platform and google apps having those switches while devs get overlooked. Funny thing is even google can't pick a side they're using 3 total switches. The one from Settings in some apps, MD2 in some and then a variation of the settings one with different tinted switches in others, kinda funny.

And switches aren't even the only thing they can't agree on. Now Playing history is literally MD2 with Monet.

@andrelabonte
Copy link

Hi- Thanks for the feedback.

We are working on an updated MDC Switch that will align the patterns you might have seen in Android 12, and make it available to all apps, including third party developed apps.

Stay tuned for a timeline of delivery.

@Maitreya29
Copy link
Author

Maitreya29 commented Jan 24, 2022

An eternity ago we were given the same answer, it's been almost a whole year since the first android developer preview and if I dig into source history I can see commits refering to material next and other terms for MD3 from even longer so what I assume is it's been a long time since work has been on, why is something like switches not finalised especially when A12 API and MD3 components themselves are either finalised or in production?

@githubcatw
Copy link

githubcatw commented Jan 24, 2022

We are working on an updated MDC Switch that will align the patterns you might have seen in Android 12...
Stay tuned for a timeline of delivery.

...which is almost exactly what another team member replied to me 2 months ago:

...the switch design in Material 3 is not finalized yet and our designers are currently working on it.
Hopefully we will have some updated info soon.

It is amazing how Google, a company with a large, world class design team, is still giving the same excuses when A12 has been out for months. Compare this to, for example, Apple, which usually release updated design SDKs on day one. Even Microsoft, which used to (at least with the methods I have tried) make making the top bar match the ones in system apps hard (and that's ignoring the multiple design languages in their system apps), updated their SDK to have all components from Windows 11 system apps.

@OxygenCobalt
Copy link
Contributor

OxygenCobalt commented Feb 5, 2022

As a workaround for now, I've found that the following resources (borrowed from Doodle) emulate the A12 switches pretty well. It's not identical, but nothing is ever identical on android, so whatever.

@drawable/ui_m3_switch_track -> trackDrawable:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="rectangle">
            <solid android:color="#000000" />
            <corners android:radius="56dp" />
            <size
                android:width="64dp"
                android:height="28dp" />
        </shape>
    </item>
</layer-list>

@color/sel_m3_switch_track -> trackTintList:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:color="?attr/colorOnSurface" android:alpha="0.38" android:state_enabled="false" />
    <item android:color="?attr/colorPrimary" android:state_checked="true" />
    <item android:color="?attr/colorOnSurfaceVariant" />
</selector>

@drawable/ui_m3_switch_thumb -> thumbDrawable:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:bottom="4dp"
        android:left="4dp"
        android:right="4dp"
        android:top="4dp">
        <shape android:shape="oval">
            <solid android:color="#000000" />
            <size
                android:width="20dp"
                android:height="20dp" />
        </shape>
    </item>
</layer-list>

@color/sel_m3_switch_thumb -> thumbTintList

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:color="?attr/colorOnSurface" android:alpha="0.12" android:state_enabled="false" />
    <item android:color="?attr/colorOnPrimary" android:state_checked="true" />
    <item android:color="?attr/colorSurfaceVariant" />
</selector>

The end result should be this:
m3_switches

Note: This hack won't work on API 21 or 22, as color selectors are not supported well on that version.

@Maitreya29
Copy link
Author

Hey @OxygenCobalt , if you need I can get you the exact switch drawables as well (the ones used in AOSP) since I used them a few time ago as I got some aosp source experience so I could dig em out. They match AOSP 1:1 since they're from there literally 😅

Thank you for this though, thanks for doing Google's job like an absolute chad

@OxygenCobalt
Copy link
Contributor

OxygenCobalt commented Feb 5, 2022

if you need I can get you the exact switch drawables as well (the ones used in AOSP

I'll be good, honestly. I feel like these switches complement my app better anyway as they rely on the M3 color roles instead of [what is probably] the raw color values in the case of AOSP.

Thank you for this though, thanks for doing Google's job like an absolute chad

Don't thank me, thank the dev of Doodle creating them in the first place. All I did was reshare what they made.

@Maitreya29
Copy link
Author

not raw values they actually use dynamic colors, (https://github.com/aosp-mirror/platform_frameworks_base/blob/b4bcc8592581b412a9b67493ca2570f9e93389c0/packages/SettingsLib/SettingsTheme/res/values-v31/colors.xml#L29 thumb for example) you can use this for API 31 for a more consistent experience that frankly android lacks

@githubcatw
Copy link

githubcatw commented Feb 8, 2022

Thank you @OxygenCobalt and Doodle's devs for essentially doing Google's job. This will come in useful for my future apps.

@OxygenCobalt
Copy link
Contributor

Update: Seems like b2a3fbe and this new Material Design Doc imply that we are finally getting the new switch design. Yay!

@githubcatw
Copy link

Finally, after months of asking, we might soon get the new switch design. Though the design on the M3 website is different from the one used in Android, hopefully Google will start using the M3 website one everywhere.

@Maitreya29
Copy link
Author

Looks like we have updated switches but they are vastly different from what is in AOSP, @andrelabonte and @drchen can you please tell us why?

@Ha2ryZhang
Copy link

Why doesn't it work yet?

@githubcatw
Copy link

Finally, after months of asking, we might soon get the new switch design. Though the design on the M3 website is different from the one used in Android, hopefully Google will start using the M3 website one everywhere.

...and I don't remember seeing that design in any Google app or Android 13's settings app.

@drchen
Copy link
Contributor

drchen commented Jul 6, 2022

It's not released to a stable version yet. : ) (It will be, soon.)

I think first-party apps will update the new design after we release a stable version.

@githubcatw
Copy link

It's not released to a stable version yet. : ) (It will be, soon.)

I think first-party apps will update the new design after we release a stable version.

That's nice to know.

@OxygenCobalt
Copy link
Contributor

Will it be stable in 1.7.0 @drchen?

@drchen
Copy link
Contributor

drchen commented Jul 8, 2022

Yes. : )

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

6 participants