优化阅读界面设置

pull/517/head
gedoor 4 years ago
parent 8067cb3efb
commit f2f6abf3b8
  1. 8
      app/src/main/java/io/legado/app/help/ReadBookConfig.kt
  2. 34
      app/src/main/java/io/legado/app/help/ReadTipConfig.kt
  3. 2
      app/src/main/java/io/legado/app/lib/theme/view/ATECheckBox.kt
  4. 2
      app/src/main/java/io/legado/app/lib/theme/view/ATEProgressBar.kt
  5. 2
      app/src/main/java/io/legado/app/lib/theme/view/ATERadioButton.kt
  6. 2
      app/src/main/java/io/legado/app/lib/theme/view/ATESeekBar.kt
  7. 41
      app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt
  8. 244
      app/src/main/java/io/legado/app/ui/book/read/config/TipConfigDialog.kt
  9. 11
      app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt
  10. 2
      app/src/main/java/io/legado/app/ui/widget/DetailSeekBar.kt
  11. 19
      app/src/main/res/layout/dialog_read_book_style.xml
  12. 232
      app/src/main/res/layout/dialog_tip_config.xml
  13. 61
      app/src/main/res/layout/dialog_title_config.xml
  14. 4
      app/src/main/res/layout/view_detail_seek_bar.xml
  15. 4
      app/src/main/res/values-zh-rHK/strings.xml
  16. 4
      app/src/main/res/values-zh-rTW/strings.xml
  17. 4
      app/src/main/res/values-zh/strings.xml
  18. 4
      app/src/main/res/values/strings.xml

@ -350,8 +350,8 @@ object ReadBookConfig {
exportConfig.tipFooterLeft = shareConfig.tipFooterLeft exportConfig.tipFooterLeft = shareConfig.tipFooterLeft
exportConfig.tipFooterMiddle = shareConfig.tipFooterMiddle exportConfig.tipFooterMiddle = shareConfig.tipFooterMiddle
exportConfig.tipFooterRight = shareConfig.tipFooterRight exportConfig.tipFooterRight = shareConfig.tipFooterRight
exportConfig.hideHeader = shareConfig.hideHeader exportConfig.headerMode = shareConfig.headerMode
exportConfig.hideFooter = shareConfig.hideFooter exportConfig.footerMode = shareConfig.footerMode
} }
return exportConfig return exportConfig
} }
@ -405,8 +405,8 @@ object ReadBookConfig {
var tipFooterLeft: Int = ReadTipConfig.chapterTitle, var tipFooterLeft: Int = ReadTipConfig.chapterTitle,
var tipFooterMiddle: Int = ReadTipConfig.none, var tipFooterMiddle: Int = ReadTipConfig.none,
var tipFooterRight: Int = ReadTipConfig.pageAndTotal, var tipFooterRight: Int = ReadTipConfig.pageAndTotal,
var hideHeader: Boolean = true, var headerMode: Int = 0,
var hideFooter: Boolean = false var footerMode: Int = 0
) : Parcelable { ) : Parcelable {
fun setCurTextColor(color: Int) { fun setCurTextColor(color: Int) {

@ -4,7 +4,15 @@ import io.legado.app.App
import io.legado.app.R import io.legado.app.R
object ReadTipConfig { object ReadTipConfig {
val tipArray: Array<String> = App.INSTANCE.resources.getStringArray(R.array.read_tip) val tips by lazy {
App.INSTANCE.resources.getStringArray(R.array.read_tip).toList()
}
val headerModes by lazy {
linkedMapOf(0 to "状态栏显示时隐藏", 1 to "显示", 2 to "隐藏")
}
val footerModes by lazy {
linkedMapOf(0 to "显示", 1 to "隐藏")
}
const val none = 0 const val none = 0
const val chapterTitle = 1 const val chapterTitle = 1
const val time = 2 const val time = 2
@ -14,12 +22,12 @@ object ReadTipConfig {
const val pageAndTotal = 6 const val pageAndTotal = 6
const val bookName = 7 const val bookName = 7
val tipHeaderLeftStr: String get() = tipArray.getOrElse(tipHeaderLeft) { tipArray[none] } val tipHeaderLeftStr: String get() = tips.getOrElse(tipHeaderLeft) { tips[none] }
val tipHeaderMiddleStr: String get() = tipArray.getOrElse(tipHeaderMiddle) { tipArray[none] } val tipHeaderMiddleStr: String get() = tips.getOrElse(tipHeaderMiddle) { tips[none] }
val tipHeaderRightStr: String get() = tipArray.getOrElse(tipHeaderRight) { tipArray[none] } val tipHeaderRightStr: String get() = tips.getOrElse(tipHeaderRight) { tips[none] }
val tipFooterLeftStr: String get() = tipArray.getOrElse(tipFooterLeft) { tipArray[none] } val tipFooterLeftStr: String get() = tips.getOrElse(tipFooterLeft) { tips[none] }
val tipFooterMiddleStr: String get() = tipArray.getOrElse(tipFooterMiddle) { tipArray[none] } val tipFooterMiddleStr: String get() = tips.getOrElse(tipFooterMiddle) { tips[none] }
val tipFooterRightStr: String get() = tipArray.getOrElse(tipFooterRight) { tipArray[none] } val tipFooterRightStr: String get() = tips.getOrElse(tipFooterRight) { tips[none] }
var tipHeaderLeft: Int var tipHeaderLeft: Int
get() = ReadBookConfig.config.tipHeaderLeft get() = ReadBookConfig.config.tipHeaderLeft
@ -57,15 +65,15 @@ object ReadTipConfig {
ReadBookConfig.config.tipFooterRight = value ReadBookConfig.config.tipFooterRight = value
} }
var hideHeader: Boolean var headerMode: Int
get() = ReadBookConfig.config.hideHeader get() = ReadBookConfig.config.headerMode
set(value) { set(value) {
ReadBookConfig.config.hideHeader = value ReadBookConfig.config.headerMode = value
} }
var hideFooter: Boolean var footerMode: Int
get() = ReadBookConfig.config.hideFooter get() = ReadBookConfig.config.footerMode
set(value) { set(value) {
ReadBookConfig.config.hideFooter = value ReadBookConfig.config.footerMode = value
} }
} }

@ -12,6 +12,8 @@ import io.legado.app.lib.theme.accentColor
class ATECheckBox(context: Context, attrs: AttributeSet) : AppCompatCheckBox(context, attrs) { class ATECheckBox(context: Context, attrs: AttributeSet) : AppCompatCheckBox(context, attrs) {
init { init {
if (!isInEditMode) {
ATH.setTint(this, context.accentColor) ATH.setTint(this, context.accentColor)
} }
}
} }

@ -12,6 +12,8 @@ import io.legado.app.lib.theme.ThemeStore
class ATEProgressBar(context: Context, attrs: AttributeSet) : ProgressBar(context, attrs) { class ATEProgressBar(context: Context, attrs: AttributeSet) : ProgressBar(context, attrs) {
init { init {
if (!isInEditMode) {
ATH.setTint(this, ThemeStore.accentColor(context)) ATH.setTint(this, ThemeStore.accentColor(context))
} }
}
} }

@ -12,6 +12,8 @@ import io.legado.app.lib.theme.accentColor
class ATERadioButton(context: Context, attrs: AttributeSet) : AppCompatRadioButton(context, attrs) { class ATERadioButton(context: Context, attrs: AttributeSet) : AppCompatRadioButton(context, attrs) {
init { init {
if (!isInEditMode) {
ATH.setTint(this@ATERadioButton, context.accentColor) ATH.setTint(this@ATERadioButton, context.accentColor)
} }
}
} }

@ -12,6 +12,8 @@ import io.legado.app.lib.theme.accentColor
class ATESeekBar(context: Context, attrs: AttributeSet) : AppCompatSeekBar(context, attrs) { class ATESeekBar(context: Context, attrs: AttributeSet) : AppCompatSeekBar(context, attrs) {
init { init {
if (!isInEditMode) {
ATH.setTint(this, context.accentColor) ATH.setTint(this, context.accentColor)
} }
}
} }

@ -1,6 +1,5 @@
package io.legado.app.ui.book.read.config package io.legado.app.ui.book.read.config
import android.annotation.SuppressLint
import android.content.DialogInterface import android.content.DialogInterface
import android.os.Bundle import android.os.Bundle
import android.view.* import android.view.*
@ -11,7 +10,6 @@ import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.constant.EventBus import io.legado.app.constant.EventBus
import io.legado.app.help.ReadBookConfig import io.legado.app.help.ReadBookConfig
import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.dialogs.selector import io.legado.app.lib.dialogs.selector
import io.legado.app.lib.theme.accentColor import io.legado.app.lib.theme.accentColor
import io.legado.app.lib.theme.bottomBackground import io.legado.app.lib.theme.bottomBackground
@ -19,10 +17,12 @@ import io.legado.app.lib.theme.getPrimaryTextColor
import io.legado.app.service.help.ReadBook import io.legado.app.service.help.ReadBook
import io.legado.app.ui.book.read.ReadBookActivity import io.legado.app.ui.book.read.ReadBookActivity
import io.legado.app.ui.widget.font.FontSelectDialog import io.legado.app.ui.widget.font.FontSelectDialog
import io.legado.app.utils.* import io.legado.app.utils.ColorUtils
import io.legado.app.utils.dp
import io.legado.app.utils.getIndexById
import io.legado.app.utils.postEvent
import kotlinx.android.synthetic.main.activity_book_read.* import kotlinx.android.synthetic.main.activity_book_read.*
import kotlinx.android.synthetic.main.dialog_read_book_style.* import kotlinx.android.synthetic.main.dialog_read_book_style.*
import kotlinx.android.synthetic.main.dialog_title_config.view.*
import kotlinx.android.synthetic.main.item_read_style.view.* import kotlinx.android.synthetic.main.item_read_style.view.*
import org.jetbrains.anko.sdk27.listeners.onCheckedChange import org.jetbrains.anko.sdk27.listeners.onCheckedChange
import org.jetbrains.anko.sdk27.listeners.onClick import org.jetbrains.anko.sdk27.listeners.onClick
@ -110,9 +110,6 @@ class ReadStyleDialog : BaseDialogFragment(), FontSelectDialog.CallBack {
chinese_converter.onChanged { chinese_converter.onChanged {
postEvent(EventBus.UP_CONFIG, true) postEvent(EventBus.UP_CONFIG, true)
} }
tv_title_mode.onClick {
showTitleConfig()
}
text_font_weight_converter.onChanged { text_font_weight_converter.onChanged {
postEvent(EventBus.UP_CONFIG, true) postEvent(EventBus.UP_CONFIG, true)
} }
@ -165,36 +162,6 @@ class ReadStyleDialog : BaseDialogFragment(), FontSelectDialog.CallBack {
} }
} }
@SuppressLint("InflateParams")
private fun showTitleConfig() = ReadBookConfig.apply {
alert(R.string.title) {
val rootView = LayoutInflater.from(requireContext())
.inflate(R.layout.dialog_title_config, null).apply {
rg_title_mode.checkByIndex(titleMode)
dsb_title_size.progress = titleSize
dsb_title_top.progress = titleTopSpacing
dsb_title_bottom.progress = titleBottomSpacing
rg_title_mode.onCheckedChange { _, checkedId ->
titleMode = rg_title_mode.getIndexById(checkedId)
postEvent(EventBus.UP_CONFIG, true)
}
dsb_title_size.onChanged = {
titleSize = it
postEvent(EventBus.UP_CONFIG, true)
}
dsb_title_top.onChanged = {
titleTopSpacing = it
postEvent(EventBus.UP_CONFIG, true)
}
dsb_title_bottom.onChanged = {
titleBottomSpacing = it
postEvent(EventBus.UP_CONFIG, true)
}
}
customView = rootView
}.show()
}
private fun changeBg(index: Int) { private fun changeBg(index: Int) {
val oldIndex = ReadBookConfig.styleSelect val oldIndex = ReadBookConfig.styleSelect
if (index != oldIndex) { if (index != oldIndex) {

@ -7,8 +7,11 @@ import android.view.ViewGroup
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.BaseDialogFragment import io.legado.app.base.BaseDialogFragment
import io.legado.app.constant.EventBus import io.legado.app.constant.EventBus
import io.legado.app.help.ReadBookConfig
import io.legado.app.help.ReadTipConfig import io.legado.app.help.ReadTipConfig
import io.legado.app.lib.dialogs.selector import io.legado.app.lib.dialogs.selector
import io.legado.app.utils.checkByIndex
import io.legado.app.utils.getIndexById
import io.legado.app.utils.postEvent import io.legado.app.utils.postEvent
import kotlinx.android.synthetic.main.dialog_tip_config.* import kotlinx.android.synthetic.main.dialog_tip_config.*
import org.jetbrains.anko.sdk27.listeners.onCheckedChange import org.jetbrains.anko.sdk27.listeners.onCheckedChange
@ -36,213 +39,128 @@ class TipConfigDialog : BaseDialogFragment() {
} }
private fun initView() { private fun initView() {
rg_title_mode.checkByIndex(ReadBookConfig.titleMode)
dsb_title_size.progress = ReadBookConfig.titleSize
dsb_title_top.progress = ReadBookConfig.titleTopSpacing
dsb_title_bottom.progress = ReadBookConfig.titleBottomSpacing
tv_header_show.text = ReadTipConfig.headerModes[ReadTipConfig.headerMode]
tv_footer_show.text = ReadTipConfig.footerModes[ReadTipConfig.footerMode]
tv_header_left.text = ReadTipConfig.tipHeaderLeftStr tv_header_left.text = ReadTipConfig.tipHeaderLeftStr
tv_header_middle.text = ReadTipConfig.tipHeaderMiddleStr tv_header_middle.text = ReadTipConfig.tipHeaderMiddleStr
tv_header_right.text = ReadTipConfig.tipHeaderRightStr tv_header_right.text = ReadTipConfig.tipHeaderRightStr
tv_footer_left.text = ReadTipConfig.tipFooterLeftStr tv_footer_left.text = ReadTipConfig.tipFooterLeftStr
tv_footer_middle.text = ReadTipConfig.tipFooterMiddleStr tv_footer_middle.text = ReadTipConfig.tipFooterMiddleStr
tv_footer_right.text = ReadTipConfig.tipFooterRightStr tv_footer_right.text = ReadTipConfig.tipFooterRightStr
sw_hide_header.isChecked = ReadTipConfig.hideHeader
sw_hide_footer.isChecked = ReadTipConfig.hideFooter
} }
private fun initEvent() { private fun initEvent() {
tv_header_left.onClick { rg_title_mode.onCheckedChange { _, checkedId ->
selector(items = ReadTipConfig.tipArray.toList()) { _, i -> ReadBookConfig.titleMode = rg_title_mode.getIndexById(checkedId)
ReadTipConfig.apply {
if (i != none) {
if (tipHeaderMiddle == i) {
tipHeaderMiddle = none
tv_header_middle.text = tipArray[none]
}
if (tipHeaderRight == i) {
tipHeaderRight = none
tv_header_right.text = tipArray[none]
}
if (tipFooterLeft == i) {
tipFooterLeft = none
tv_footer_left.text = tipArray[none]
}
if (tipFooterMiddle == i) {
tipFooterMiddle = none
tv_footer_middle.text = tipArray[none]
}
if (tipFooterRight == i) {
tipFooterRight = none
tv_footer_right.text = tipArray[none]
}
}
tipHeaderLeft = i
tv_header_left.text = tipArray[i]
}
postEvent(EventBus.UP_CONFIG, true) postEvent(EventBus.UP_CONFIG, true)
} }
} dsb_title_size.onChanged = {
tv_header_middle.onClick { ReadBookConfig.titleSize = it
selector(items = ReadTipConfig.tipArray.toList()) { _, i ->
ReadTipConfig.apply {
if (i != none) {
if (tipHeaderLeft == i) {
tipHeaderLeft = none
tv_header_left.text = tipArray[none]
}
if (tipHeaderRight == i) {
tipHeaderRight = none
tv_header_right.text = tipArray[none]
}
if (tipFooterLeft == i) {
tipFooterLeft = none
tv_footer_left.text = tipArray[none]
}
if (tipFooterMiddle == i) {
tipFooterMiddle = none
tv_footer_middle.text = tipArray[none]
}
if (tipFooterRight == i) {
tipFooterRight = none
tv_footer_right.text = tipArray[none]
}
}
tipHeaderMiddle = i
tv_header_middle.text = tipArray[i]
}
postEvent(EventBus.UP_CONFIG, true) postEvent(EventBus.UP_CONFIG, true)
} }
} dsb_title_top.onChanged = {
tv_header_right.onClick { ReadBookConfig.titleTopSpacing = it
selector(items = ReadTipConfig.tipArray.toList()) { _, i ->
ReadTipConfig.apply {
if (i != none) {
if (tipHeaderLeft == i) {
tipHeaderLeft = none
tv_header_left.text = tipArray[none]
}
if (tipHeaderMiddle == i) {
tipHeaderMiddle = none
tv_header_middle.text = tipArray[none]
}
if (tipFooterLeft == i) {
tipFooterLeft = none
tv_footer_left.text = tipArray[none]
}
if (tipFooterMiddle == i) {
tipFooterMiddle = none
tv_footer_middle.text = tipArray[none]
}
if (tipFooterRight == i) {
tipFooterRight = none
tv_footer_right.text = tipArray[none]
}
}
tipHeaderRight = i
tv_header_right.text = tipArray[i]
}
postEvent(EventBus.UP_CONFIG, true) postEvent(EventBus.UP_CONFIG, true)
} }
dsb_title_bottom.onChanged = {
ReadBookConfig.titleBottomSpacing = it
postEvent(EventBus.UP_CONFIG, true)
} }
tv_footer_left.onClick { ll_header_show.onClick {
selector(items = ReadTipConfig.tipArray.toList()) { _, i -> selector(items = ReadTipConfig.headerModes.values.toList()) { _, i ->
ReadTipConfig.apply { ReadTipConfig.headerMode = ReadTipConfig.headerModes.keys.toList()[i]
if (i != none) { tv_header_show.text = ReadTipConfig.headerModes[ReadTipConfig.headerMode]
if (tipHeaderLeft == i) { postEvent(EventBus.UP_CONFIG, true)
tipHeaderLeft = none
tv_header_left.text = tipArray[none]
}
if (tipHeaderMiddle == i) {
tipHeaderMiddle = none
tv_header_middle.text = tipArray[none]
} }
if (tipHeaderRight == i) {
tipHeaderRight = none
tv_header_right.text = tipArray[none]
} }
if (tipFooterMiddle == i) { ll_footer_show.onClick {
tipFooterMiddle = none selector(items = ReadTipConfig.footerModes.values.toList()) { _, i ->
tv_footer_middle.text = tipArray[none] ReadTipConfig.footerMode = ReadTipConfig.footerModes.keys.toList()[i]
tv_footer_show.text = ReadTipConfig.footerModes[ReadTipConfig.footerMode]
postEvent(EventBus.UP_CONFIG, true)
} }
if (tipFooterRight == i) {
tipFooterRight = none
tv_footer_right.text = tipArray[none]
} }
ll_header_left.onClick {
selector(items = ReadTipConfig.tips) { _, i ->
clearRepeat(i)
ReadTipConfig.tipHeaderLeft = i
tv_header_left.text = ReadTipConfig.tips[i]
postEvent(EventBus.UP_CONFIG, true)
} }
tipFooterLeft = i
tv_footer_left.text = tipArray[i]
} }
ll_header_middle.onClick {
selector(items = ReadTipConfig.tips) { _, i ->
clearRepeat(i)
ReadTipConfig.tipHeaderMiddle = i
tv_header_middle.text = ReadTipConfig.tips[i]
postEvent(EventBus.UP_CONFIG, true) postEvent(EventBus.UP_CONFIG, true)
} }
} }
tv_footer_middle.onClick { ll_header_right.onClick {
selector(items = ReadTipConfig.tipArray.toList()) { _, i -> selector(items = ReadTipConfig.tips) { _, i ->
ReadTipConfig.apply { clearRepeat(i)
if (i != none) { ReadTipConfig.tipHeaderRight = i
if (tipHeaderLeft == i) { tv_header_right.text = ReadTipConfig.tips[i]
tipHeaderLeft = none postEvent(EventBus.UP_CONFIG, true)
tv_header_left.text = tipArray[none]
} }
if (tipHeaderMiddle == i) {
tipHeaderMiddle = none
tv_header_middle.text = tipArray[none]
} }
if (tipHeaderRight == i) { ll_footer_left.onClick {
tipHeaderRight = none selector(items = ReadTipConfig.tips) { _, i ->
tv_header_right.text = tipArray[none] clearRepeat(i)
ReadTipConfig.tipFooterLeft = i
tv_footer_left.text = ReadTipConfig.tips[i]
postEvent(EventBus.UP_CONFIG, true)
} }
if (tipFooterLeft == i) {
tipFooterLeft = none
tv_footer_left.text = tipArray[none]
}
if (tipFooterRight == i) {
tipFooterRight = none
tv_footer_right.text = tipArray[none]
} }
ll_footer_middle.onClick {
selector(items = ReadTipConfig.tips) { _, i ->
clearRepeat(i)
ReadTipConfig.tipFooterMiddle = i
tv_footer_middle.text = ReadTipConfig.tips[i]
postEvent(EventBus.UP_CONFIG, true)
} }
tipFooterMiddle = i
tv_footer_middle.text = tipArray[i]
} }
ll_footer_right.onClick {
selector(items = ReadTipConfig.tips) { _, i ->
clearRepeat(i)
ReadTipConfig.tipFooterRight = i
tv_footer_right.text = ReadTipConfig.tips[i]
postEvent(EventBus.UP_CONFIG, true) postEvent(EventBus.UP_CONFIG, true)
} }
} }
tv_footer_right.onClick { }
selector(items = ReadTipConfig.tipArray.toList()) { _, i ->
ReadTipConfig.apply { private fun clearRepeat(repeat: Int) = ReadTipConfig.apply {
if (i != none) { if (repeat != none) {
if (tipHeaderLeft == i) { if (tipHeaderLeft == repeat) {
tipHeaderLeft = none tipHeaderLeft = none
tv_header_left.text = tipArray[none] tv_header_left.text = tips[none]
} }
if (tipHeaderMiddle == i) { if (tipHeaderMiddle == repeat) {
tipHeaderMiddle = none tipHeaderMiddle = none
tv_header_middle.text = tipArray[none] tv_header_middle.text = tips[none]
} }
if (tipHeaderRight == i) { if (tipHeaderRight == repeat) {
tipHeaderRight = none tipHeaderRight = none
tv_header_right.text = tipArray[none] tv_header_right.text = tips[none]
} }
if (tipFooterLeft == i) { if (tipFooterLeft == repeat) {
tipFooterLeft = none tipFooterLeft = none
tv_footer_left.text = tipArray[none] tv_footer_left.text = tips[none]
} }
if (tipFooterMiddle == i) { if (tipFooterMiddle == repeat) {
tipFooterMiddle = none tipFooterMiddle = none
tv_footer_middle.text = tipArray[none] tv_footer_middle.text = tips[none]
}
}
tipFooterRight = i
tv_footer_right.text = tipArray[i]
} }
postEvent(EventBus.UP_CONFIG, true) if (tipFooterRight == repeat) {
} tipFooterRight = none
} tv_footer_right.text = tips[none]
sw_hide_header.onCheckedChange { buttonView, isChecked ->
if (buttonView?.isPressed == true) {
ReadTipConfig.hideHeader = isChecked
postEvent(EventBus.UP_CONFIG, true)
}
}
sw_hide_footer.onCheckedChange { buttonView, isChecked ->
if (buttonView?.isPressed == true) {
ReadTipConfig.hideFooter = isChecked
postEvent(EventBus.UP_CONFIG, true)
} }
} }
} }

@ -111,8 +111,15 @@ class ContentView(context: Context) : FrameLayout(context) {
bv_footer_left.isInvisible = tipFooterLeft == none || !tv_footer_left.isInvisible bv_footer_left.isInvisible = tipFooterLeft == none || !tv_footer_left.isInvisible
tv_footer_right.isGone = tipFooterRight == none tv_footer_right.isGone = tipFooterRight == none
tv_footer_middle.isGone = tipFooterMiddle == none tv_footer_middle.isGone = tipFooterMiddle == none
ll_header.isGone = hideHeader ll_header.isGone = when (headerMode) {
ll_footer.isGone = hideFooter 1 -> false
2 -> true
else -> !ReadBookConfig.hideStatusBar
}
ll_footer.isGone = when (footerMode) {
1 -> true
else -> false
}
} }
tvTitle = when (ReadTipConfig.chapterTitle) { tvTitle = when (ReadTipConfig.chapterTitle) {
ReadTipConfig.tipHeaderLeft -> tv_header_left ReadTipConfig.tipHeaderLeft -> tv_header_left

@ -41,7 +41,7 @@ class DetailSeekBar @JvmOverloads constructor(
tv_seek_title.text = typedArray.getText(R.styleable.DetailSeekBar_title) tv_seek_title.text = typedArray.getText(R.styleable.DetailSeekBar_title)
seek_bar.max = typedArray.getInteger(R.styleable.DetailSeekBar_max, 0) seek_bar.max = typedArray.getInteger(R.styleable.DetailSeekBar_max, 0)
typedArray.recycle() typedArray.recycle()
if (isBottomBackground) { if (isBottomBackground && !isInEditMode) {
val isLight = ColorUtils.isColorLight(context.bottomBackground) val isLight = ColorUtils.isColorLight(context.bottomBackground)
val textColor = context.getPrimaryTextColor(isLight) val textColor = context.getPrimaryTextColor(isLight)
tv_seek_title.setTextColor(textColor) tv_seek_title.setTextColor(textColor)

@ -20,25 +20,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="0.5" /> android:layout_weight="0.5" />
<io.legado.app.ui.widget.text.StrokeTextView
android:id="@+id/tv_title_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="6dp"
android:paddingRight="6dp"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:text="@string/title"
android:gravity="center"
android:textSize="14sp"
app:isBottomBackground="true"
app:radius="3dp" />
<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<io.legado.app.ui.book.read.config.TextFontWeightConverter <io.legado.app.ui.book.read.config.TextFontWeightConverter
android:id="@+id/text_font_weight_converter" android:id="@+id/text_font_weight_converter"
android:layout_width="wrap_content" android:layout_width="wrap_content"

@ -1,125 +1,273 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="16dp" android:orientation="vertical"
android:orientation="vertical"> android:padding="16dp">
<io.legado.app.ui.widget.text.AccentTextView <io.legado.app.ui.widget.text.AccentTextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/header" /> android:text="@string/body_title"
android:textSize="18sp" />
<RadioGroup
android:id="@+id/rg_title_mode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RadioButton
android:id="@+id/rb_title_mode1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="3dp"
android:text="@string/title_left" />
<RadioButton
android:id="@+id/rb_title_mode2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="3dp"
android:text="@string/title_center" />
<RadioButton
android:id="@+id/rb_title_mode3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="3dp"
android:text="@string/title_hide" />
</RadioGroup>
<io.legado.app.ui.widget.DetailSeekBar
android:id="@+id/dsb_title_size"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="3dp"
app:max="10"
app:title="字号" />
<io.legado.app.ui.widget.DetailSeekBar
android:id="@+id/dsb_title_top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="3dp"
app:max="100"
app:title="上间距" />
<io.legado.app.ui.widget.DetailSeekBar
android:id="@+id/dsb_title_bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="3dp"
app:max="100"
app:title="下间距" />
<io.legado.app.ui.widget.text.AccentTextView
android:id="@+id/tv_header_padding"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/header"
android:textSize="18sp" />
<LinearLayout <LinearLayout
android:id="@+id/ll_header_show"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="12dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal"
tools:ignore="RtlHardcoded,RtlSymmetry"> tools:ignore="RtlHardcoded,RtlSymmetry">
<TextView <TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="6dp"
android:text="@string/show_hide" />
<TextView
android:id="@+id/tv_header_show"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="4dp" android:padding="6dp"
android:text="@string/left" /> tools:text="@string/show_hide" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_header_left"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
tools:ignore="RtlHardcoded,RtlSymmetry">
<TextView <TextView
android:id="@+id/tv_header_left"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" /> android:layout_weight="1"
android:padding="6dp"
android:text="@string/left" />
<TextView <TextView
android:id="@+id/tv_header_left"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="4dp" android:padding="6dp"
android:text="@string/middle" /> tools:text="@string/title" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_header_middle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
tools:ignore="RtlHardcoded,RtlSymmetry">
<TextView <TextView
android:id="@+id/tv_header_middle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" /> android:layout_weight="1"
android:padding="6dp"
android:text="@string/middle" />
<TextView <TextView
android:id="@+id/tv_header_middle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="4dp" android:padding="6dp"
tools:text="@string/title" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_header_right"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
tools:ignore="RtlHardcoded,RtlSymmetry">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="6dp"
android:text="@string/right" /> android:text="@string/right" />
<TextView <TextView
android:id="@+id/tv_header_right" android:id="@+id/tv_header_right"
android:layout_width="0dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" /> android:padding="6dp"
tools:text="@string/title" />
</LinearLayout> </LinearLayout>
<io.legado.app.ui.widget.text.AccentTextView <io.legado.app.ui.widget.text.AccentTextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/footer" /> android:text="@string/footer"
android:textSize="18sp" />
<LinearLayout <LinearLayout
android:id="@+id/ll_footer_show"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="12dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal"
tools:ignore="RtlHardcoded,RtlSymmetry"> tools:ignore="RtlHardcoded,RtlSymmetry">
<TextView <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="4dp"
android:text="@string/left" />
<TextView
android:id="@+id/tv_footer_left"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" /> android:layout_weight="1"
android:padding="6dp"
android:text="@string/show_hide" />
<TextView <TextView
android:id="@+id/tv_footer_show"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="4dp" android:padding="6dp"
android:text="@string/middle" /> tools:text="@string/show_hide" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_footer_left"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
tools:ignore="RtlHardcoded,RtlSymmetry">
<TextView <TextView
android:id="@+id/tv_footer_middle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" /> android:layout_weight="1"
android:padding="6dp"
android:text="@string/left" />
<TextView <TextView
android:id="@+id/tv_footer_left"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="4dp" android:padding="6dp"
android:text="@string/right" /> tools:text="@string/title" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_footer_middle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
tools:ignore="RtlHardcoded,RtlSymmetry">
<TextView <TextView
android:id="@+id/tv_footer_right"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" /> android:layout_weight="1"
android:padding="6dp"
android:text="@string/middle" />
<TextView
android:id="@+id/tv_footer_middle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="6dp"
tools:text="@string/title" />
</LinearLayout> </LinearLayout>
<Switch <LinearLayout
android:id="@+id/sw_hide_header" android:id="@+id/ll_footer_right"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
tools:ignore="RtlHardcoded,RtlSymmetry">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="6dp" android:padding="6dp"
android:text="@string/hideHeader" /> android:text="@string/right" />
<Switch <TextView
android:id="@+id/sw_hide_footer" android:id="@+id/tv_footer_right"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="6dp" android:padding="6dp"
android:text="@string/hideFooter" /> tools:text="@string/title" />
</LinearLayout>
</LinearLayout> </LinearLayout>

@ -1,61 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="10dp">
<RadioGroup
android:id="@+id/rg_title_mode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RadioButton
android:id="@+id/rb_title_mode1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="3dp"
android:text="@string/title_left" />
<RadioButton
android:id="@+id/rb_title_mode2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="3dp"
android:text="@string/title_center" />
<RadioButton
android:id="@+id/rb_title_mode3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="3dp"
android:text="@string/title_hide" />
</RadioGroup>
<io.legado.app.ui.widget.DetailSeekBar
android:id="@+id/dsb_title_size"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="3dp"
app:max="10"
app:title="字号" />
<io.legado.app.ui.widget.DetailSeekBar
android:id="@+id/dsb_title_top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="3dp"
app:max="100"
app:title="上间距" />
<io.legado.app.ui.widget.DetailSeekBar
android:id="@+id/dsb_title_bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="3dp"
app:max="100"
app:title="下间距" />
</LinearLayout>

@ -8,7 +8,7 @@
<TextView <TextView
android:id="@+id/tv_seek_title" android:id="@+id/tv_seek_title"
android:layout_width="50dp" android:layout_width="60dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
android:text="seek" android:text="seek"
@ -42,7 +42,7 @@
<TextView <TextView
android:id="@+id/tv_seek_value" android:id="@+id/tv_seek_value"
android:layout_width="40dp" android:layout_width="60dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="right" android:gravity="right"
android:singleLine="true" android:singleLine="true"

@ -695,8 +695,6 @@
<string name="night_accent">夜間,強調色</string> <string name="night_accent">夜間,強調色</string>
<string name="night_background_color">夜間,背景色</string> <string name="night_background_color">夜間,背景色</string>
<string name="night_navbar_color">夜間,導航欄顏色</string> <string name="night_navbar_color">夜間,導航欄顏色</string>
<string name="hideHeader">隱藏頁眉</string>
<string name="hideFooter">隱藏頁脚</string>
<string name="auto_change_source">自動換源</string> <string name="auto_change_source">自動換源</string>
<string name="to_bottom">置底</string> <string name="to_bottom">置底</string>
<string name="text_full_justify">文字兩端對齊</string> <string name="text_full_justify">文字兩端對齊</string>
@ -785,5 +783,7 @@
<string name="next_page">下一页</string> <string name="next_page">下一页</string>
<string name="prev_page">上一页</string> <string name="prev_page">上一页</string>
<string name="non_action">无操作</string> <string name="non_action">无操作</string>
<string name="body_title">正文标题</string>
<string name="show_hide">显示/隐藏</string>
</resources> </resources>

@ -681,8 +681,6 @@
<string name="click_to_apply">點擊加入</string> <string name="click_to_apply">點擊加入</string>
<string name="middle"></string> <string name="middle"></string>
<string name="information">訊息</string> <string name="information">訊息</string>
<string name="hideHeader">隱藏頁首</string>
<string name="hideFooter">隱藏頁尾</string>
<string name="switchLayout">切換布局</string> <string name="switchLayout">切換布局</string>
<!--color--> <!--color-->
@ -786,5 +784,7 @@
<string name="next_page">下一页</string> <string name="next_page">下一页</string>
<string name="prev_page">上一页</string> <string name="prev_page">上一页</string>
<string name="non_action">无操作</string> <string name="non_action">无操作</string>
<string name="body_title">正文标题</string>
<string name="show_hide">显示/隐藏</string>
</resources> </resources>

@ -690,8 +690,6 @@
<string name="click_to_apply">点击加入</string> <string name="click_to_apply">点击加入</string>
<string name="middle"></string> <string name="middle"></string>
<string name="information">信息</string> <string name="information">信息</string>
<string name="hideHeader">隐藏页眉</string>
<string name="hideFooter">隐藏页脚</string>
<string name="switchLayout">切换布局</string> <string name="switchLayout">切换布局</string>
<string name="text_font_weight_converter">文章字重切换</string> <string name="text_font_weight_converter">文章字重切换</string>
@ -789,5 +787,7 @@
<string name="next_page">下一页</string> <string name="next_page">下一页</string>
<string name="prev_page">上一页</string> <string name="prev_page">上一页</string>
<string name="non_action">无操作</string> <string name="non_action">无操作</string>
<string name="body_title">正文标题</string>
<string name="show_hide">显示/隐藏</string>
</resources> </resources>

@ -691,8 +691,6 @@
<string name="click_to_apply">Tap to join</string> <string name="click_to_apply">Tap to join</string>
<string name="middle">Middle</string> <string name="middle">Middle</string>
<string name="information">Information</string> <string name="information">Information</string>
<string name="hideHeader">Hide header</string>
<string name="hideFooter">Hide footer</string>
<string name="switchLayout">Switch Layout</string> <string name="switchLayout">Switch Layout</string>
<string name="text_font_weight_converter">Text font weight switching</string> <string name="text_font_weight_converter">Text font weight switching</string>
@ -792,5 +790,7 @@
<string name="next_page">下一页</string> <string name="next_page">下一页</string>
<string name="prev_page">上一页</string> <string name="prev_page">上一页</string>
<string name="non_action">无操作</string> <string name="non_action">无操作</string>
<string name="body_title">正文标题</string>
<string name="show_hide">显示/隐藏</string>
</resources> </resources>

Loading…
Cancel
Save