|
|
@ -7,7 +7,6 @@ import io.legado.app.App |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.constant.EventBus |
|
|
|
import io.legado.app.constant.EventBus |
|
|
|
import io.legado.app.constant.PreferKey |
|
|
|
import io.legado.app.constant.PreferKey |
|
|
|
import io.legado.app.help.coroutine.Coroutine |
|
|
|
|
|
|
|
import io.legado.app.utils.* |
|
|
|
import io.legado.app.utils.* |
|
|
|
import java.io.File |
|
|
|
import java.io.File |
|
|
|
|
|
|
|
|
|
|
@ -32,13 +31,14 @@ object ThemeConfig { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun save() { |
|
|
|
fun save() { |
|
|
|
Coroutine.async { |
|
|
|
val json = GSON.toJson(configList) |
|
|
|
synchronized(this) { |
|
|
|
FileUtils.deleteFile(configFilePath) |
|
|
|
val json = GSON.toJson(configList) |
|
|
|
FileUtils.createFileIfNotExist(configFilePath).writeText(json) |
|
|
|
FileUtils.deleteFile(configFilePath) |
|
|
|
} |
|
|
|
FileUtils.createFileIfNotExist(configFilePath).writeText(json) |
|
|
|
|
|
|
|
} |
|
|
|
fun delConfig(index: Int) { |
|
|
|
} |
|
|
|
configList.removeAt(index) |
|
|
|
|
|
|
|
save() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun addConfig(json: String): Boolean { |
|
|
|
fun addConfig(json: String): Boolean { |
|
|
@ -116,9 +116,15 @@ object ThemeConfig { |
|
|
|
|
|
|
|
|
|
|
|
fun saveNightTheme(context: Context, name: String) { |
|
|
|
fun saveNightTheme(context: Context, name: String) { |
|
|
|
val primary = |
|
|
|
val primary = |
|
|
|
context.getPrefInt(PreferKey.cNPrimary, context.getCompatColor(R.color.md_blue_grey_600)) |
|
|
|
context.getPrefInt( |
|
|
|
|
|
|
|
PreferKey.cNPrimary, |
|
|
|
|
|
|
|
context.getCompatColor(R.color.md_blue_grey_600) |
|
|
|
|
|
|
|
) |
|
|
|
val accent = |
|
|
|
val accent = |
|
|
|
context.getPrefInt(PreferKey.cNAccent, context.getCompatColor(R.color.md_deep_orange_800)) |
|
|
|
context.getPrefInt( |
|
|
|
|
|
|
|
PreferKey.cNAccent, |
|
|
|
|
|
|
|
context.getCompatColor(R.color.md_deep_orange_800) |
|
|
|
|
|
|
|
) |
|
|
|
val background = |
|
|
|
val background = |
|
|
|
context.getPrefInt(PreferKey.cNBackground, context.getCompatColor(R.color.md_grey_900)) |
|
|
|
context.getPrefInt(PreferKey.cNBackground, context.getCompatColor(R.color.md_grey_900)) |
|
|
|
val bBackground = |
|
|
|
val bBackground = |
|
|
|