Skip to content

Commit

Permalink
Add icons for each preference
Browse files Browse the repository at this point in the history
  • Loading branch information
Super12138 committed Jan 14, 2024
1 parent d0e8d76 commit d04699e
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 1 deletion.
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/about_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z" />
</vector>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/dark_mode_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M12,3c-4.97,0 -9,4.03 -9,9s4.03,9 9,9s9,-4.03 9,-9c0,-0.46 -0.04,-0.92 -0.1,-1.36c-0.98,1.37 -2.58,2.26 -4.4,2.26c-2.98,0 -5.4,-2.42 -5.4,-5.4c0,-1.81 0.89,-3.42 2.26,-4.4C12.92,3.04 12.46,3 12,3L12,3z" />
</vector>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/screenshot_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M17,1.01L7,1C5.9,1 5,1.9 5,3v18c0,1.1 0.9,2 2,2h10c1.1,0 2,-0.9 2,-2V3C19,1.9 18.1,1.01 17,1.01zM17,18H7V6h10V18zM9.5,8.5H12V7H8v4h1.5V8.5zM12,17h4v-4h-1.5v2.5H12V17z" />
</vector>
8 changes: 8 additions & 0 deletions app/src/main/res/layout/preference_material_switch.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<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:background="@null"
android:clickable="false"
android:focusable="false" />
18 changes: 18 additions & 0 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,25 @@
<item name="colorSurfaceContainer">@color/md_theme_surfaceContainer</item>
<item name="colorSurfaceContainerHigh">@color/md_theme_surfaceContainerHigh</item>
<item name="colorSurfaceContainerHighest">@color/md_theme_surfaceContainerHighest</item>

<item name="preferenceTheme">@style/AppPreferenceThemeOverlay</item>
<item name="alertDialogTheme">@style/ToDo.M3AlertDialog</item>
</style>

<style name="Theme.ToDo" parent="Base.Theme.ToDo" />

<style name="AppPreferenceThemeOverlay" parent="@style/PreferenceThemeOverlay">
<item name="switchPreferenceCompatStyle">@style/AppSwitchPreference</item>
</style>

<style name="AppSwitchPreference" parent="@style/Preference.SwitchPreferenceCompat.Material">
<item name="widgetLayout">@layout/preference_material_switch</item>
</style>

<style name="ToDo.M3AlertDialog" parent="ThemeOverlay.Material3.MaterialAlertDialog">
<item name="dialogCornerRadius">28dp</item>
<item name="cornerFamily">rounded</item>
<item name="android:colorBackground">?attr/colorSurfaceContainerHigh</item>
<item name="android:layout">@layout/m3_alert_dialog</item>
</style>
</resources>
6 changes: 5 additions & 1 deletion app/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto">
<PreferenceCategory app:title="@string/appearance">
<ListPreference
android:icon="@drawable/dark_mode_24"
android:defaultValue="0"
android:entries="@array/appearance"
android:entryValues="@array/appearance_value"
Expand All @@ -20,14 +21,17 @@
app:dialogMessage="多个项目请使用英文逗号隔开"
app:summary="自定义创建待办时文本框的预测项" />-->
<SwitchPreferenceCompat
android:icon="@drawable/screenshot_24"
app:defaultValue="false"
app:key="secure_mode"
app:title="@string/secure_mode"
app:summary="@string/secure_mode_summary" />
</PreferenceCategory>

<PreferenceCategory android:title="@string/others">
<Preference app:title="@string/about_label">
<Preference
android:icon="@drawable/about_24"
app:title="@string/about_label">
<intent
android:targetClass="cn.super12138.todo.views.about.AboutActivity"
android:targetPackage="cn.super12138.todo" />
Expand Down

0 comments on commit d04699e

Please sign in to comment.