Use the new MaterialSwitch component (#473)

This commit is contained in:
发光长颈鹿
2022-09-26 21:36:42 +08:00
committed by GitHub
parent 4fa2ce306a
commit 39d7812b61
5 changed files with 62 additions and 1 deletions
+4
View File
@@ -89,6 +89,10 @@ android {
}
}
configurations.all {
exclude group: 'androidx.lifecycle', module: 'lifecycle-viewmodel-ktx'
}
kapt {
arguments {
arg ('eventBusIndex', 'com.itsaky.androidide.events.AppEventsIndex')
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ This file is part of AndroidIDE.
~
~ AndroidIDE is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ AndroidIDE is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:alpha="@dimen/m3_comp_switch_disabled_track_opacity"
android:color="?attr/colorSurfaceVariant"
android:state_enabled="false" android:state_checked="false"/>
<item android:alpha="@dimen/m3_comp_switch_disabled_track_opacity"
android:color="?attr/colorOnSurface"
android:state_enabled="false" android:state_checked="true"/>
<item android:color="@color/secondaryLightColor" android:state_checked="true"/>
<item android:color="?attr/colorSurfaceVariant"/>
</selector>
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ This file is part of AndroidIDE.
~
~ AndroidIDE is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ AndroidIDE is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
-->
<com.google.android.material.materialswitch.MaterialSwitch xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@android:id/switch_widget"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="false"
android:focusable="false"
app:trackTint="@color/material_switch_track_tint" />
+7
View File
@@ -4,6 +4,8 @@
<item name="actionOverflowButtonStyle">@style/AppTheme.Toolbar.OverflowButton</item>
<item name="colorPrimary">@color/primaryColor</item>
<item name="colorPrimaryDark">@color/primaryDarkColor</item>
<item name="colorOnPrimary">@color/secondaryDarkColor</item>
<item name="colorPrimaryContainer">@color/secondaryColor</item>
<item name="colorAccent">@color/secondaryColor</item>
<item name="colorSurface">@color/surfaceColor</item>
<item name="colorButtonNormal">@color/secondaryColor</item>
@@ -22,6 +24,7 @@
<item name="android:textColorSecondary">@color/secondaryTextColor</item>
<item name="android:windowBackground">@color/content_background</item>
<item name="android:fontFamily">@font/josefin_sans</item>
<item name="switchPreferenceStyle">@style/AppTheme.SwitchPreference</item>
</style>
<style name="AppTheme.Splash" parent="Theme.SplashScreen">
@@ -34,6 +37,10 @@
<item name="android:windowLightStatusBar">false</item>
</style>
<style name="AppTheme.SwitchPreference" parent="Preference.SwitchPreference.Material">
<item name="android:widgetLayout">@layout/preference_widget_materialswitch</item>
</style>
<style name="AppTheme.CheckBox" parent="Widget.Material3.CompoundButton.CheckBox">
<item name="buttonTint">@color/secondaryColor</item>
</style>
+1 -1
View File
@@ -50,7 +50,7 @@ ext {
]
google = [
material : 'com.google.android.material:material:1.6.1',
material : 'com.google.android.material:material:1.7.0-rc01',
gson : 'com.google.code.gson:gson:2.9.1',
guava : 'com.google.guava:guava:31.1-android',
guava_jre : 'com.google.guava:guava:31.1-jre',