pull/32/head
kunfei 5 years ago
parent d168b2f752
commit 3653599836
  1. 21
      app/src/main/java/io/legado/app/App.kt
  2. 5
      app/src/main/java/io/legado/app/ui/widget/page/ChapterProvider.kt

@ -18,6 +18,7 @@ import io.legado.app.help.ActivityHelp
import io.legado.app.help.CrashHandler import io.legado.app.help.CrashHandler
import io.legado.app.help.ReadBookConfig import io.legado.app.help.ReadBookConfig
import io.legado.app.lib.theme.ThemeStore import io.legado.app.lib.theme.ThemeStore
import io.legado.app.ui.widget.page.ChapterProvider
import io.legado.app.utils.getCompatColor import io.legado.app.utils.getCompatColor
import io.legado.app.utils.getPrefInt import io.legado.app.utils.getPrefInt
import io.legado.app.utils.isNightTheme import io.legado.app.utils.isNightTheme
@ -69,18 +70,14 @@ class App : Application() {
if (isNightTheme) { if (isNightTheme) {
ThemeStore.editTheme(this) ThemeStore.editTheme(this)
.primaryColor( .primaryColor(
getPrefInt( getPrefInt("colorPrimaryNight", getCompatColor(R.color.md_blue_grey_600))
"colorPrimaryNight",
getCompatColor(R.color.md_blue_grey_600)
)
) )
.accentColor( .accentColor(
getPrefInt( getPrefInt("colorAccentNight", getCompatColor(R.color.md_deep_orange_800))
"colorAccentNight",
getCompatColor(R.color.md_deep_orange_800)
) )
.backgroundColor(
getPrefInt("colorBackgroundNight", getCompatColor(R.color.md_grey_800))
) )
.backgroundColor(getPrefInt("colorBackgroundNight", getCompatColor(R.color.md_grey_800)))
.apply() .apply()
} else { } else {
ThemeStore.editTheme(this) ThemeStore.editTheme(this)
@ -89,6 +86,7 @@ class App : Application() {
.backgroundColor(getPrefInt("colorBackground", getCompatColor(R.color.md_grey_100))) .backgroundColor(getPrefInt("colorBackground", getCompatColor(R.color.md_grey_100)))
.apply() .apply()
} }
ChapterProvider.upReadAloudSpan()
} }
fun applyDayNight() { fun applyDayNight() {
@ -113,7 +111,8 @@ class App : Application() {
*/ */
@RequiresApi(Build.VERSION_CODES.O) @RequiresApi(Build.VERSION_CODES.O)
private fun createChannelId() { private fun createChannelId() {
val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as? NotificationManager val notificationManager =
getSystemService(Context.NOTIFICATION_SERVICE) as? NotificationManager
notificationManager?.let { notificationManager?.let {
//用唯一的ID创建渠道对象 //用唯一的ID创建渠道对象
val downloadChannel = NotificationChannel( val downloadChannel = NotificationChannel(
@ -153,8 +152,8 @@ class App : Application() {
} }
} }
private fun registerActivityLife(){ private fun registerActivityLife() {
registerActivityLifecycleCallbacks(object : ActivityLifecycleCallbacks{ registerActivityLifecycleCallbacks(object : ActivityLifecycleCallbacks {
override fun onActivityPaused(activity: Activity) { override fun onActivityPaused(activity: Activity) {
} }

@ -10,7 +10,7 @@ import io.legado.app.lib.theme.accentColor
object ChapterProvider { object ChapterProvider {
val readAloudSpan = ForegroundColorSpan(App.INSTANCE.accentColor) var readAloudSpan = ForegroundColorSpan(App.INSTANCE.accentColor)
private val titleSpan = RelativeSizeSpan(1.2f) private val titleSpan = RelativeSizeSpan(1.2f)
fun getTextChapter( fun getTextChapter(
@ -65,4 +65,7 @@ object ChapterProvider {
) )
} }
fun upReadAloudSpan() {
readAloudSpan = ForegroundColorSpan(App.INSTANCE.accentColor)
}
} }
Loading…
Cancel
Save