优化翻译

pull/997/head
gedoor 4 years ago
parent 4d2a7e5d7d
commit e73f7d8ba5
  1. 29
      app/src/main/java/io/legado/app/help/ReadTipConfig.kt
  2. 18
      app/src/main/java/io/legado/app/ui/book/read/config/TipConfigDialog.kt

@ -1,5 +1,6 @@
package io.legado.app.help package io.legado.app.help
import android.content.Context
import io.legado.app.R import io.legado.app.R
import splitties.init.appCtx import splitties.init.appCtx
@ -7,19 +8,6 @@ object ReadTipConfig {
val tips by lazy { val tips by lazy {
appCtx.resources.getStringArray(R.array.read_tip).toList() appCtx.resources.getStringArray(R.array.read_tip).toList()
} }
val headerModes by lazy {
linkedMapOf(
Pair(0, appCtx.getString(R.string.hide_when_status_bar_show)),
Pair(1, appCtx.getString(R.string.show)),
Pair(2, appCtx.getString(R.string.hide))
)
}
val footerModes by lazy {
linkedMapOf(
Pair(0, appCtx.getString(R.string.show)),
Pair(1, appCtx.getString(R.string.hide))
)
}
const val none = 0 const val none = 0
const val chapterTitle = 1 const val chapterTitle = 1
const val time = 2 const val time = 2
@ -90,4 +78,19 @@ object ReadTipConfig {
set(value) { set(value) {
ReadBookConfig.config.tipColor = value ReadBookConfig.config.tipColor = value
} }
fun getHeaderModes(context: Context): LinkedHashMap<Int, String> {
return linkedMapOf(
Pair(0, context.getString(R.string.hide_when_status_bar_show)),
Pair(1, context.getString(R.string.show)),
Pair(2, context.getString(R.string.hide))
)
}
fun getFooterModes(context: Context): LinkedHashMap<Int, String> {
return linkedMapOf(
Pair(0, context.getString(R.string.show)),
Pair(1, context.getString(R.string.hide))
)
}
} }

@ -52,8 +52,8 @@ class TipConfigDialog : BaseDialogFragment() {
dsbTitleTop.progress = ReadBookConfig.titleTopSpacing dsbTitleTop.progress = ReadBookConfig.titleTopSpacing
dsbTitleBottom.progress = ReadBookConfig.titleBottomSpacing dsbTitleBottom.progress = ReadBookConfig.titleBottomSpacing
tvHeaderShow.text = ReadTipConfig.headerModes[ReadTipConfig.headerMode] tvHeaderShow.text = ReadTipConfig.getHeaderModes(requireContext())[ReadTipConfig.headerMode]
tvFooterShow.text = ReadTipConfig.footerModes[ReadTipConfig.footerMode] tvFooterShow.text = ReadTipConfig.getFooterModes(requireContext())[ReadTipConfig.footerMode]
tvHeaderLeft.text = ReadTipConfig.tipHeaderLeftStr tvHeaderLeft.text = ReadTipConfig.tipHeaderLeftStr
tvHeaderMiddle.text = ReadTipConfig.tipHeaderMiddleStr tvHeaderMiddle.text = ReadTipConfig.tipHeaderMiddleStr
@ -92,16 +92,18 @@ class TipConfigDialog : BaseDialogFragment() {
postEvent(EventBus.UP_CONFIG, true) postEvent(EventBus.UP_CONFIG, true)
} }
llHeaderShow.setOnClickListener { llHeaderShow.setOnClickListener {
selector(items = ReadTipConfig.headerModes.values.toList()) { _, i -> val headerModes = ReadTipConfig.getHeaderModes(requireContext())
ReadTipConfig.headerMode = ReadTipConfig.headerModes.keys.toList()[i] selector(items = headerModes.values.toList()) { _, i ->
tvHeaderShow.text = ReadTipConfig.headerModes[ReadTipConfig.headerMode] ReadTipConfig.headerMode = headerModes.keys.toList()[i]
tvHeaderShow.text = headerModes[ReadTipConfig.headerMode]
postEvent(EventBus.UP_CONFIG, true) postEvent(EventBus.UP_CONFIG, true)
} }
} }
llFooterShow.setOnClickListener { llFooterShow.setOnClickListener {
selector(items = ReadTipConfig.footerModes.values.toList()) { _, i -> val footerModes = ReadTipConfig.getFooterModes(requireContext())
ReadTipConfig.footerMode = ReadTipConfig.footerModes.keys.toList()[i] selector(items = footerModes.values.toList()) { _, i ->
tvFooterShow.text = ReadTipConfig.footerModes[ReadTipConfig.footerMode] ReadTipConfig.footerMode = footerModes.keys.toList()[i]
tvFooterShow.text = footerModes[ReadTipConfig.footerMode]
postEvent(EventBus.UP_CONFIG, true) postEvent(EventBus.UP_CONFIG, true)
} }
} }

Loading…
Cancel
Save