feat: 优化代码

pull/106/head
kunfei 5 years ago
parent 7737089ee4
commit b65065e6a6
  1. 6
      app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt
  2. 2
      app/src/main/res/layout/dialog_read_book_style.xml

@ -71,7 +71,7 @@ class ReadStyleDialog : DialogFragment(), FontSelectDialog.CallBack {
(it + 5).toString() (it + 5).toString()
} }
dsb_text_letter_spacing.valueFormat = { dsb_text_letter_spacing.valueFormat = {
((it - 5) / 10f).toString() ((it - 50) / 100f).toString()
} }
} }
@ -121,7 +121,7 @@ class ReadStyleDialog : DialogFragment(), FontSelectDialog.CallBack {
postEvent(EventBus.UP_CONFIG, true) postEvent(EventBus.UP_CONFIG, true)
} }
dsb_text_letter_spacing.onChanged = { dsb_text_letter_spacing.onChanged = {
ReadBookConfig.durConfig.letterSpacing = (it - 5) / 10f ReadBookConfig.durConfig.letterSpacing = (it - 50) / 100f
postEvent(EventBus.UP_CONFIG, true) postEvent(EventBus.UP_CONFIG, true)
} }
dsb_line_size.onChanged = { dsb_line_size.onChanged = {
@ -180,7 +180,7 @@ class ReadStyleDialog : DialogFragment(), FontSelectDialog.CallBack {
ReadBookConfig.durConfig.let { ReadBookConfig.durConfig.let {
tv_text_bold.isSelected = it.textBold tv_text_bold.isSelected = it.textBold
dsb_text_size.progress = it.textSize - 5 dsb_text_size.progress = it.textSize - 5
dsb_text_letter_spacing.progress = (it.letterSpacing * 10).toInt() + 5 dsb_text_letter_spacing.progress = (it.letterSpacing * 100).toInt() + 50
dsb_line_size.progress = it.lineSpacingExtra dsb_line_size.progress = it.lineSpacingExtra
dsb_paragraph_spacing.progress = it.paragraphSpacing dsb_paragraph_spacing.progress = it.paragraphSpacing
} }

@ -98,7 +98,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="10dp" android:paddingLeft="10dp"
android:paddingRight="10dp" android:paddingRight="10dp"
app:max="10" app:max="100"
app:title="@string/text_letter_spacing" app:title="@string/text_letter_spacing"
app:layout_constraintTop_toBottomOf="@+id/dsb_text_size" /> app:layout_constraintTop_toBottomOf="@+id/dsb_text_size" />

Loading…
Cancel
Save