Use Material3 switches in XML layouts

(cherry picked from commit da7a64b40d)
This commit is contained in:
arkon 2022-07-09 00:00:18 -04:00
parent 3966a917ee
commit e0d23cd688
8 changed files with 62 additions and 60 deletions

View File

@ -17,7 +17,7 @@
app:tint="?attr/colorOnBackground" /> app:tint="?attr/colorOnBackground" />
<!-- Matches ID used in SwitchPreferenceCompat --> <!-- Matches ID used in SwitchPreferenceCompat -->
<androidx.appcompat.widget.SwitchCompat <com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/switchWidget" android:id="@+id/switchWidget"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.switchmaterial.SwitchMaterial <com.google.android.material.materialswitch.MaterialSwitch
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/switchWidget" android:id="@+id/switchWidget"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@ -11,12 +11,12 @@
<!-- Brightness --> <!-- Brightness -->
<com.google.android.material.switchmaterial.SwitchMaterial <com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/custom_brightness" android:id="@+id/custom_brightness"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="16dp" android:paddingHorizontal="16dp"
android:paddingEnd="16dp" android:paddingVertical="16dp"
android:text="@string/pref_custom_brightness" android:text="@string/pref_custom_brightness"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
@ -61,12 +61,12 @@
<!-- Color filter --> <!-- Color filter -->
<com.google.android.material.switchmaterial.SwitchMaterial <com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/switch_color_filter" android:id="@+id/switch_color_filter"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="16dp" android:paddingHorizontal="16dp"
android:paddingEnd="16dp" android:paddingVertical="16dp"
android:text="@string/pref_custom_color_filter" android:text="@string/pref_custom_color_filter"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@ -237,22 +237,22 @@
<!-- Grayscale --> <!-- Grayscale -->
<com.google.android.material.switchmaterial.SwitchMaterial <com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/grayscale" android:id="@+id/grayscale"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="16dp" android:paddingHorizontal="16dp"
android:paddingEnd="16dp" android:paddingVertical="16dp"
android:text="@string/pref_grayscale" android:text="@string/pref_grayscale"
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
app:layout_constraintTop_toBottomOf="@id/color_filter_mode" /> app:layout_constraintTop_toBottomOf="@id/color_filter_mode" />
<com.google.android.material.switchmaterial.SwitchMaterial <com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/inverted_colors" android:id="@+id/inverted_colors"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="16dp" android:paddingHorizontal="16dp"
android:paddingEnd="16dp" android:paddingVertical="16dp"
android:text="@string/pref_inverted_colors" android:text="@string/pref_inverted_colors"
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
app:layout_constraintTop_toBottomOf="@id/grayscale" /> app:layout_constraintTop_toBottomOf="@id/grayscale" />

View File

@ -17,68 +17,68 @@
android:entries="@array/reader_themes" android:entries="@array/reader_themes"
app:title="@string/pref_reader_theme" /> app:title="@string/pref_reader_theme" />
<com.google.android.material.switchmaterial.SwitchMaterial <com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/show_page_number" android:id="@+id/show_page_number"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="16dp" android:paddingHorizontal="16dp"
android:paddingEnd="16dp" android:paddingVertical="16dp"
android:text="@string/pref_show_page_number" android:text="@string/pref_show_page_number"
android:textColor="?android:attr/textColorSecondary" /> android:textColor="?android:attr/textColorSecondary" />
<com.google.android.material.switchmaterial.SwitchMaterial <com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/fullscreen" android:id="@+id/fullscreen"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="16dp" android:paddingHorizontal="16dp"
android:paddingEnd="16dp" android:paddingVertical="16dp"
android:text="@string/pref_fullscreen" android:text="@string/pref_fullscreen"
android:textColor="?android:attr/textColorSecondary" /> android:textColor="?android:attr/textColorSecondary" />
<com.google.android.material.switchmaterial.SwitchMaterial <com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/cutout_short" android:id="@+id/cutout_short"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="16dp" android:paddingHorizontal="16dp"
android:paddingEnd="16dp" android:paddingVertical="16dp"
android:text="@string/pref_cutout_short" android:text="@string/pref_cutout_short"
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
android:visibility="gone" android:visibility="gone"
tools:visibility="visible" /> tools:visibility="visible" />
<com.google.android.material.switchmaterial.SwitchMaterial <com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/keepscreen" android:id="@+id/keepscreen"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="16dp" android:paddingHorizontal="16dp"
android:paddingEnd="16dp" android:paddingVertical="16dp"
android:text="@string/pref_keep_screen_on" android:text="@string/pref_keep_screen_on"
android:textColor="?android:attr/textColorSecondary" /> android:textColor="?android:attr/textColorSecondary" />
<com.google.android.material.switchmaterial.SwitchMaterial <com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/long_tap" android:id="@+id/long_tap"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="16dp" android:paddingHorizontal="16dp"
android:paddingEnd="16dp" android:paddingVertical="16dp"
android:text="@string/pref_read_with_long_tap" android:text="@string/pref_read_with_long_tap"
android:textColor="?android:attr/textColorSecondary" /> android:textColor="?android:attr/textColorSecondary" />
<com.google.android.material.switchmaterial.SwitchMaterial <com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/always_show_chapter_transition" android:id="@+id/always_show_chapter_transition"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="16dp" android:paddingHorizontal="16dp"
android:paddingEnd="16dp" android:paddingVertical="16dp"
android:text="@string/pref_always_show_chapter_transition" android:text="@string/pref_always_show_chapter_transition"
android:textColor="?android:attr/textColorSecondary" /> android:textColor="?android:attr/textColorSecondary" />
<com.google.android.material.switchmaterial.SwitchMaterial <com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/page_transitions" android:id="@+id/page_transitions"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="16dp" android:paddingHorizontal="16dp"
android:paddingEnd="16dp" android:paddingVertical="16dp"
android:text="@string/pref_page_transitions" android:text="@string/pref_page_transitions"
android:textColor="?android:attr/textColorSecondary" /> android:textColor="?android:attr/textColorSecondary" />

View File

@ -37,12 +37,12 @@
android:entries="@array/image_scale_type" android:entries="@array/image_scale_type"
app:title="@string/pref_image_scale_type" /> app:title="@string/pref_image_scale_type" />
<com.google.android.material.switchmaterial.SwitchMaterial <com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/landscape_zoom" android:id="@+id/landscape_zoom"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="16dp" android:paddingHorizontal="16dp"
android:paddingEnd="16dp" android:paddingVertical="16dp"
android:text="@string/pref_landscape_zoom" android:text="@string/pref_landscape_zoom"
android:textColor="?android:attr/textColorSecondary" /> android:textColor="?android:attr/textColorSecondary" />
@ -53,39 +53,39 @@
android:entries="@array/zoom_start" android:entries="@array/zoom_start"
app:title="@string/pref_zoom_start" /> app:title="@string/pref_zoom_start" />
<com.google.android.material.switchmaterial.SwitchMaterial <com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/crop_borders" android:id="@+id/crop_borders"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="16dp" android:paddingHorizontal="16dp"
android:paddingEnd="16dp" android:paddingVertical="16dp"
android:text="@string/pref_crop_borders" android:text="@string/pref_crop_borders"
android:textColor="?android:attr/textColorSecondary" /> android:textColor="?android:attr/textColorSecondary" />
<com.google.android.material.switchmaterial.SwitchMaterial <com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/navigate_pan" android:id="@+id/navigate_pan"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="16dp" android:paddingHorizontal="16dp"
android:paddingEnd="16dp" android:paddingVertical="16dp"
android:text="@string/pref_navigate_pan" android:text="@string/pref_navigate_pan"
android:textColor="?android:attr/textColorSecondary" /> android:textColor="?android:attr/textColorSecondary" />
<com.google.android.material.switchmaterial.SwitchMaterial <com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/dual_page_split" android:id="@+id/dual_page_split"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="16dp" android:paddingHorizontal="16dp"
android:paddingEnd="16dp" android:paddingVertical="16dp"
android:text="@string/pref_dual_page_split" android:text="@string/pref_dual_page_split"
android:textColor="?android:attr/textColorSecondary" /> android:textColor="?android:attr/textColorSecondary" />
<com.google.android.material.switchmaterial.SwitchMaterial <com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/dual_page_invert" android:id="@+id/dual_page_invert"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="16dp" android:paddingHorizontal="16dp"
android:paddingEnd="16dp" android:paddingVertical="16dp"
android:text="@string/pref_dual_page_invert" android:text="@string/pref_dual_page_invert"
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
android:visibility="gone" android:visibility="gone"

View File

@ -37,30 +37,30 @@
android:entries="@array/webtoon_side_padding" android:entries="@array/webtoon_side_padding"
app:title="@string/pref_webtoon_side_padding" /> app:title="@string/pref_webtoon_side_padding" />
<com.google.android.material.switchmaterial.SwitchMaterial <com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/crop_borders_webtoon" android:id="@+id/crop_borders_webtoon"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="16dp" android:paddingHorizontal="16dp"
android:paddingEnd="16dp" android:paddingVertical="16dp"
android:text="@string/pref_crop_borders" android:text="@string/pref_crop_borders"
android:textColor="?android:attr/textColorSecondary" /> android:textColor="?android:attr/textColorSecondary" />
<com.google.android.material.switchmaterial.SwitchMaterial <com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/dual_page_split" android:id="@+id/dual_page_split"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="16dp" android:paddingHorizontal="16dp"
android:paddingEnd="16dp" android:paddingVertical="16dp"
android:text="@string/pref_dual_page_split" android:text="@string/pref_dual_page_split"
android:textColor="?android:attr/textColorSecondary" /> android:textColor="?android:attr/textColorSecondary" />
<com.google.android.material.switchmaterial.SwitchMaterial <com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/dual_page_invert" android:id="@+id/dual_page_invert"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="16dp" android:paddingHorizontal="16dp"
android:paddingEnd="16dp" android:paddingVertical="16dp"
android:text="@string/pref_dual_page_invert" android:text="@string/pref_dual_page_invert"
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
android:visibility="gone" android:visibility="gone"

View File

@ -77,6 +77,8 @@
<item name="bottomNavigationStyle">@style/Widget.Tachiyomi.BottomNavigationView</item> <item name="bottomNavigationStyle">@style/Widget.Tachiyomi.BottomNavigationView</item>
<item name="navigationRailStyle">@style/Widget.Tachiyomi.NavigationRailView</item> <item name="navigationRailStyle">@style/Widget.Tachiyomi.NavigationRailView</item>
<item name="switchStyle">@style/Widget.Tachiyomi.Switch</item> <item name="switchStyle">@style/Widget.Tachiyomi.Switch</item>
<item name="materialSwitchStyle">@style/Widget.Material3.CompoundButton.MaterialSwitch</item>
<item name="switchPreferenceCompatStyle">@style/Widget.Tachiyomi.Switch</item>
<item name="sliderStyle">@style/Widget.Tachiyomi.Slider</item> <item name="sliderStyle">@style/Widget.Tachiyomi.Slider</item>
<item name="materialCardViewStyle">@style/Widget.Material3.CardView.Elevated</item> <item name="materialCardViewStyle">@style/Widget.Material3.CardView.Elevated</item>

View File

@ -57,7 +57,7 @@ natural-comparator = "com.github.gpanther:java-nat-sort:natural-comparator-1.1"
markwon = "io.noties.markwon:core:4.6.2" markwon = "io.noties.markwon:core:4.6.2"
material = "com.google.android.material:material:1.7.0-alpha01" material = "com.google.android.material:material:1.7.0-alpha02"
androidprocessbutton = "com.github.dmytrodanylyk.android-process-button:library:1.0.4" androidprocessbutton = "com.github.dmytrodanylyk.android-process-button:library:1.0.4"
flexible-adapter-core = "com.github.arkon.FlexibleAdapter:flexible-adapter:c8013533" flexible-adapter-core = "com.github.arkon.FlexibleAdapter:flexible-adapter:c8013533"
flexible-adapter-ui = "com.github.arkon.FlexibleAdapter:flexible-adapter-ui:c8013533" flexible-adapter-ui = "com.github.arkon.FlexibleAdapter:flexible-adapter-ui:c8013533"