-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Material 3 switches for switch preferences
We have to do this explicitly since the Material 3 library doesn't have any magic for automatically theming the switches in androidx.preference. Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
- Loading branch information
1 parent
8f5d351
commit d80c7ce
Showing
3 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
SPDX-FileCopyrightText: 2024 Andrew Gunnerson | ||
SPDX-License-Identifier: GPL-3.0-only | ||
--> | ||
<!-- The ID must match the androidx preference library. --> | ||
<com.google.android.material.materialswitch.MaterialSwitch | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:id="@+id/switchWidget" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:focusable="false" | ||
android:clickable="false" | ||
android:background="@null" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
SPDX-FileCopyrightText: 2024 Andrew Gunnerson | ||
SPDX-License-Identifier: GPL-3.0-only | ||
--> | ||
<resources> | ||
<style name="SwitchPreferenceCompat.Material3" parent="Preference.SwitchPreferenceCompat.Material"> | ||
<item name="android:widgetLayout">@layout/material_switch_preference</item> | ||
</style> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters