Преглед изворни кода

工具栏自定义与优化 #242、#243

HapeLee пре 1 година
родитељ
комит
858ba70c09

+ 1 - 0
app/src/main/java/io/legado/app/constant/PreferKey.kt

@@ -211,4 +211,5 @@ object PreferKey {
     const val systemMediaControlCompatibilityChange = "systemMediaControlCompatibilityChange"
     const val systemMediaControlCompatibilityChange = "systemMediaControlCompatibilityChange"
     const val isPredictiveBackEnabled = "isPredictiveBackEnabled"
     const val isPredictiveBackEnabled = "isPredictiveBackEnabled"
     const val replaceSortMode = "desc"
     const val replaceSortMode = "desc"
+    const val readBarStyle = "0"
 }
 }

+ 7 - 0
app/src/main/java/io/legado/app/help/config/AppConfig.kt

@@ -648,12 +648,19 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener {
         set(value) {
         set(value) {
             appCtx.putPrefBoolean(PreferKey.showReadTitleAddition, value)
             appCtx.putPrefBoolean(PreferKey.showReadTitleAddition, value)
         }
         }
+
     var readBarStyleFollowPage: Boolean
     var readBarStyleFollowPage: Boolean
         get() = appCtx.getPrefBoolean(PreferKey.readBarStyleFollowPage, false)
         get() = appCtx.getPrefBoolean(PreferKey.readBarStyleFollowPage, false)
         set(value) {
         set(value) {
             appCtx.putPrefBoolean(PreferKey.readBarStyleFollowPage, value)
             appCtx.putPrefBoolean(PreferKey.readBarStyleFollowPage, value)
         }
         }
 
 
+    var readBarStyle: Int
+        get() = appCtx.getPrefInt(PreferKey.readBarStyle, 0)
+        set(value) {
+            appCtx.putPrefInt(PreferKey.readBarStyle, value)
+        }
+
     var sourceEditMaxLine: Int
     var sourceEditMaxLine: Int
         get() {
         get() {
             val maxLine = appCtx.getPrefInt(PreferKey.sourceEditMaxLine, Int.MAX_VALUE)
             val maxLine = appCtx.getPrefInt(PreferKey.sourceEditMaxLine, Int.MAX_VALUE)

+ 62 - 0
app/src/main/java/io/legado/app/help/config/ReadBookConfig.kt

@@ -580,6 +580,10 @@ object ReadBookConfig {
         var name: String = "",
         var name: String = "",
         var bgStr: String = "#EEEEEE",//白天背景
         var bgStr: String = "#EEEEEE",//白天背景
         var bgStrNight: String = "#000000",//夜间背景
         var bgStrNight: String = "#000000",//夜间背景
+        var menuBgColor: String = "#EEEFE3",
+        var menuAcColor: String = "#EEEFE3",
+        var menuBgColorNight: String = "#BFCBAD",
+        var menuAcColorNight: String = "#586249",
         var bgStrEInk: String = "#FFFFFF",//EInk背景
         var bgStrEInk: String = "#FFFFFF",//EInk背景
         var bgAlpha: Int = 100,//背景透明度
         var bgAlpha: Int = 100,//背景透明度
         var bgType: Int = 0,//白天背景类型 0:颜色, 1:assets图片, 2其它图片
         var bgType: Int = 0,//白天背景类型 0:颜色, 1:assets图片, 2其它图片
@@ -662,6 +666,18 @@ object ReadBookConfig {
         @Transient
         @Transient
         private var textColorSInt = -1
         private var textColorSInt = -1
 
 
+        @Transient
+        private var menuBgColorInt = -1
+
+        @Transient
+        private var menuBgColorNightInt = -1
+
+        @Transient
+        private var menuAcColorInt = -1
+
+        @Transient
+        private var menuAcColorNightInt = -1
+
         @Transient
         @Transient
         private var initColorInt = false
         private var initColorInt = false
 
 
@@ -671,6 +687,10 @@ object ReadBookConfig {
             textColorInt = textColor.toColorInt()
             textColorInt = textColor.toColorInt()
             textColorSIntNight = shadowColorN.toColorInt()
             textColorSIntNight = shadowColorN.toColorInt()
             textColorSInt = shadowColor.toColorInt()
             textColorSInt = shadowColor.toColorInt()
+            menuBgColorInt = menuBgColor.toColorInt()
+            menuBgColorNightInt = menuBgColorNight.toColorInt()
+            menuAcColorInt = menuAcColor.toColorInt()
+            menuAcColorNightInt = menuAcColorNight.toColorInt()
             initColorInt = true
             initColorInt = true
         }
         }
 
 
@@ -784,6 +804,48 @@ object ReadBookConfig {
             }
             }
         }
         }
 
 
+        fun curMenuBg(): Int {
+            return when {
+                AppConfig.isNightTheme -> menuBgColorNightInt
+                else -> menuBgColorInt
+            }
+        }
+
+        fun setMenuCurBg(bg: Int) {
+            when {
+                AppConfig.isNightTheme -> {
+                    menuBgColorNight = "#${bg.hexString}"
+                    menuBgColorNightInt = bg
+                }
+
+                else -> {
+                    menuBgColor = "#${bg.hexString}"
+                    menuBgColorInt = bg
+                }
+            }
+        }
+
+        fun curMenuAc(): Int {
+            return when {
+                AppConfig.isNightTheme -> menuAcColorNightInt
+                else -> menuAcColorInt
+            }
+        }
+
+        fun setMenuCurAc(bg: Int) {
+            when {
+                AppConfig.isNightTheme -> {
+                    menuAcColorNight = "#${bg.hexString}"
+                    menuAcColorNightInt = bg
+                }
+
+                else -> {
+                    menuAcColor = "#${bg.hexString}"
+                    menuAcColorInt = bg
+                }
+            }
+        }
+
         fun curBgType(): Int {
         fun curBgType(): Int {
             return when {
             return when {
                 AppConfig.isEInkMode -> bgTypeEInk
                 AppConfig.isEInkMode -> bgTypeEInk

+ 19 - 2
app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt

@@ -79,6 +79,8 @@ import io.legado.app.ui.book.read.config.BgTextConfigDialog.Companion.TEXT_COLOR
 import io.legado.app.ui.book.read.config.FontSelectDialog.Companion.S_COLOR
 import io.legado.app.ui.book.read.config.FontSelectDialog.Companion.S_COLOR
 import io.legado.app.ui.book.read.config.ReadAloudDialog
 import io.legado.app.ui.book.read.config.ReadAloudDialog
 import io.legado.app.ui.book.read.config.ReadStyleDialog
 import io.legado.app.ui.book.read.config.ReadStyleDialog
+import io.legado.app.ui.book.read.config.TipConfigDialog.Companion.A_COLOR
+import io.legado.app.ui.book.read.config.TipConfigDialog.Companion.B_COLOR
 import io.legado.app.ui.book.read.config.TipConfigDialog.Companion.TIP_COLOR
 import io.legado.app.ui.book.read.config.TipConfigDialog.Companion.TIP_COLOR
 import io.legado.app.ui.book.read.config.TipConfigDialog.Companion.TIP_DIVIDER_COLOR
 import io.legado.app.ui.book.read.config.TipConfigDialog.Companion.TIP_DIVIDER_COLOR
 import io.legado.app.ui.book.read.config.ToolButtonConfigDialog
 import io.legado.app.ui.book.read.config.ToolButtonConfigDialog
@@ -126,6 +128,7 @@ import io.legado.app.utils.showHelp
 import io.legado.app.utils.startActivity
 import io.legado.app.utils.startActivity
 import io.legado.app.utils.startActivityForBook
 import io.legado.app.utils.startActivityForBook
 import io.legado.app.utils.sysScreenOffTime
 import io.legado.app.utils.sysScreenOffTime
+import io.legado.app.utils.themeColor
 import io.legado.app.utils.throttle
 import io.legado.app.utils.throttle
 import io.legado.app.utils.toastOnUi
 import io.legado.app.utils.toastOnUi
 import io.legado.app.utils.visible
 import io.legado.app.utils.visible
@@ -278,13 +281,17 @@ class ReadBookActivity : BaseReadBookActivity(),
             window.sharedElementReturnTransition = transform
             window.sharedElementReturnTransition = transform
         }
         }
         super.onCreate(savedInstanceState)
         super.onCreate(savedInstanceState)
-
         if (AppConfig.sharedElementEnterTransitionEnable){
         if (AppConfig.sharedElementEnterTransitionEnable){
             binding.rootView.transitionName = intent.getStringExtra("transitionName")
             binding.rootView.transitionName = intent.getStringExtra("transitionName")
         }
         }
         upScreenTimeOut()
         upScreenTimeOut()
         ReadBook.register(this)
         ReadBook.register(this)
-
+        binding.readMenu.colorSurfaceContainer =
+            themeColor(com.google.android.material.R.attr.colorSurfaceContainer)
+        binding.readMenu.colorSecondary =
+            themeColor(androidx.appcompat.R.attr.colorPrimary)
+        binding.readMenu.colorSecondaryContainer =
+            themeColor(com.google.android.material.R.attr.colorSecondaryContainer)
         binding.cursorLeft.setOnTouchListener(this)
         binding.cursorLeft.setOnTouchListener(this)
         binding.cursorRight.setOnTouchListener(this)
         binding.cursorRight.setOnTouchListener(this)
 
 
@@ -1538,6 +1545,16 @@ class ReadBookActivity : BaseReadBookActivity(),
                 postEvent(EventBus.TIP_COLOR, "")
                 postEvent(EventBus.TIP_COLOR, "")
                 postEvent(EventBus.UP_CONFIG, arrayListOf(2))
                 postEvent(EventBus.UP_CONFIG, arrayListOf(2))
             }
             }
+
+            B_COLOR -> {
+                setMenuCurBg(color)
+                postEvent(EventBus.UPDATE_READ_ACTION_BAR, true)
+            }
+
+            A_COLOR -> {
+                setMenuCurAc(color)
+                postEvent(EventBus.UPDATE_READ_ACTION_BAR, true)
+            }
         }
         }
     }
     }
 
 

+ 63 - 28
app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt

@@ -15,6 +15,7 @@ import android.widget.FrameLayout
 import android.widget.SeekBar
 import android.widget.SeekBar
 import androidx.appcompat.widget.PopupMenu
 import androidx.appcompat.widget.PopupMenu
 import androidx.core.graphics.ColorUtils
 import androidx.core.graphics.ColorUtils
+import androidx.core.graphics.toColorInt
 import androidx.core.view.doOnAttach
 import androidx.core.view.doOnAttach
 import androidx.core.view.isGone
 import androidx.core.view.isGone
 import androidx.core.view.isVisible
 import androidx.core.view.isVisible
@@ -27,6 +28,7 @@ import io.legado.app.constant.PreferKey
 import io.legado.app.databinding.ViewReadMenuBinding
 import io.legado.app.databinding.ViewReadMenuBinding
 import io.legado.app.help.config.AppConfig
 import io.legado.app.help.config.AppConfig
 import io.legado.app.help.config.LocalConfig
 import io.legado.app.help.config.LocalConfig
+import io.legado.app.help.config.ReadBookConfig
 import io.legado.app.help.config.ThemeConfig
 import io.legado.app.help.config.ThemeConfig
 import io.legado.app.help.coroutine.Coroutine
 import io.legado.app.help.coroutine.Coroutine
 import io.legado.app.help.source.getSourceType
 import io.legado.app.help.source.getSourceType
@@ -87,25 +89,51 @@ class ReadMenu @JvmOverloads constructor(
         fillAfter = true
         fillAfter = true
     }
     }
 
 
-//    private val immersiveMenu: Boolean
-//        get() = AppConfig.readBarStyleFollowPage && ReadBookConfig.durConfig.curBgType() == 0
-//    private var bgColor: Int = if (immersiveMenu) {
-//        kotlin.runCatching {
-//            ReadBookConfig.durConfig.curBgStr().toColorInt()
-//        }.getOrDefault(context.bottomBackground)
-//    } else {
-//        context.bottomBackground
-//    }
-//    private var textColor: Int = if (immersiveMenu) {
-//        ReadBookConfig.durConfig.curTextColor()
-//    } else {
-//        context.getPrimaryTextColor(ColorUtils.isColorLight(bgColor))
-//    }
+    var colorSurfaceContainer: Int = context.themeColor(com.google.android.material.R.attr.colorSurfaceContainer)
+        set(value) {
+            field = value
+        }
+
+    var colorSecondary: Int = context.themeColor(androidx.appcompat.R.attr.colorPrimary)
+        set(value) {
+            field = value
+        }
+
+    var colorSecondaryContainer: Int = context.themeColor(com.google.android.material.R.attr.colorSecondaryContainer)
+        set(value) {
+            field = value
+        }
+
+    private val bgColor: Int
+        get() = when (AppConfig.readBarStyle) {
+            0 -> colorSurfaceContainer
+            1 -> kotlin.runCatching {
+                ReadBookConfig.durConfig.curBgStr().toColorInt()
+            }.getOrDefault(colorSurfaceContainer)
+            else -> ReadBookConfig.durConfig.curMenuBg()
+        }
+
+
+    private val acColor: Int
+        get() = when (AppConfig.readBarStyle) {
+            0 -> colorSecondary
+            1 -> kotlin.runCatching {
+                ReadBookConfig.durConfig.curTextColor()
+            }.getOrDefault(colorSecondary)
+            else -> ReadBookConfig.durConfig.curMenuAc()
+        }
+
+
+    private val bgcColor: Int
+        get() = when (AppConfig.readBarStyle) {
+            0 -> colorSecondaryContainer
+            1 -> kotlin.runCatching {
+                val baseColor = ReadBookConfig.durConfig.curTextColor()
+                ColorUtils.setAlphaComponent(baseColor, (255 * 0.2f).toInt())
+            }.getOrDefault(colorSecondaryContainer)
+            else -> ColorUtils.setAlphaComponent(acColor, (255 * 0.2f).toInt())
+        }
 
 
-//    private var bottomBackgroundList: ColorStateList = Selector.colorBuild()
-//        .setDefaultColor(bgColor)
-//        .setPressedColor(ColorUtils.darkenColor(bgColor))
-//        .create()
     private var onMenuOutEnd: (() -> Unit)? = null
     private var onMenuOutEnd: (() -> Unit)? = null
 
 
     private val showBrightnessView
     private val showBrightnessView
@@ -182,11 +210,10 @@ class ReadMenu @JvmOverloads constructor(
         val brightnessBackground = GradientDrawable()
         val brightnessBackground = GradientDrawable()
         brightnessBackground.cornerRadius = 5F.dpToPx()
         brightnessBackground.cornerRadius = 5F.dpToPx()
         llBrightness.background = brightnessBackground
         llBrightness.background = brightnessBackground
-        if (AppConfig.isEInkMode) {
-            titleBar.setBackgroundResource(R.drawable.bg_eink_border_bottom)
-        } else {
-            //llBottomBg.setBackgroundColor(bgColor)
-        }
+
+//        if (AppConfig.isEInkMode) {
+//            titleBar.setBackgroundResource(R.drawable.bg_eink_border_bottom)
+//        }
 
 
         llBrightness.setOnClickListener(null)
         llBrightness.setOnClickListener(null)
         seekBrightness.post {
         seekBrightness.post {
@@ -202,9 +229,17 @@ class ReadMenu @JvmOverloads constructor(
             renderButtons(binding.bottomView, allButtons)
             renderButtons(binding.bottomView, allButtons)
         }
         }
         val alpha = (AppConfig.menuAlpha / 100f * 255).toInt()
         val alpha = (AppConfig.menuAlpha / 100f * 255).toInt()
-        val color = context.themeColor(com.google.android.material.R.attr.colorSurfaceContainer)
-        titleBar.setBackgroundColor(ColorUtils.setAlphaComponent(color, alpha))
-        cdSlider.setCardBackgroundColor(ColorUtils.setAlphaComponent(color, alpha))
+        titleBar.setBackgroundColor(ColorUtils.setAlphaComponent(bgColor, alpha))
+        cdSlider.setCardBackgroundColor(ColorUtils.setAlphaComponent(bgColor, alpha))
+        seekReadPage.trackInactiveTintList = ColorStateList.valueOf(bgcColor)
+        seekReadPage.trackActiveTintList = ColorStateList.valueOf(acColor)
+        seekReadPage.thumbTintList = ColorStateList.valueOf(acColor)
+        seekReadPage.tickActiveTintList = ColorStateList.valueOf(bgColor)
+        seekReadPage.tickInactiveTintList = ColorStateList.valueOf(acColor)
+        tvPre.iconTint = ColorStateList.valueOf(acColor)
+        tvNext.iconTint = ColorStateList.valueOf(acColor)
+        tvPre.backgroundTintList = ColorStateList.valueOf(bgColor)
+        tvNext.backgroundTintList = ColorStateList.valueOf(bgColor)
         tvPre.alpha = AppConfig.menuAlpha / 100f * 255
         tvPre.alpha = AppConfig.menuAlpha / 100f * 255
         tvNext.alpha = AppConfig.menuAlpha / 100f * 255
         tvNext.alpha = AppConfig.menuAlpha / 100f * 255
         upBrightnessVwPos()
         upBrightnessVwPos()
@@ -214,7 +249,7 @@ class ReadMenu @JvmOverloads constructor(
         if (resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) {
         if (resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) {
             binding.bottomMenu.applyNavigationBarPadding()
             binding.bottomMenu.applyNavigationBarPadding()
         } else {
         } else {
-            bottomView.setBackgroundColor(ColorUtils.setAlphaComponent(color, alpha))
+            bottomView.setBackgroundColor(ColorUtils.setAlphaComponent(bgColor, alpha))
             binding.bottomView.applyNavigationBarPadding()
             binding.bottomView.applyNavigationBarPadding()
         }
         }
     }
     }
@@ -516,8 +551,8 @@ class ReadMenu @JvmOverloads constructor(
                 tooltipText = btn.description
                 tooltipText = btn.description
                 strokeWidth = 0
                 strokeWidth = 0
                 iconGravity = MaterialButton.ICON_GRAVITY_TEXT_START
                 iconGravity = MaterialButton.ICON_GRAVITY_TEXT_START
+                iconTint = ColorStateList.valueOf(acColor)
                 maxLines = 1
                 maxLines = 1
-                iconTint = ColorStateList.valueOf(context.themeColor(androidx.appcompat.R.attr.colorPrimary))
                 setOnClickListener { btn.onClick() }
                 setOnClickListener { btn.onClick() }
                 btn.onLongClick?.let { longAction ->
                 btn.onLongClick?.let { longAction ->
                     setOnLongClickListener {
                     setOnLongClickListener {

+ 41 - 12
app/src/main/java/io/legado/app/ui/book/read/config/TipConfigDialog.kt

@@ -10,6 +10,7 @@ import io.legado.app.base.BaseBottomSheetDialogFragment
 import io.legado.app.constant.EventBus
 import io.legado.app.constant.EventBus
 import io.legado.app.databinding.DialogEditTextBinding
 import io.legado.app.databinding.DialogEditTextBinding
 import io.legado.app.databinding.DialogTipConfigBinding
 import io.legado.app.databinding.DialogTipConfigBinding
+import io.legado.app.help.config.AppConfig
 import io.legado.app.help.config.ReadBookConfig
 import io.legado.app.help.config.ReadBookConfig
 import io.legado.app.help.config.ReadTipConfig
 import io.legado.app.help.config.ReadTipConfig
 import io.legado.app.lib.dialogs.alert
 import io.legado.app.lib.dialogs.alert
@@ -27,6 +28,8 @@ class TipConfigDialog : BaseBottomSheetDialogFragment(R.layout.dialog_tip_config
     companion object {
     companion object {
         const val TIP_COLOR = 7897
         const val TIP_COLOR = 7897
         const val TIP_DIVIDER_COLOR = 7898
         const val TIP_DIVIDER_COLOR = 7898
+        const val B_COLOR = 114
+        const val A_COLOR = 514
     }
     }
 
 
     private val binding by viewBinding(DialogTipConfigBinding::bind)
     private val binding by viewBinding(DialogTipConfigBinding::bind)
@@ -42,6 +45,10 @@ class TipConfigDialog : BaseBottomSheetDialogFragment(R.layout.dialog_tip_config
             upTvTipColor()
             upTvTipColor()
             upTvTipDividerColor()
             upTvTipDividerColor()
         }
         }
+        observeEvent<Boolean>(EventBus.UPDATE_READ_ACTION_BAR) {
+            binding.abtnBackgroundColor.color = ReadBookConfig.durConfig.curMenuBg()
+            binding.abtnAccentColor.color = ReadBookConfig.durConfig.curMenuAc()
+        }
     }
     }
 
 
     private fun initView() {
     private fun initView() {
@@ -61,25 +68,47 @@ class TipConfigDialog : BaseBottomSheetDialogFragment(R.layout.dialog_tip_config
                 weightOptions?.let { options ->
                 weightOptions?.let { options ->
                     items(options.toList()) { _, i ->
                     items(options.toList()) { _, i ->
                         ReadBookConfig.titleBold = weightValues[i]
                         ReadBookConfig.titleBold = weightValues[i]
-                        binding.sliderFontWeight.value =
-                            ReadBookConfig.titleBold.toFloat().coerceAtLeast(100f)
-                        binding.textFontWeightConverter.text = options.getOrNull(i) ?: ""
                         postEvent(EventBus.UP_CONFIG, arrayListOf(8, 9, 6))
                         postEvent(EventBus.UP_CONFIG, arrayListOf(8, 9, 6))
                     }
                     }
                 }
                 }
             }
             }
         }
         }
+        binding.abtnBackgroundColor.color = ReadBookConfig.durConfig.curMenuBg()
+        binding.abtnAccentColor.color = ReadBookConfig.durConfig.curMenuAc()
+        binding.abtnBackgroundColor.setOnClickListener {
+            ColorPickerDialog.newBuilder()
+                .setColor(ReadBookConfig.durConfig.curMenuBg())
+                .setShowAlphaSlider(false)
+                .setDialogType(ColorPickerDialog.TYPE_CUSTOM)
+                .setDialogId(B_COLOR)
+                .show(requireActivity())
+        }
 
 
-        binding.sliderFontWeight.apply {
-            valueFrom = 100f
-            valueTo = 900f
-            stepSize = 1f
-            value = ReadBookConfig.titleBold.toFloat().coerceAtLeast(100f)
-            addOnChangeListener { _, newValue, _ ->
-                binding.textFontWeightConverter.text = "自定义"
-                ReadBookConfig.titleBold = newValue.toInt()
-                postEvent(EventBus.UP_CONFIG, arrayListOf(5))
+        binding.abtnAccentColor.setOnClickListener {
+            ColorPickerDialog.newBuilder()
+                .setColor(ReadBookConfig.durConfig.curMenuAc())
+                .setShowAlphaSlider(false)
+                .setDialogType(ColorPickerDialog.TYPE_CUSTOM)
+                .setDialogId(A_COLOR)
+                .show(requireActivity())
+        }
+
+        binding.bottomMode.check(
+            when (AppConfig.readBarStyle) {
+                0 -> R.id.bottom_mode1
+                1 -> R.id.bottom_mode2
+                else -> R.id.bottom_mode3
+            }
+        )
+        binding.bottomMode.setOnCheckedStateChangeListener { group, checkedIds ->
+            val checkedId = checkedIds.firstOrNull() ?: return@setOnCheckedStateChangeListener
+            AppConfig.readBarStyle = when (checkedId) {
+                R.id.bottom_mode1 -> 0
+                R.id.bottom_mode2 -> 1
+                R.id.bottom_mode3 -> 2
+                else -> 0
             }
             }
+            postEvent(EventBus.UPDATE_READ_ACTION_BAR, true)
         }
         }
 
 
         binding.btnTitleSegType.setOnClickListener {
         binding.btnTitleSegType.setOnClickListener {

+ 1 - 1
app/src/main/java/io/legado/app/ui/widget/TitleBar.kt

@@ -65,7 +65,7 @@ class TitleBar @JvmOverloads constructor(
         val titleText = a.getString(R.styleable.TitleBar_title)
         val titleText = a.getString(R.styleable.TitleBar_title)
         val subtitleText = a.getString(R.styleable.TitleBar_subtitle)
         val subtitleText = a.getString(R.styleable.TitleBar_subtitle)
 
 
-        when (a.getInt(R.styleable.TitleBar_themeMode, 0)) {
+        when (a.getInt(R.styleable.TitleBar_isNavigationBackground, 0)) {
             1 -> inflate(context, R.layout.view_title_bar_dark, this)
             1 -> inflate(context, R.layout.view_title_bar_dark, this)
             else -> inflate(context, R.layout.view_title_bar, this)
             else -> inflate(context, R.layout.view_title_bar, this)
         }
         }

+ 1 - 1
app/src/main/res/drawable/rounded_rect.xml

@@ -2,5 +2,5 @@
 <shape xmlns:android="http://schemas.android.com/apk/res/android"
 <shape xmlns:android="http://schemas.android.com/apk/res/android"
     android:shape="rectangle">
     android:shape="rectangle">
     <solid android:color="@android:color/white" />
     <solid android:color="@android:color/white" />
-    <corners android:radius="8dp" />
+    <corners android:radius="16dp" />
 </shape>
 </shape>

+ 3 - 2
app/src/main/res/layout-land/view_read_menu.xml

@@ -19,6 +19,8 @@
         android:id="@+id/title_bar"
         android:id="@+id/title_bar"
         android:layout_width="match_parent"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_height="wrap_content"
+        app:isNavigationBackground="no"
+        style="@style/NoBackgroundNavi"
         android:background="?attr/colorSurfaceContainer"
         android:background="?attr/colorSurfaceContainer"
         app:layout_constraintTop_toTopOf="parent">
         app:layout_constraintTop_toTopOf="parent">
 
 
@@ -64,9 +66,8 @@
                     android:text="@string/book_source" />
                     android:text="@string/book_source" />
 
 
             </LinearLayout>
             </LinearLayout>
-        </LinearLayout>
-
 
 
+        </LinearLayout>
 
 
     </io.legado.app.ui.widget.TitleBar>
     </io.legado.app.ui.widget.TitleBar>
 
 

+ 96 - 58
app/src/main/res/layout/dialog_tip_config.xml

@@ -93,6 +93,14 @@
                 android:text="分段模式"
                 android:text="分段模式"
                 style="@style/Widget.Material3Expressive.Button.TonalButton"/>
                 style="@style/Widget.Material3Expressive.Button.TonalButton"/>
 
 
+            <com.google.android.material.button.MaterialButton
+                android:id="@+id/textFontWeightConverter"
+                style="@style/Widget.Material3Expressive.Button.TonalButton"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/font_weight_text"
+                android:minWidth="0dp" />
+
         </com.google.android.material.button.MaterialButtonGroup>
         </com.google.android.material.button.MaterialButtonGroup>
 
 
         <LinearLayout
         <LinearLayout
@@ -101,7 +109,7 @@
 
 
             <io.legado.app.ui.widget.SimpleCounterView
             <io.legado.app.ui.widget.SimpleCounterView
                 android:id="@+id/dsb_title_seg_scaling"
                 android:id="@+id/dsb_title_seg_scaling"
-                android:layout_width="120dp"
+                android:layout_width="108dp"
                 android:layout_height="wrap_content"
                 android:layout_height="wrap_content"
                 app:max="20"
                 app:max="20"
                 app:title="次行缩放(未完成)" />
                 app:title="次行缩放(未完成)" />
@@ -112,48 +120,26 @@
                 android:layout_weight="1"/>
                 android:layout_weight="1"/>
 
 
             <io.legado.app.ui.widget.SimpleCounterView
             <io.legado.app.ui.widget.SimpleCounterView
-                android:id="@+id/dsb_title_line_spacing_extra"
-                android:layout_width="120dp"
+                android:id="@+id/dsb_title_size"
+                android:layout_width="108dp"
                 android:layout_height="wrap_content"
                 android:layout_height="wrap_content"
                 app:max="20"
                 app:max="20"
-                app:title="标题段距" />
-
-        </LinearLayout>
+                app:title="@string/title_font_size" />
 
 
+            <View
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="1"/>
 
 
-
-        <TextView
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:text="@string/text_font_weight_converter"
-            android:textSize="12sp"
-            android:textStyle="bold" />
-
-        <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content">
-            <com.google.android.material.button.MaterialButton
-                android:id="@+id/textFontWeightConverter"
-                style="@style/Widget.Material3Expressive.Button.IconButton.Tonal"
-                android:layout_width="wrap_content"
+            <io.legado.app.ui.widget.SimpleCounterView
+                android:id="@+id/dsb_title_line_spacing_extra"
+                android:layout_width="108dp"
                 android:layout_height="wrap_content"
                 android:layout_height="wrap_content"
-                android:minWidth="0dp"
-                android:textSize="12sp" />
+                app:max="20"
+                app:title="标题段距" />
 
 
-            <com.google.android.material.slider.Slider
-                android:id="@+id/sliderFontWeight"
-                android:layout_width="0dp"
-                android:layout_height="wrap_content"
-                android:layout_weight="1" />
         </LinearLayout>
         </LinearLayout>
 
 
-        <io.legado.app.ui.widget.DetailSeekBar
-            android:id="@+id/dsb_title_size"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            app:max="20"
-            app:title="@string/title_font_size" />
-
         <LinearLayout
         <LinearLayout
             android:layout_width="match_parent"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_height="wrap_content"
@@ -180,29 +166,31 @@
 
 
         </LinearLayout>
         </LinearLayout>
 
 
-
-
-        <TextView
-            android:id="@+id/tv_header_padding"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:paddingTop="8dp"
-            android:text="@string/header"
-            android:textSize="16sp"
-            android:textStyle="bold" />
-
         <LinearLayout
         <LinearLayout
             android:id="@+id/ll_header_show"
             android:id="@+id/ll_header_show"
             android:layout_width="match_parent"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_height="wrap_content"
             android:paddingVertical="4dp"
             android:paddingVertical="4dp"
             android:gravity="center_vertical"
             android:gravity="center_vertical"
-            android:orientation="vertical"
+            android:orientation="horizontal"
             tools:ignore="RtlHardcoded,RtlSymmetry">
             tools:ignore="RtlHardcoded,RtlSymmetry">
 
 
+            <TextView
+                android:id="@+id/tv_header_padding"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/header"
+                android:textSize="16sp"
+                android:textStyle="bold" />
+
+            <View
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="1"/>
+
             <com.google.android.material.chip.ChipGroup
             <com.google.android.material.chip.ChipGroup
                 android:id="@+id/chip_header_mode"
                 android:id="@+id/chip_header_mode"
-                android:layout_width="match_parent"
+                android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_height="wrap_content"
                 android:gravity="center_vertical"
                 android:gravity="center_vertical"
                 app:selectionRequired="true"
                 app:selectionRequired="true"
@@ -279,26 +267,30 @@
 
 
         </LinearLayout>
         </LinearLayout>
 
 
-        <io.legado.app.ui.widget.text.AccentTextView
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:paddingTop="8dp"
-            android:text="@string/footer"
-            android:textSize="16sp"
-            android:textStyle="bold" />
-
         <LinearLayout
         <LinearLayout
             android:id="@+id/ll_footer_show"
             android:id="@+id/ll_footer_show"
             android:layout_width="match_parent"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_height="wrap_content"
             android:paddingVertical="4dp"
             android:paddingVertical="4dp"
             android:gravity="center_vertical"
             android:gravity="center_vertical"
-            android:orientation="vertical"
+            android:orientation="horizontal"
             tools:ignore="RtlHardcoded,RtlSymmetry">
             tools:ignore="RtlHardcoded,RtlSymmetry">
 
 
+            <io.legado.app.ui.widget.text.AccentTextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/footer"
+                android:textSize="16sp"
+                android:textStyle="bold" />
+
+            <View
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="1"/>
+
             <com.google.android.material.chip.ChipGroup
             <com.google.android.material.chip.ChipGroup
                 android:id="@+id/chip_footer_mode"
                 android:id="@+id/chip_footer_mode"
-                android:layout_width="match_parent"
+                android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_height="wrap_content"
                 app:selectionRequired="true"
                 app:selectionRequired="true"
                 app:singleSelection="true" />
                 app:singleSelection="true" />
@@ -428,6 +420,52 @@
 
 
         </LinearLayout>
         </LinearLayout>
 
 
+        <io.legado.app.ui.widget.AccentColorButton
+            android:id="@+id/abtnBackgroundColor"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            style="@style/Widget.Material3Expressive.Button.OutlinedButton"
+            android:text="@string/background_color" />
+
+        <io.legado.app.ui.widget.AccentColorButton
+            android:id="@+id/abtnAccentColor"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            style="@style/Widget.Material3Expressive.Button.OutlinedButton"
+            android:text="@string/accent" />
+
+        <com.google.android.material.chip.ChipGroup
+            android:id="@+id/bottom_mode"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            app:singleLine="true"
+            app:singleSelection="true"
+            app:selectionRequired="true">
+
+            <com.google.android.material.chip.Chip
+                android:id="@+id/bottom_mode1"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:checkable="true"
+                android:text="@string/flow_sys" />
+
+            <com.google.android.material.chip.Chip
+                android:id="@+id/bottom_mode2"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:checkable="true"
+                android:text="跟随阅读背景" />
+
+            <com.google.android.material.chip.Chip
+                android:id="@+id/bottom_mode3"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:checkable="true"
+                android:text="@string/custom" />
+
+
+        </com.google.android.material.chip.ChipGroup>
+
     </LinearLayout>
     </LinearLayout>
 
 
 </androidx.core.widget.NestedScrollView>
 </androidx.core.widget.NestedScrollView>

+ 3 - 1
app/src/main/res/layout/view_read_menu.xml

@@ -19,6 +19,7 @@
         android:id="@+id/title_bar"
         android:id="@+id/title_bar"
         android:layout_width="match_parent"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_height="wrap_content"
+        app:isNavigationBackground="no"
         android:background="?attr/colorSurfaceContainer"
         android:background="?attr/colorSurfaceContainer"
         app:layout_constraintTop_toTopOf="parent">
         app:layout_constraintTop_toTopOf="parent">
 
 
@@ -32,6 +33,7 @@
                 android:id="@+id/tv_book_name"
                 android:id="@+id/tv_book_name"
                 android:layout_width="wrap_content"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_height="wrap_content"
+                android:paddingBottom="8dp"
                 style="@style/TextAppearance.Material3.TitleLarge"
                 style="@style/TextAppearance.Material3.TitleLarge"
                 android:singleLine="true" />
                 android:singleLine="true" />
 
 
@@ -63,7 +65,7 @@
                     android:maxLines="1"
                     android:maxLines="1"
                     android:ellipsize="end"
                     android:ellipsize="end"
                     android:gravity="end"
                     android:gravity="end"
-                    android:paddingVertical="8dp"
+                    android:paddingBottom="8dp"
                     android:text="@string/book_source" />
                     android:text="@string/book_source" />
 
 
             </LinearLayout>
             </LinearLayout>

+ 0 - 1
app/src/main/res/layout/view_title_bar.xml

@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <?xml version="1.0" encoding="utf-8"?>
 <com.google.android.material.appbar.MaterialToolbar xmlns:android="http://schemas.android.com/apk/res/android"
 <com.google.android.material.appbar.MaterialToolbar xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/toolbar"
     android:id="@+id/toolbar"
     android:layout_width="match_parent"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:layout_height="wrap_content"

+ 1 - 1
app/src/main/res/layout/view_title_bar_dark.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <?xml version="1.0" encoding="utf-8"?>
-<androidx.appcompat.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
+<com.google.android.material.appbar.MaterialToolbar xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/toolbar"
     android:id="@+id/toolbar"
     android:layout_width="match_parent"
     android:layout_width="match_parent"
     android:layout_height="wrap_content" />
     android:layout_height="wrap_content" />

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

@@ -1158,7 +1158,7 @@
     <string name="create_heap_dump">创建堆转储</string>
     <string name="create_heap_dump">创建堆转储</string>
     <string name="record_heap_dump_s">当应用发生OOM崩溃时保存堆转储</string>
     <string name="record_heap_dump_s">当应用发生OOM崩溃时保存堆转储</string>
     <string name="record_heap_dump_t">记录堆转储</string>
     <string name="record_heap_dump_t">记录堆转储</string>
-    <string name="font_weight_text">中/粗/细</string>
+    <string name="font_weight_text">字重</string>
     <string name="keep_swipe_tip">继续滑动以加载下一章…</string>
     <string name="keep_swipe_tip">继续滑动以加载下一章…</string>
     <string name="enable_optimize_render">启用绘制优化</string>
     <string name="enable_optimize_render">启用绘制优化</string>
     <string name="ignore_battery_permission_rationale">阅读需要请求后台权限以保持服务正常运行</string>
     <string name="ignore_battery_permission_rationale">阅读需要请求后台权限以保持服务正常运行</string>

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

@@ -1160,7 +1160,7 @@
     <string name="create_heap_dump">创建堆转储</string>
     <string name="create_heap_dump">创建堆转储</string>
     <string name="record_heap_dump_s">当应用发生OOM崩溃时保存堆转储</string>
     <string name="record_heap_dump_s">当应用发生OOM崩溃时保存堆转储</string>
     <string name="record_heap_dump_t">记录堆转储</string>
     <string name="record_heap_dump_t">记录堆转储</string>
-    <string name="font_weight_text">中/粗/细</string>
+    <string name="font_weight_text">字重</string>
     <string name="keep_swipe_tip">继续滑动以加载下一章…</string>
     <string name="keep_swipe_tip">继续滑动以加载下一章…</string>
     <string name="enable_optimize_render">启用绘制优化</string>
     <string name="enable_optimize_render">启用绘制优化</string>
     <string name="ignore_battery_permission_rationale">阅读需要请求后台权限以保持服务正常运行</string>
     <string name="ignore_battery_permission_rationale">阅读需要请求后台权限以保持服务正常运行</string>

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

@@ -1165,7 +1165,7 @@
     <string name="create_heap_dump">创建堆转储</string>
     <string name="create_heap_dump">创建堆转储</string>
     <string name="record_heap_dump_s">当应用发生OOM崩溃时保存堆转储</string>
     <string name="record_heap_dump_s">当应用发生OOM崩溃时保存堆转储</string>
     <string name="record_heap_dump_t">记录堆转储</string>
     <string name="record_heap_dump_t">记录堆转储</string>
-    <string name="font_weight_text">中/粗/细</string>
+    <string name="font_weight_text">字重</string>
     <string name="keep_swipe_tip">继续滑动以加载下一章…</string>
     <string name="keep_swipe_tip">继续滑动以加载下一章…</string>
     <string name="enable_optimize_render">启用绘制优化</string>
     <string name="enable_optimize_render">启用绘制优化</string>
     <string name="ignore_battery_permission_rationale">阅读需要请求后台权限以保持服务正常运行,拒绝后不再弹出。如有需要可至高级设置中再次申请。</string>
     <string name="ignore_battery_permission_rationale">阅读需要请求后台权限以保持服务正常运行,拒绝后不再弹出。如有需要可至高级设置中再次申请。</string>
@@ -1330,4 +1330,5 @@
     <string name="cancel_select">取消选择</string>
     <string name="cancel_select">取消选择</string>
     <string name="coll_volume">折叠所有卷</string>
     <string name="coll_volume">折叠所有卷</string>
     <string name="expand_volume">展开所有卷</string>
     <string name="expand_volume">展开所有卷</string>
+    <string name="custom">自定义</string>
 </resources>
 </resources>

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

@@ -30,7 +30,10 @@
         <attr name="fitNavigationBar" format="boolean" />
         <attr name="fitNavigationBar" format="boolean" />
         <attr name="navigationContentDescription" format="reference|string" />
         <attr name="navigationContentDescription" format="reference|string" />
         <attr name="navigationIconTint" format="color|reference" />
         <attr name="navigationIconTint" format="color|reference" />
-        <attr name="themeMode" />
+        <attr name="isNavigationBackground" format="enum">
+            <enum name="no" value="1" />
+            <enum name="yes" value="0" />
+        </attr>
         <attr name="navigationIconTintMode" format="enum">
         <attr name="navigationIconTintMode" format="enum">
             <enum name="clear" value="0" />
             <enum name="clear" value="0" />
             <enum name="src" value="1" />
             <enum name="src" value="1" />

+ 1 - 0
app/src/main/res/values/strings.xml

@@ -1331,4 +1331,5 @@
     <string name="cancel_select">取消选择</string>
     <string name="cancel_select">取消选择</string>
     <string name="coll_volume">折叠所有卷</string>
     <string name="coll_volume">折叠所有卷</string>
     <string name="expand_volume">展开所有卷</string>
     <string name="expand_volume">展开所有卷</string>
+    <string name="custom">自定义</string>
 </resources>
 </resources>

+ 4 - 0
app/src/main/res/values/styles.xml

@@ -37,6 +37,10 @@
         <item name="chipStrokeColor">@color/chip_stroke_selector</item>
         <item name="chipStrokeColor">@color/chip_stroke_selector</item>
     </style>
     </style>
 
 
+    <style name="NoBackgroundNavi" parent="ThemeOverlay.Material3.Toolbar.CircleNavigationButton">
+        <item name="toolbarNavigationButtonCircleColor">@color/transparent</item>
+    </style>
+
     <style name="TextActionMenuAnimation">
     <style name="TextActionMenuAnimation">
         <item name="android:windowEnterAnimation">@anim/popup_enter</item>
         <item name="android:windowEnterAnimation">@anim/popup_enter</item>
         <item name="android:windowExitAnimation">@anim/popup_exit</item>
         <item name="android:windowExitAnimation">@anim/popup_exit</item>

+ 0 - 4
app/src/main/res/xml/pref_config_read.xml

@@ -201,10 +201,6 @@
             android:key="showReadTitleAddition"
             android:key="showReadTitleAddition"
             android:title="@string/show_read_title_addition" />
             android:title="@string/show_read_title_addition" />
 
 
-        <io.legado.app.lib.prefs.SwitchPreference
-            android:defaultValue="false"
-            android:key="readBarStyleFollowPage"
-            android:title="@string/read_bar_style_follow_page" />
     </io.legado.app.lib.prefs.PreferenceCategory>
     </io.legado.app.lib.prefs.PreferenceCategory>
 
 
 </androidx.preference.PreferenceScreen>
 </androidx.preference.PreferenceScreen>