Browse Source

正文阴影

HapeLee 1 year ago
parent
commit
23f4347274

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

@@ -670,10 +670,10 @@ object ReadBookConfig {
         private var textColorInt = -1
 
         @Transient
-        private var textColorSIntNight = -1
+        private var shadowColorNightInt = -1
 
         @Transient
-        private var textColorSInt = -1
+        private var shadowColorInt = -1
 
         @Transient
         private var menuBgColorInt = -1
@@ -700,8 +700,8 @@ object ReadBookConfig {
             textColorIntEInk = textColorEInk.toColorInt()
             textColorIntNight = textColorNight.toColorInt()
             textColorInt = textColor.toColorInt()
-            textColorSIntNight = shadowColorN.toColorInt()
-            textColorSInt = shadowColor.toColorInt()
+            shadowColorNightInt = shadowColorN.toColorInt()
+            shadowColorInt = shadowColor.toColorInt()
             menuBgColorInt = menuBgColor.toColorInt()
             menuBgColorNightInt = menuBgColorNight.toColorInt()
             menuAcColorInt = menuAcColor.toColorInt()
@@ -715,11 +715,11 @@ object ReadBookConfig {
             when {
                 AppConfig.isNightTheme -> {
                     shadowColorN = "#${color.hexString}"
-                    textColorSIntNight = color
+                    shadowColorNightInt = color
                 }
                 else -> {
                     shadowColor = "#${color.hexString}"
-                    textColorSInt = color
+                    shadowColorInt = color
                 }
             }
         }
@@ -759,8 +759,8 @@ object ReadBookConfig {
                 initColorInt()
             }
             return when {
-                AppConfig.isNightTheme -> textColorSIntNight
-                else -> textColorSInt
+                AppConfig.isNightTheme -> shadowColorNightInt
+                else -> shadowColorInt
             }
         }
 

+ 1 - 0
app/src/main/java/io/legado/app/help/config/ThemeConfig.kt

@@ -52,6 +52,7 @@ object ThemeConfig {
         initNightMode()
         BookCover.upDefaultCover()
         postEvent(EventBus.RECREATE, "")
+        postEvent(EventBus.UP_CONFIG, arrayListOf(2))
     }
 
     fun applyDayNightInit(context: Context) {

+ 7 - 4
app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt

@@ -1101,12 +1101,15 @@ object ChapterProvider {
         visibleRight = viewWidth - paddingRight
         visibleBottom = paddingTop + visibleHeight
 
+        val shadowPad = (contentPaint.shadowLayerRadius + 2).toInt()
+
         visibleRect.set(
-            paddingLeft.toFloat(),
-            paddingTop.toFloat(),
-            visibleRight.toFloat(),
-            visibleBottom.toFloat()
+            (paddingLeft - shadowPad).toFloat(),
+            (paddingTop - shadowPad).toFloat(),
+            (visibleRight + shadowPad).toFloat(),
+            (visibleBottom + shadowPad).toFloat()
         )
+
         //TODO: 有关测量相关问题
     }