主题导入导出

pull/366/head
gedoor 4 years ago
parent 332f6dac26
commit f31870819e
  1. 4
      app/src/main/assets/themeConfig.json
  2. 5
      app/src/main/java/io/legado/app/help/ThemeConfig.kt
  3. 3
      app/src/main/java/io/legado/app/ui/config/ThemeListDialog.kt
  4. 1
      app/src/main/res/values-zh-rHK/strings.xml
  5. 1
      app/src/main/res/values-zh-rTW/strings.xml
  6. 1
      app/src/main/res/values-zh/strings.xml

@ -9,7 +9,7 @@
}, },
{ {
"themeName": "黑白", "themeName": "黑白",
"isNightTheme": false, "isNightTheme": true,
"primaryColor": "#303030", "primaryColor": "#303030",
"accentColor": "#E0E0E0", "accentColor": "#E0E0E0",
"backgroundColor": "#424242", "backgroundColor": "#424242",
@ -17,7 +17,7 @@
}, },
{ {
"themeName": "A屏黑", "themeName": "A屏黑",
"isNightTheme": false, "isNightTheme": true,
"primaryColor": "#000000", "primaryColor": "#000000",
"accentColor": "#FFFFFF", "accentColor": "#FFFFFF",
"backgroundColor": "#000000", "backgroundColor": "#000000",

@ -66,10 +66,7 @@ object ThemeConfig {
fun applyConfig(context: Context, config: Config) { fun applyConfig(context: Context, config: Config) {
val primary = Color.parseColor(config.primaryColor) val primary = Color.parseColor(config.primaryColor)
val accent = Color.parseColor(config.accentColor) val accent = Color.parseColor(config.accentColor)
var background = Color.parseColor(config.backgroundColor) val background = Color.parseColor(config.backgroundColor)
if (!ColorUtils.isColorLight(background)) {
background = context.getCompatColor(R.color.md_grey_100)
}
val bBackground = Color.parseColor(config.bottomBackground) val bBackground = Color.parseColor(config.bottomBackground)
if (config.isNightTheme) { if (config.isNightTheme) {
context.putPrefInt(PreferKey.cNPrimary, primary) context.putPrefInt(PreferKey.cNPrimary, primary)

@ -85,6 +85,9 @@ class ThemeListDialog : BaseDialogFragment() {
override fun registerListener(holder: ItemViewHolder) { override fun registerListener(holder: ItemViewHolder) {
holder.itemView.apply { holder.itemView.apply {
onClick {
ThemeConfig.applyConfig(context, ThemeConfig.configList[holder.layoutPosition])
}
iv_share.onClick { iv_share.onClick {
share(holder.layoutPosition) share(holder.layoutPosition)
} }

@ -757,5 +757,4 @@
<string name="save_night_theme_summary">保存夜间主题配置以共调用和分享</string> <string name="save_night_theme_summary">保存夜间主题配置以共调用和分享</string>
<string name="theme_list">主题列表</string> <string name="theme_list">主题列表</string>
<string name="theme_list_summary">使用保存主题,导入,分享主题</string> <string name="theme_list_summary">使用保存主题,导入,分享主题</string>
<string name="select_theme">切換默認主題</string>
</resources> </resources>

@ -757,6 +757,5 @@
<string name="save_night_theme_summary">保存夜间主题配置以共调用和分享</string> <string name="save_night_theme_summary">保存夜间主题配置以共调用和分享</string>
<string name="theme_list">主题列表</string> <string name="theme_list">主题列表</string>
<string name="theme_list_summary">使用保存主题,导入,分享主题</string> <string name="theme_list_summary">使用保存主题,导入,分享主题</string>
<string name="select_theme">切換默認主題</string>
</resources> </resources>

@ -757,5 +757,4 @@
<string name="save_night_theme_summary">保存夜间主题配置以共调用和分享</string> <string name="save_night_theme_summary">保存夜间主题配置以共调用和分享</string>
<string name="theme_list">主题列表</string> <string name="theme_list">主题列表</string>
<string name="theme_list_summary">使用保存主题,导入,分享主题</string> <string name="theme_list_summary">使用保存主题,导入,分享主题</string>
<string name="select_theme">切换默认主题</string>
</resources> </resources>

Loading…
Cancel
Save