Skip to content

Commit

Permalink
[Feature] Use MaterialSwitch and remove old SwitchMaterial styling.
Browse files Browse the repository at this point in the history
Fixes: #879
  • Loading branch information
zhanghai committed Aug 9, 2023
1 parent 25d298a commit 022f03b
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 53 deletions.
19 changes: 0 additions & 19 deletions app/src/main/res/drawable/switch_thumb_material3.xml

This file was deleted.

15 changes: 0 additions & 15 deletions app/src/main/res/drawable/switch_track_material3.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
-->

<!-- @see @androidx.preference:preference:layout/preference_widget_switch_compat -->
<com.google.android.material.switchmaterial.SwitchMaterial
<com.google.android.material.materialswitch.MaterialSwitch
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/switchWidget"
android:layout_width="wrap_content"
Expand Down
4 changes: 0 additions & 4 deletions app/src/main/res/values-night/colors_material3.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,5 @@
-->

<resources>

<color name="system_window_scrim_material3">@color/system_window_scrim_dark_material3</color>

<color name="switch_thumb_tint_material3">@color/switch_thumb_tint_dark_material3</color>
<color name="switch_track_tint_material3">@color/switch_track_tint_dark_material3</color>
</resources>
4 changes: 0 additions & 4 deletions app/src/main/res/values/colors_material3.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@
-->

<resources>

<!-- This is actually unused on v29+, so it's okay to hard code. -->
<color name="system_window_scrim_light_material3">#99FFFFFF</color>
<color name="system_window_scrim_dark_material3">#661F1F1F</color>
<color name="system_window_scrim_material3">@color/system_window_scrim_light_material3</color>

<color name="switch_thumb_tint_material3">@color/switch_thumb_tint_light_material3</color>
<color name="switch_track_tint_material3">@color/switch_track_tint_light_material3</color>
</resources>
8 changes: 0 additions & 8 deletions app/src/main/res/values/styles_material3.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@
<item name="android:fontFamily">@string/m3_ref_typeface_plain_regular</item>
</style>

<style name="Widget.MaterialFiles.Material3.CompoundButton.Switch" parent="Widget.Material3.CompoundButton.Switch">
<item name="android:thumb">@drawable/switch_thumb_material3</item>
<item name="thumbTint">@color/switch_thumb_tint_material3</item>
<item name="thumbTintMode">src_in</item>
<item name="track">@drawable/switch_track_material3</item>
<item name="trackTint">@color/switch_track_tint_material3</item>
</style>

<style name="Widget.MaterialFiles.Material3.NavigationView" parent="Widget.Material3.NavigationView">
<item name="itemHorizontalPadding">@dimen/navigation_item_horizontal_padding_material3</item>
<item name="itemSubtitleTextAppearance">?textAppearanceBodyMedium</item>
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/values/themes_material3.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
<item name="minTouchTargetSize">0dp</item>
<item name="navigationViewStyle">@style/Widget.MaterialFiles.Material3.NavigationView</item>
<item name="simpleMenuPreferenceStyle">@style/Preference.MaterialFiles.Material3.SimpleMenuPreference</item>
<item name="switchStyle">@style/Widget.MaterialFiles.Material3.CompoundButton.Switch</item>
<item name="tabStyle">@style/Widget.MaterialFiles.Material3.TabLayout</item>
<item name="textAppearanceListItem">@style/TextAppearance.MaterialFiles.Material3.ListItem</item>
<item name="android:textAppearanceListItem">?textAppearanceListItem</item>
Expand Down Expand Up @@ -77,7 +76,6 @@
<item name="minTouchTargetSize">0dp</item>
<item name="navigationViewStyle">@style/Widget.MaterialFiles.Material3.NavigationView</item>
<item name="simpleMenuPreferenceStyle">@style/Preference.MaterialFiles.Material3.SimpleMenuPreference</item>
<item name="switchStyle">@style/Widget.MaterialFiles.Material3.CompoundButton.Switch</item>
<item name="tabStyle">@style/Widget.MaterialFiles.Material3.TabLayout</item>
<item name="textAppearanceListItem">@style/TextAppearance.MaterialFiles.Material3.ListItem</item>
<item name="android:textAppearanceListItem">?textAppearanceListItem</item>
Expand Down

0 comments on commit 022f03b

Please sign in to comment.