HapeLee 1 年間 前
親
コミット
8325a17864

+ 2 - 2
app/src/main/java/io/legato/kazusa/help/update/AppUpdateGitHub.kt

@@ -26,9 +26,9 @@ object AppUpdateGitHub : AppUpdate.AppUpdateInterface {
 
     private suspend fun getLatestRelease(): List<AppReleaseInfo> {
         val lastReleaseUrl = if (checkVariant.isBeta()) {
-            "https://api.github.com/repos/gedoor/legado/releases/tags/beta"
+            "https://api.github.com/repos/HapeLee/legado/releases/tags/beta"
         } else {
-            "https://api.github.com/repos/gedoor/legado/releases/latest"
+            "https://api.github.com/repos/HapeLee/legado/releases/latest"
         }
         val res = okHttpClient.newCallResponse {
             url(lastReleaseUrl)

+ 131 - 0
app/src/main/java/io/legato/kazusa/lib/prefs/ThemeCardPreference.kt

@@ -0,0 +1,131 @@
+package io.legato.kazusa.lib.prefs
+
+import android.annotation.SuppressLint
+import android.content.Context
+import android.content.res.ColorStateList
+import android.graphics.Color
+import android.util.AttributeSet
+import android.view.ContextThemeWrapper
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.TextView
+import androidx.preference.PreferenceViewHolder
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import com.google.android.material.card.MaterialCardView
+import io.legato.kazusa.R
+import androidx.core.graphics.toColorInt
+
+@SuppressLint("ResourceType")
+class ThemeCardPreference(
+    context: Context,
+    attrs: AttributeSet
+) : Preference(context, attrs) {
+
+    private var entries: Array<CharSequence> = context.resources.getTextArray(R.array.themes_item)
+    private var entryValues: Array<CharSequence> = context.resources.getTextArray(R.array.themes_value)
+    private var currentValue: String? = null
+
+    init {
+        layoutResource = R.layout.preference_theme_card
+        widgetLayoutResource = R.layout.item_theme_card
+    }
+
+    override fun onSetInitialValue(defaultValue: Any?) {
+        currentValue = getPersistedString(defaultValue as? String ?: entryValues.getOrNull(0)?.toString())
+    }
+
+    override fun onBindViewHolder(holder: PreferenceViewHolder) {
+        super.onBindViewHolder(holder)
+
+        //val titleView = holder.findViewById(R.id.title) as TextView
+        val recyclerView = holder.findViewById(R.id.recyclerView) as RecyclerView
+
+        //titleView.text = title
+        recyclerView.layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
+        recyclerView.adapter = ThemeAdapter()
+    }
+
+    private inner class ThemeAdapter : RecyclerView.Adapter<ThemeViewHolder>() {
+        override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ThemeViewHolder {
+            val view = LayoutInflater.from(parent.context).inflate(R.layout.item_theme_card, parent, false)
+            return ThemeViewHolder(view)
+        }
+
+        @SuppressLint("NotifyDataSetChanged")
+        override fun onBindViewHolder(holder: ThemeViewHolder, position: Int) {
+            val label = entries.getOrNull(position)?.toString() ?: return
+            val value = entryValues.getOrNull(position)?.toString() ?: return
+
+            holder.label.text = label
+            holder.card.isChecked = (value == currentValue)
+
+            val colors = getThemeColors(value)
+            holder.colorTop.setCardBackgroundColor(colors[0])
+            holder.colorBook.setCardBackgroundColor(colors[1])
+            holder.colorPin.setCardBackgroundColor(colors[2])
+            holder.colorBottom.setCardBackgroundColor(colors[3])
+            holder.colorBottomLeft.setCardBackgroundColor(colors[4])
+            holder.colorBottomRight.setCardBackgroundColor(colors[5])
+            holder.background.setCardBackgroundColor(colors[6])
+            val isSelected = (value == currentValue)
+            holder.background.strokeColor = if (isSelected) colors[4] else colors[7]
+            holder.card.checkedIconTint = ColorStateList.valueOf(colors[2])
+
+
+            holder.card.setOnClickListener {
+                if (value != currentValue) {
+                    currentValue = value
+                    persistString(value)
+                    callChangeListener(value)
+                    notifyDataSetChanged()
+                }
+            }
+        }
+
+
+        override fun getItemCount(): Int = entries.size
+    }
+
+    private val themeResIdMap = mapOf(
+        "0" to R.style.Base_AppTheme,
+        "1" to R.style.Theme_Base_GR,
+        "2" to R.style.Theme_Base_WH
+    )
+
+    private fun getThemeColors(value: String): List<Int> {
+        val themeResId = themeResIdMap[value] ?: return listOf(Color.GRAY, Color.GRAY, Color.GRAY, Color.GRAY)
+
+        val themedContext = ContextThemeWrapper(context, themeResId)
+        val attrs = intArrayOf(
+            com.google.android.material.R.attr.colorOnSurface,
+            com.google.android.material.R.attr.colorSecondaryContainer,
+            com.google.android.material.R.attr.colorSecondaryVariant,
+            com.google.android.material.R.attr.colorSurfaceContainer,
+            com.google.android.material.R.attr.colorPrimary,
+            com.google.android.material.R.attr.colorOnSurfaceVariant,
+            com.google.android.material.R.attr.colorSurface,
+            com.google.android.material.R.attr.colorPrimaryFixed,
+        )
+
+        val ta = themedContext.obtainStyledAttributes(attrs)
+        return List(attrs.size) { ta.getColor(it, Color.GRAY) }.also { ta.recycle() }
+    }
+
+
+
+    class ThemeViewHolder(view: View) : RecyclerView.ViewHolder(view) {
+        val card: MaterialCardView = view.findViewById(R.id.cardView)
+        val label: TextView = view.findViewById(R.id.themeLabel)
+        val colorTop: MaterialCardView = view.findViewById(R.id.cv_title)
+        val colorBook: MaterialCardView = view.findViewById(R.id.cv_book)
+        val colorPin: MaterialCardView = view.findViewById(R.id.cv_pin)
+        val colorBottom: MaterialCardView = view.findViewById(R.id.cv_bottom)
+        val colorBottomRight: MaterialCardView = view.findViewById(R.id.right_rect)
+        val colorBottomLeft : MaterialCardView = view.findViewById(R.id.left_circle)
+        val background : MaterialCardView = view.findViewById(R.id.cardView)
+    }
+}
+
+

+ 0 - 10
app/src/main/java/io/legato/kazusa/lib/prefs/ThemeModePreference.kt

@@ -8,20 +8,15 @@ import android.view.ViewGroup
 import androidx.preference.PreferenceViewHolder
 import com.google.android.material.button.MaterialButtonToggleGroup
 import io.legato.kazusa.R
-import androidx.core.content.withStyledAttributes
 
 
 class ThemeModePreference(context: Context, attrs: AttributeSet) : Preference(context, attrs) {
 
     private var currentValue: String? = null
-    private var isBottomBackground: Boolean = false
 
     init {
         layoutResource = R.layout.view_pref
         widgetLayoutResource = R.layout.view_theme_mode
-        context.withStyledAttributes(attrs, R.styleable.Preference) {
-            isBottomBackground = getBoolean(R.styleable.Preference_isBottomBackground, false)
-        }
     }
 
     override fun onBindViewHolder(holder: PreferenceViewHolder) {
@@ -65,14 +60,9 @@ class ThemeModePreference(context: Context, attrs: AttributeSet) : Preference(co
     }
 
     override fun onSetInitialValue(defaultValue: Any?) {
-        super.onSetInitialValue(defaultValue)
         currentValue = getPersistedString(defaultValue as? String ?: "0")
     }
 
-    fun getDefaultValue(): Any {
-        return "0"
-    }
-
     override fun shouldDisableDependents(): Boolean {
         return currentValue == null || super.shouldDisableDependents()
     }

+ 3 - 0
app/src/main/java/io/legato/kazusa/lib/theme/ThemeModel.kt

@@ -0,0 +1,3 @@
+package io.legato.kazusa.lib.theme
+
+

+ 2 - 1
app/src/main/java/io/legato/kazusa/ui/config/ThemeConfigFragment.kt

@@ -23,6 +23,7 @@ import io.legato.kazusa.lib.dialogs.alert
 import io.legato.kazusa.lib.dialogs.selector
 import io.legato.kazusa.lib.prefs.ColorPreference
 import io.legato.kazusa.lib.prefs.NameListPreference
+import io.legato.kazusa.lib.prefs.ThemeCardPreference
 import io.legato.kazusa.lib.prefs.ThemeModePreference
 //import io.legado.app.lib.theme.primaryColor
 import io.legato.kazusa.ui.widget.number.NumberPickerDialog
@@ -104,7 +105,7 @@ class ThemeConfigFragment : PreferenceFragmentCompat(),
                 true
             }
         }
-        findPreference<ListPreference>(PreferKey.themePref)?.let {
+        findPreference<ThemeCardPreference>(PreferKey.themePref)?.let {
             it.setOnPreferenceChangeListener { _, _ ->
                 val intent = requireActivity().intent
                 requireActivity().finish()

+ 6 - 0
app/src/main/res/drawable/rounded_rect.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <solid android:color="@android:color/white" />
+    <corners android:radius="8dp" />
+</shape>

+ 121 - 0
app/src/main/res/layout/item_theme_card.xml

@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:layout_marginEnd="12dp"
+    android:orientation="vertical"
+    android:gravity="center_horizontal">
+
+
+    <!-- 四色预览框 -->
+    <com.google.android.material.card.MaterialCardView
+        android:id="@+id/cardView"
+        android:layout_width="112dp"
+        android:layout_height="200dp"
+        android:layout_marginBottom="8dp"
+        app:cardCornerRadius="20dp"
+        app:cardBackgroundColor="#000000"
+        android:checkable="true"
+        app:strokeWidth="4dp"
+        android:clickable="true"
+        android:focusable="true">
+
+        <androidx.constraintlayout.widget.ConstraintLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent">
+
+            <!-- 一号:左上角 -->
+            <com.google.android.material.card.MaterialCardView
+                android:id="@+id/cv_title"
+                android:layout_width="64dp"
+                android:layout_height="16dp"
+                android:layout_margin="12dp"
+                app:strokeWidth="0dp"
+                app:cardCornerRadius="8dp"
+                app:cardBackgroundColor="#FF0000"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintStart_toStartOf="parent" />
+
+
+            <com.google.android.material.card.MaterialCardView
+                android:id="@+id/cv_book"
+                android:layout_width="56dp"
+                android:layout_height="80dp"
+                android:layout_marginTop="8dp"
+                app:strokeWidth="0dp"
+                app:cardCornerRadius="8dp"
+                app:cardBackgroundColor="#FFFF00"
+                app:layout_constraintTop_toBottomOf="@id/cv_title"
+                app:layout_constraintStart_toStartOf="@id/cv_title" />
+
+            <!-- 三号:在二号内部的右上角 -->
+            <com.google.android.material.card.MaterialCardView
+                android:id="@+id/cv_pin"
+                android:layout_width="20dp"
+                android:layout_height="12dp"
+                android:layout_margin="4dp"
+                app:strokeWidth="0dp"
+                app:cardCornerRadius="4dp"
+                app:cardBackgroundColor="#0000FF"
+                app:layout_constraintTop_toTopOf="@id/cv_book"
+                app:layout_constraintEnd_toEndOf="@id/cv_book" />
+
+            <!-- 四号:最下方 -->
+            <com.google.android.material.card.MaterialCardView
+                android:id="@+id/cv_bottom"
+                android:layout_width="match_parent"
+                android:layout_height="32dp"
+                android:layout_margin="4dp"
+                app:strokeWidth="0dp"
+                app:cardCornerRadius="0dp"
+                app:cardBackgroundColor="#FFFF00"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintEnd_toEndOf="parent" >
+                <androidx.constraintlayout.widget.ConstraintLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent">
+
+                    <com.google.android.material.card.MaterialCardView
+                        android:id="@+id/left_circle"
+                        android:layout_width="20dp"
+                        android:layout_height="20dp"
+                        app:cardCornerRadius="24dp"
+                        app:cardBackgroundColor="#000000"
+                        app:strokeWidth="0dp"
+                        app:layout_constraintStart_toStartOf="parent"
+                        app:layout_constraintTop_toTopOf="parent"
+                        app:layout_constraintBottom_toBottomOf="parent"
+                        android:layout_marginStart="8dp"/>
+
+                    <com.google.android.material.card.MaterialCardView
+                        android:id="@+id/right_rect"
+                        android:layout_width="62dp"
+                        android:layout_height="16dp"
+                        app:cardCornerRadius="8dp"
+                        app:cardBackgroundColor="#000000"
+                        app:strokeWidth="0dp"
+                        app:layout_constraintEnd_toEndOf="parent"
+                        app:layout_constraintTop_toTopOf="parent"
+                        app:layout_constraintBottom_toBottomOf="parent"
+                        android:layout_marginEnd="8dp"/>
+
+                </androidx.constraintlayout.widget.ConstraintLayout>
+
+            </com.google.android.material.card.MaterialCardView>
+
+        </androidx.constraintlayout.widget.ConstraintLayout>
+
+    </com.google.android.material.card.MaterialCardView>
+
+    <!-- 主题名称 -->
+    <TextView
+        android:id="@+id/themeLabel"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="主题名"
+        android:textSize="14sp" />
+
+</LinearLayout>
+

+ 15 - 0
app/src/main/res/layout/preference_theme_card.xml

@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical"
+    android:paddingVertical="8dp">
+
+    <androidx.recyclerview.widget.RecyclerView
+        android:id="@+id/recyclerView"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:paddingStart="16dp"
+        android:orientation="vertical" />
+
+</LinearLayout>

+ 6 - 0
app/src/main/res/layout/view_theme_mode.xml

@@ -12,6 +12,8 @@
     <com.google.android.material.button.MaterialButton
         android:id="@+id/btn_system"
         style="@style/Widget.Material3.Button.OutlinedButton"
+        app:checkedIcon="@drawable/ic_check"
+        android:checkable="true"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
         android:layout_weight="1"
@@ -20,6 +22,8 @@
     <com.google.android.material.button.MaterialButton
         android:id="@+id/btn_light"
         style="@style/Widget.Material3.Button.OutlinedButton"
+        app:checkedIcon="@drawable/ic_check"
+        android:checkable="true"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
         android:layout_weight="1"
@@ -28,6 +32,8 @@
     <com.google.android.material.button.MaterialButton
         android:id="@+id/btn_dark"
         style="@style/Widget.Material3.Button.OutlinedButton"
+        app:checkedIcon="@drawable/ic_check"
+        android:checkable="true"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
         android:layout_weight="1"

+ 7 - 7
app/src/main/res/values-zh/strings.xml

@@ -67,12 +67,12 @@
     <string name="book_local">添加本地</string>
     <string name="book_source">书源</string>
     <string name="book_source_manage">书源管理</string>
-    <string name="book_source_manage_desc">新建、导入、编辑或管理书源</string>
+    <string name="book_source_manage_desc">新建 • 导入 • 编辑或管理书源</string>
     <string name="setting">设置</string>
-    <string name="theme_setting">主题设置</string>
-    <string name="theme_setting_s">与界面/颜色相关的一些设置</string>
-    <string name="other_setting">其它设置</string>
-    <string name="other_setting_s">与功能相关的一些设置</string>
+    <string name="theme_setting">外观</string>
+    <string name="theme_setting_s">主题 • 深色模式 • 界面设置</string>
+    <string name="other_setting">高级</string>
+    <string name="other_setting_s">语言 • 其他设置</string>
     <string name="about">关于</string>
     <string name="donate">捐赠</string>
     <string name="exit">退出</string>
@@ -111,7 +111,7 @@
     <string name="ps_auto_download">更新书籍时自动下载最新章节</string>
     <string name="backup_restore">备份与恢复</string>
     <string name="web_dav_set">WebDav 设置</string>
-    <string name="web_dav_set_import_old">WebDav 设置/导入旧版本数据</string>
+    <string name="web_dav_set_import_old">WebDav 设置 • 导入旧版本数据</string>
     <string name="backup">备份</string>
     <string name="restore">恢复</string>
     <string name="backup_permission">备份请给予存储权限</string>
@@ -590,7 +590,7 @@
     <string name="add_replace_rule">新建替换</string>
     <string name="group">分组</string>
     <string name="group_s">分组:%s</string>
-    <string name="toc_s">目录:%s</string>
+    <string name="toc_s">已读:%s</string>
     <string name="enable_explore">启用发现</string>
     <string name="disable_explore">禁用发现</string>
     <string name="enable_selection">启用所选</string>

+ 2 - 1
app/src/main/res/values/attrs.xml

@@ -235,4 +235,5 @@
             <enum name="right_bottom_fill" value="7" />
         </attr>
     </declare-styleable>
-</resources>
+
+</resources>

+ 56 - 113
app/src/main/res/xml/pref_config_theme.xml

@@ -2,102 +2,77 @@
 <androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto">
 
-
-    <io.legato.kazusa.lib.prefs.ThemeModePreference
-        android:defaultValue="0"
-        android:entries="@array/theme_mode"
-        android:entryValues="@array/theme_mode_v"
-        android:key="themeMode"
-        android:title="@string/theme_mode"
-        android:summary="切换浅色/深色/跟随系统" />
-
-    <io.legato.kazusa.lib.prefs.NameListPreference
-        android:key="app_theme"
-        android:title="应用主题"
-        android:summary="喵喵喵"
-        android:entries="@array/themes_item"
-        android:entryValues="@array/themes_value"
-        android:defaultValue="0" />
-
-    <io.legato.kazusa.lib.prefs.IconListPreference
-        android:defaultValue="ic_launcher"
-        android:entries="@array/icon_names"
-        android:entryValues="@array/icons"
-        android:key="launcherIcon"
-        android:summary="@string/change_icon_summary"
-        android:title="@string/change_icon"
-        app:iconSpaceReserved="false"
-        app:icons="@array/icons" />
-
-    <io.legato.kazusa.lib.prefs.Preference
-        android:key="welcomeStyle"
-        android:title="@string/welcome_style"
-        android:summary="@string/welcome_style_summary" />
-
-    <io.legato.kazusa.lib.prefs.Preference
-        android:key="fontScale"
-        android:summary="@string/font_scale_summary"
-        android:title="@string/font_scale"
-        app:iconSpaceReserved="false" />
-
-    <io.legato.kazusa.lib.prefs.Preference
-        android:key="coverConfig"
-        android:title="@string/cover_config"
-        android:summary="@string/cover_config_summary"
-        app:allowDividerAbove="false"
-        app:allowDividerBelow="false"
-        app:iconSpaceReserved="false" />
-
-    <io.legato.kazusa.lib.prefs.Preference
-        android:key="themeList"
-        android:summary="@string/theme_list_summary"
-        android:title="@string/theme_list"
-        app:allowDividerAbove="false"
-        app:allowDividerBelow="false"
-        app:iconSpaceReserved="false" />
-
     <io.legato.kazusa.lib.prefs.PreferenceCategory
-        android:key="dayThemeCategory"
-        android:title="@string/day"
+        android:key="themeCategory"
+        android:title="@string/theme"
         app:allowDividerAbove="true"
         app:allowDividerBelow="false"
         app:iconSpaceReserved="false"
         app:layout="@layout/view_preference_category">
 
-        <io.legato.kazusa.lib.prefs.ColorPreference
-            android:defaultValue="@color/md_brown_500"
-            android:key="colorPrimary"
-            android:summary="@string/day_color_primary"
-            android:title="@string/primary"
-            app:cpv_dialogType="preset"
-            app:iconSpaceReserved="false" />
+        <io.legato.kazusa.lib.prefs.ThemeModePreference
+            android:defaultValue="0"
+            android:entries="@array/theme_mode"
+            android:entryValues="@array/theme_mode_v"
+            android:key="themeMode"
+            android:title="@string/theme_mode"
+            android:summary="切换浅色/深色/跟随系统" />
+
+        <io.legato.kazusa.lib.prefs.ThemeCardPreference
+            android:key="app_theme"
+            android:title="应用主题"
+            android:summary="喵喵喵"
+            android:entries="@array/themes_item"
+            android:entryValues="@array/themes_value"
+            android:defaultValue="0" />
+
+        <io.legato.kazusa.lib.prefs.IconListPreference
+            android:defaultValue="ic_launcher"
+            android:entries="@array/icon_names"
+            android:entryValues="@array/icons"
+            android:key="launcherIcon"
+            android:summary="@string/change_icon_summary"
+            android:title="@string/change_icon"
+            app:iconSpaceReserved="false"
+            app:icons="@array/icons" />
 
-        <io.legato.kazusa.lib.prefs.ColorPreference
-            android:defaultValue="@color/md_red_600"
-            android:key="colorAccent"
-            android:summary="@string/day_color_accent"
-            android:title="@string/accent"
-            app:cpv_dialogType="preset"
+        <io.legato.kazusa.lib.prefs.Preference
+            android:key="welcomeStyle"
+            android:title="@string/welcome_style"
+            android:summary="@string/welcome_style_summary" />
+
+        <io.legato.kazusa.lib.prefs.Preference
+            android:key="fontScale"
+            android:summary="@string/font_scale_summary"
+            android:title="@string/font_scale"
             app:iconSpaceReserved="false" />
 
-        <io.legato.kazusa.lib.prefs.ColorPreference
-            android:defaultValue="@color/md_grey_100"
-            android:key="colorBackground"
-            android:summary="@string/day_background_color"
-            android:title="@string/background_color"
-            app:cpv_dialogType="preset"
+        <io.legato.kazusa.lib.prefs.Preference
+            android:key="coverConfig"
+            android:title="@string/cover_config"
+            android:summary="@string/cover_config_summary"
+            app:allowDividerAbove="false"
+            app:allowDividerBelow="false"
             app:iconSpaceReserved="false" />
 
-        <io.legato.kazusa.lib.prefs.ColorPreference
-            android:defaultValue="@color/md_grey_200"
-            android:key="colorBottomBackground"
-            android:summary="@string/day_navbar_color"
-            android:title="@string/navbar_color"
+        <io.legato.kazusa.lib.prefs.Preference
+            android:key="themeList"
+            android:summary="@string/theme_list_summary"
+            android:title="@string/theme_list"
             app:allowDividerAbove="false"
             app:allowDividerBelow="false"
-            app:cpv_dialogType="preset"
             app:iconSpaceReserved="false" />
 
+    </io.legato.kazusa.lib.prefs.PreferenceCategory>
+
+    <io.legato.kazusa.lib.prefs.PreferenceCategory
+        android:key="dayThemeCategory"
+        android:title="@string/day"
+        app:allowDividerAbove="true"
+        app:allowDividerBelow="false"
+        app:iconSpaceReserved="false"
+        app:layout="@layout/view_preference_category">
+
         <io.legato.kazusa.lib.prefs.Preference
             android:key="backgroundImage"
             android:title="@string/background_image" />
@@ -120,38 +95,6 @@
         app:iconSpaceReserved="false"
         app:layout="@layout/view_preference_category">
 
-        <io.legato.kazusa.lib.prefs.ColorPreference
-            android:defaultValue="@color/md_blue_grey_600"
-            android:key="colorPrimaryNight"
-            android:summary="@string/night_primary"
-            android:title="@string/primary"
-            app:cpv_dialogType="preset"
-            app:iconSpaceReserved="false" />
-
-        <io.legato.kazusa.lib.prefs.ColorPreference
-            android:defaultValue="@color/md_deep_orange_800"
-            android:key="colorAccentNight"
-            android:summary="@string/night_accent"
-            android:title="@string/accent"
-            app:cpv_dialogType="preset"
-            app:iconSpaceReserved="false" />
-
-        <io.legato.kazusa.lib.prefs.ColorPreference
-            android:defaultValue="@color/md_grey_900"
-            android:key="colorBackgroundNight"
-            android:summary="@string/night_background_color"
-            android:title="@string/background_color"
-            app:cpv_dialogType="preset"
-            app:iconSpaceReserved="false" />
-
-        <io.legato.kazusa.lib.prefs.ColorPreference
-            android:defaultValue="@color/md_grey_850"
-            android:key="colorBottomBackgroundNight"
-            android:summary="@string/night_navbar_color"
-            android:title="@string/navbar_color"
-            app:cpv_dialogType="preset"
-            app:iconSpaceReserved="false" />
-
         <io.legato.kazusa.lib.prefs.Preference
             android:key="backgroundImageNight"
             android:title="@string/background_image" />

+ 32 - 22
app/src/main/res/xml/pref_main.xml

@@ -11,27 +11,6 @@
         android:title="@string/book_source_manage"
         app:iconSpaceReserved="false" />
 
-    <io.legato.kazusa.lib.prefs.Preference
-        android:icon="@drawable/ic_cfg_txt"
-        android:key="txtTocRuleManage"
-        android:summary="@string/config_txt_toc_rule"
-        android:title="@string/txt_toc_rule"
-        app:iconSpaceReserved="false" />
-
-    <io.legato.kazusa.lib.prefs.Preference
-        android:icon="@drawable/ic_cfg_replace"
-        android:key="replaceManage"
-        android:summary="@string/replace_purify_desc"
-        android:title="@string/replace_purify"
-        app:iconSpaceReserved="false" />
-
-    <io.legato.kazusa.lib.prefs.Preference
-        android:icon="@drawable/ic_translate"
-        android:key="dictRuleManage"
-        android:summary="@string/config_dict_rule"
-        android:title="@string/dict_rule"
-        app:iconSpaceReserved="false" />
-
     <io.legato.kazusa.lib.prefs.SwitchPreference
         android:defaultValue="false"
         android:icon="@drawable/ic_cfg_web"
@@ -45,7 +24,8 @@
         android:title="@string/setting"
         app:allowDividerAbove="true"
         app:allowDividerBelow="false"
-        app:iconSpaceReserved="false">
+        app:iconSpaceReserved="false"
+        app:layout="@layout/view_preference_category">
 
         <io.legato.kazusa.lib.prefs.Preference
             android:icon="@drawable/ic_cfg_backup"
@@ -71,6 +51,36 @@
 
     </io.legato.kazusa.lib.prefs.PreferenceCategory>
 
+    <io.legato.kazusa.lib.prefs.PreferenceCategory
+        android:title="规则"
+        app:allowDividerAbove="true"
+        app:allowDividerBelow="false"
+        app:iconSpaceReserved="false"
+        app:layout="@layout/view_preference_category">
+
+    <io.legato.kazusa.lib.prefs.Preference
+        android:icon="@drawable/ic_cfg_txt"
+        android:key="txtTocRuleManage"
+        android:summary="@string/config_txt_toc_rule"
+        android:title="@string/txt_toc_rule"
+        app:iconSpaceReserved="false" />
+
+    <io.legato.kazusa.lib.prefs.Preference
+        android:icon="@drawable/ic_cfg_replace"
+        android:key="replaceManage"
+        android:summary="@string/replace_purify_desc"
+        android:title="@string/replace_purify"
+        app:iconSpaceReserved="false" />
+
+    <io.legato.kazusa.lib.prefs.Preference
+        android:icon="@drawable/ic_translate"
+        android:key="dictRuleManage"
+        android:summary="@string/config_dict_rule"
+        android:title="@string/dict_rule"
+        app:iconSpaceReserved="false" />
+
+    </io.legato.kazusa.lib.prefs.PreferenceCategory>
+
     <io.legato.kazusa.lib.prefs.PreferenceCategory
         android:key="aboutCategory"
         android:title="@string/other"