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

Suggestion: Create switch bar preference #9

Open
WSTxda opened this issue Sep 11, 2024 · 3 comments
Open

Suggestion: Create switch bar preference #9

WSTxda opened this issue Sep 11, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@WSTxda
Copy link

WSTxda commented Sep 11, 2024

Just like in settingslib / AOSP settings and other apps, the switch bar is used as a master control for a list of preferences.

This is useful when you need to determine a high priority preference in list, on which the others depend on it.

I think it could be an interesting addition.

Screenshot_2024-09-11-02-56-36-031_app.revanced.android.gms.jpg

Screenshot_2024-09-11-02-56-41-065_app.revanced.android.gms.jpg

@zhanghai
Copy link
Owner

zhanghai commented Sep 12, 2024

I did consider this one, the major issue I saw was that there's no good UX spec for the font, color and spacing etc so I didn't add it.

@zhanghai zhanghai self-assigned this Sep 12, 2024
@zhanghai zhanghai added the enhancement New feature or request label Sep 12, 2024
@WSTxda
Copy link
Author

WSTxda commented Sep 12, 2024

I did consider this one, the major issue I saw was that there's no good UX spec for the font, color and spacing etc so I didn't add it.

Are you referring to attributes? I don't know how it is in compose, but a cardview or drawable shape can be used for this with primaryContainer in background color. For text can be usel use textAppearanceTitleLarge with 20sp for text size. For the paddings need to adjust according to the background for visual harmony.

Screenshot_2024-09-12-01-37-35-764_app.revanced.android.gms-edit.jpg

Noting that there must be a limit on the margin that visually respects the corners of the background.

@zhanghai
Copy link
Owner

zhanghai commented Sep 17, 2024

It's not as simple as that, because this has a lot of custom design tokens that aren't shared with other preferences so if we add it we'll have to expose all those as separate entries in PreferenceTheme as well. For instance the title font and the rounded corner size, and the different paddings. You may look at https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/packages/SettingsLib/MainSwitchPreference/src/com/android/settingslib/widget/MainSwitchPreference.java to implement one for yourself without supporting theming though, and that will be much simpler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants