优化主题色选择

pull/300/head
gedoor 4 years ago
parent 64853b5f02
commit c5bf741249
  1. 20
      app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt
  2. 9
      app/src/main/res/values-zh-rHK/arrays.xml
  3. 7
      app/src/main/res/values-zh-rHK/strings.xml
  4. 9
      app/src/main/res/values-zh-rTW/arrays.xml
  5. 7
      app/src/main/res/values-zh-rTW/strings.xml
  6. 8
      app/src/main/res/values-zh/arrays.xml
  7. 7
      app/src/main/res/values-zh/strings.xml
  8. 238
      app/src/main/res/values/arrays.xml
  9. 7
      app/src/main/res/values/strings.xml

@ -28,7 +28,7 @@ import io.legado.app.utils.*
class ThemeConfigFragment : BasePreferenceFragment(),
SharedPreferences.OnSharedPreferenceChangeListener {
val items = arrayListOf("极简", "曜夜", "经典", "黑白", "A屏黑")
val items = App.INSTANCE.resources.getStringArray(R.array.default_themes).toList()
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
addPreferencesFromResource(R.xml.pref_config_theme)
@ -41,7 +41,7 @@ class ThemeConfigFragment : BasePreferenceFragment(),
findPreference<ColorPreference>(PreferKey.cBackground)?.let {
it.onSaveColor = { color ->
if (!ColorUtils.isColorLight(color)) {
toast("白天背景不能太暗")
toast(R.string.day_background_too_dark)
true
} else {
false
@ -51,7 +51,7 @@ class ThemeConfigFragment : BasePreferenceFragment(),
findPreference<ColorPreference>(PreferKey.cBBackground)?.let {
it.onSaveColor = { color ->
if (!ColorUtils.isColorLight(color)) {
toast("白天底栏不能太暗")
toast(R.string.day_bottom_bar_too_dark)
true
} else {
false
@ -61,7 +61,7 @@ class ThemeConfigFragment : BasePreferenceFragment(),
findPreference<ColorPreference>(PreferKey.cNBackground)?.let {
it.onSaveColor = { color ->
if (ColorUtils.isColorLight(color)) {
toast("夜间背景不能太亮")
toast(R.string.night_background_too_light)
true
} else {
false
@ -71,7 +71,7 @@ class ThemeConfigFragment : BasePreferenceFragment(),
findPreference<ColorPreference>(PreferKey.cNBBackground)?.let {
it.onSaveColor = { color ->
if (ColorUtils.isColorLight(color)) {
toast("夜间底栏不能太亮")
toast(R.string.night_bottom_bar_too_light)
true
} else {
false
@ -85,11 +85,11 @@ class ThemeConfigFragment : BasePreferenceFragment(),
val textColor = getCompatColor(R.color.tv_text_default)
when {
ColorUtils.getColorDifference(color, background) <= 60 -> {
toast("强调色不能和背景颜色相似")
toast(R.string.accent_background_diff)
true
}
ColorUtils.getColorDifference(color, textColor) <= 60 -> {
toast("强调色不能和文字颜色相似")
toast(R.string.accent_text_diff)
true
}
else -> false
@ -103,11 +103,11 @@ class ThemeConfigFragment : BasePreferenceFragment(),
val textColor = getCompatColor(R.color.tv_text_default)
when {
ColorUtils.getColorDifference(color, background) <= 60 -> {
toast("强调色不能和背景颜色相似")
toast(R.string.accent_background_diff)
true
}
ColorUtils.getColorDifference(color, textColor) <= 60 -> {
toast("强调色不能和文字颜色相似")
toast(R.string.accent_text_diff)
true
}
else -> false
@ -191,7 +191,7 @@ class ThemeConfigFragment : BasePreferenceFragment(),
}
private fun changeTheme() {
alert(title = "切换默认主题") {
alert(title = getString(R.string.select_theme)) {
items(items) { _, which ->
when (which) {
0 -> {

@ -55,4 +55,13 @@
<item>粗體</item>
<item>細體</item>
</string-array>
<string-array name="default_themes">
<item>极简</item>
<item>曜夜</item>
<item>经典</item>
<item>黑白</item>
<item>A屏黑</item>
</string-array>
</resources>

@ -732,4 +732,11 @@
<string name="replace_enable_default_t">默认启用替换净化</string>
<string name="replace_enable_default_s">新加入书架的书是否启用替换净化</string>
<string name="select_restore_file">选择恢复文件</string>
<string name="select_theme">切换默认主题</string>
<string name="day_background_too_dark">白天背景不能太暗</string>
<string name="day_bottom_bar_too_dark">白天底栏不能太暗</string>
<string name="night_background_too_light">夜间背景不能太亮</string>
<string name="night_bottom_bar_too_light">夜间底栏不能太亮</string>
<string name="accent_background_diff">强调色不能和背景颜色相似</string>
<string name="accent_text_diff">强调色不能和文字颜色相似</string>
</resources>

@ -112,4 +112,13 @@
<item>粗體</item>
<item>細體</item>
</string-array>
<string-array name="default_themes">
<item>极简</item>
<item>曜夜</item>
<item>经典</item>
<item>黑白</item>
<item>A屏黑</item>
</string-array>
</resources>

@ -732,5 +732,12 @@
<string name="replace_enable_default_t">默认启用替换净化</string>
<string name="replace_enable_default_s">新加入书架的书是否启用替换净化</string>
<string name="select_restore_file">选择恢复文件</string>
<string name="select_theme">切换默认主题</string>
<string name="day_background_too_dark">白天背景不能太暗</string>
<string name="day_bottom_bar_too_dark">白天底栏不能太暗</string>
<string name="night_background_too_light">夜间背景不能太亮</string>
<string name="night_bottom_bar_too_light">夜间底栏不能太亮</string>
<string name="accent_background_diff">强调色不能和背景颜色相似</string>
<string name="accent_text_diff">强调色不能和文字颜色相似</string>
</resources>

@ -113,4 +113,12 @@
<item>细体</item>
</string-array>
<string-array name="default_themes">
<item>极简</item>
<item>曜夜</item>
<item>经典</item>
<item>黑白</item>
<item>A屏黑</item>
</string-array>
</resources>

@ -732,4 +732,11 @@
<string name="replace_enable_default_t">默认启用替换净化</string>
<string name="replace_enable_default_s">新加入书架的书是否启用替换净化</string>
<string name="select_restore_file">选择恢复文件</string>
<string name="select_theme">切换默认主题</string>
<string name="day_background_too_dark">白天背景不能太暗</string>
<string name="day_bottom_bar_too_dark">白天底栏不能太暗</string>
<string name="night_background_too_light">夜间背景不能太亮</string>
<string name="night_bottom_bar_too_light">夜间底栏不能太亮</string>
<string name="accent_background_diff">强调色不能和背景颜色相似</string>
<string name="accent_text_diff">强调色不能和文字颜色相似</string>
</resources>

@ -1,116 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="book_type">
<item>@string/book_type_text</item>
<item>@string/book_type_audio</item>
</string-array>
<string-array name="tts_speech_per">
<item>du Xiao Mei</item>
<item>du Xiao Yu</item>
<item>du Xiao Yao</item>
<item>du Ya Ya</item>
<item>du Xiao Jiao</item>
<item>du Mi Duo</item>
<item>du Bo Wen</item>
<item>du Xiao Tong</item>
<item>du Xiao Meng</item>
<item>baidu SaoNan</item>
<item>baidu PingShu</item>
<item>baidu ZhuChi</item>
</string-array>
<string-array name="indent">
<item>@string/indent_0</item>
<item>@string/indent_1</item>
<item>@string/indent_2</item>
<item>@string/indent_3</item>
<item>@string/indent_4</item>
</string-array>
<string-array name="text_suffix">
<item>.txt</item>
<item>.json</item>
<item>.xml</item>
</string-array>
<string-array name="convert_s">
<item>@string/jf_convert_o</item>
<item>@string/jf_convert_j</item>
<item>@string/jf_convert_f</item>
</string-array>
<string-array name="theme_mode">
<item>Follow system</item>
<item>Bright mode</item>
<item>Dark mode</item>
<item>E-Ink mode</item>
</string-array>
<string-array name="NavBarColors">
<item>Auto</item>
<item>Black</item>
<item>White</item>
<item>Following</item>
</string-array>
<string-array name="screen_time_out">
<item>Default</item>
<item>1 min</item>
<item>2 min</item>
<item>3 min</item>
<item>Always</item>
</string-array>
<string-array name="select_folder">
<item>@string/default_path</item>
<item>@string/sys_folder_picker</item>
<item>@string/app_folder_picker</item>
</string-array>
<string-array name="screen_direction_title">
<item>@string/screen_unspecified</item>
<item>@string/screen_portrait</item>
<item>@string/screen_landscape</item>
<item>@string/screen_sensor</item>
</string-array>
<string-array name="icon_names">
<item>iconMain</item>
<item>icon1</item>
<item>icon2</item>
<item>icon3</item>
<item>icon4</item>
<item>icon5</item>
<item>icon6</item>
</string-array>
<string-array name="chinese_mode">
<item>Off</item>
<item>Traditional to Simplified</item>
<item>Simplified to Traditional</item>
</string-array>
<string-array name="system_typefaces">
<item>Default font</item>
<item>Serif font</item>
<item>Monospaced font</item>
</string-array>
<string-array name="read_tip">
<item>Blank</item>
<item>Heading</item>
<item>Time</item>
<item>Battery</item>
<item>Pages</item>
<item>Progress</item>
<item>Pages and progress</item>
</string-array>
<string-array name="text_font_weight">
<item>Normal</item>
<item>Bold</item>
<item>Light</item>
</string-array>
</resources>
<resources>
<string-array name="book_type">
<item>@string/book_type_text</item>
<item>@string/book_type_audio</item>
</string-array>
<string-array name="tts_speech_per">
<item>du Xiao Mei</item>
<item>du Xiao Yu</item>
<item>du Xiao Yao</item>
<item>du Ya Ya</item>
<item>du Xiao Jiao</item>
<item>du Mi Duo</item>
<item>du Bo Wen</item>
<item>du Xiao Tong</item>
<item>du Xiao Meng</item>
<item>baidu SaoNan</item>
<item>baidu PingShu</item>
<item>baidu ZhuChi</item>
</string-array>
<string-array name="indent">
<item>@string/indent_0</item>
<item>@string/indent_1</item>
<item>@string/indent_2</item>
<item>@string/indent_3</item>
<item>@string/indent_4</item>
</string-array>
<string-array name="text_suffix">
<item>.txt</item>
<item>.json</item>
<item>.xml</item>
</string-array>
<string-array name="convert_s">
<item>@string/jf_convert_o</item>
<item>@string/jf_convert_j</item>
<item>@string/jf_convert_f</item>
</string-array>
<string-array name="theme_mode">
<item>Follow system</item>
<item>Bright mode</item>
<item>Dark mode</item>
<item>E-Ink mode</item>
</string-array>
<string-array name="NavBarColors">
<item>Auto</item>
<item>Black</item>
<item>White</item>
<item>Following</item>
</string-array>
<string-array name="screen_time_out">
<item>Default</item>
<item>1 min</item>
<item>2 min</item>
<item>3 min</item>
<item>Always</item>
</string-array>
<string-array name="select_folder">
<item>@string/default_path</item>
<item>@string/sys_folder_picker</item>
<item>@string/app_folder_picker</item>
</string-array>
<string-array name="screen_direction_title">
<item>@string/screen_unspecified</item>
<item>@string/screen_portrait</item>
<item>@string/screen_landscape</item>
<item>@string/screen_sensor</item>
</string-array>
<string-array name="icon_names">
<item>iconMain</item>
<item>icon1</item>
<item>icon2</item>
<item>icon3</item>
<item>icon4</item>
<item>icon5</item>
<item>icon6</item>
</string-array>
<string-array name="chinese_mode">
<item>Off</item>
<item>Traditional to Simplified</item>
<item>Simplified to Traditional</item>
</string-array>
<string-array name="system_typefaces">
<item>Default font</item>
<item>Serif font</item>
<item>Monospaced font</item>
</string-array>
<string-array name="read_tip">
<item>Blank</item>
<item>Heading</item>
<item>Time</item>
<item>Battery</item>
<item>Pages</item>
<item>Progress</item>
<item>Pages and progress</item>
</string-array>
<string-array name="text_font_weight">
<item>Normal</item>
<item>Bold</item>
<item>Light</item>
</string-array>
<string-array name="default_themes">
<item>极简</item>
<item>曜夜</item>
<item>经典</item>
<item>黑白</item>
<item>A屏黑</item>
</string-array>
</resources>

@ -733,5 +733,12 @@
<string name="replace_enable_default_t">默认启用替换净化</string>
<string name="replace_enable_default_s">新加入书架的书是否启用替换净化</string>
<string name="select_restore_file">选择恢复文件</string>
<string name="select_theme">切换默认主题</string>
<string name="day_background_too_dark">白天背景不能太暗</string>
<string name="day_bottom_bar_too_dark">白天底栏不能太暗</string>
<string name="night_background_too_light">夜间背景不能太亮</string>
<string name="night_bottom_bar_too_light">夜间底栏不能太亮</string>
<string name="accent_background_diff">强调色不能和背景颜色相似</string>
<string name="accent_text_diff">强调色不能和文字颜色相似</string>
</resources>
Loading…
Cancel
Save