pull/32/head
kunfei 5 years ago
parent 99bb0b1ebb
commit 3df63c6f93
  1. 2
      app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt
  2. 31
      app/src/main/java/io/legado/app/ui/readbook/config/ReadStyleDialog.kt
  3. 24
      app/src/main/res/layout/dialog_read_book_style.xml

@ -462,6 +462,8 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_rea
page_view.upStyle() page_view.upStyle()
if (it) { if (it) {
loadContent() loadContent()
} else {
page_view.upContent()
} }
} }
observeEvent<Int>(Bus.TTS_START) { chapterStart -> observeEvent<Int>(Bus.TTS_START) { chapterStart ->

@ -83,29 +83,46 @@ class ReadStyleDialog : DialogFragment() {
tv_text_bold.onClick { tv_text_bold.onClick {
textBold = !textBold textBold = !textBold
tv_text_bold.isSelected = textBold tv_text_bold.isSelected = textBold
postEvent(Bus.UP_CONFIG, true) postEvent(Bus.UP_CONFIG, false)
} }
seek_text_size.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener { seek_text_size.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) { override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
textSize = progress + 5 textSize = progress + 5
postEvent(Bus.UP_CONFIG, true) postEvent(Bus.UP_CONFIG, true)
} }
override fun onStartTrackingTouch(seekBar: SeekBar?) {} override fun onStartTrackingTouch(seekBar: SeekBar?) {}
override fun onStopTrackingTouch(seekBar: SeekBar?) {}
override fun onStopTrackingTouch(seekBar: SeekBar?) {
}
}) })
iv_text_size_add.onClick { iv_text_size_add.onClick {
textSize++ textSize++
if (textSize > 50) textSize = 50 if (textSize > 50) textSize = 50
seek_text_size.progress = textSize - 5
postEvent(Bus.UP_CONFIG, true) postEvent(Bus.UP_CONFIG, true)
} }
iv_line_size_remove.onClick { iv_line_size_remove.onClick {
textSize-- textSize--
if (textSize < 5) textSize = 5 if (textSize < 5) textSize = 5
seek_text_size.progress = textSize - 5
postEvent(Bus.UP_CONFIG, true)
}
seek_text_letter_spacing.setOnSeekBarChangeListener(object :
SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
letterSpacing = (progress - 5) / 10f
postEvent(Bus.UP_CONFIG, true)
}
override fun onStartTrackingTouch(seekBar: SeekBar?) {}
override fun onStopTrackingTouch(seekBar: SeekBar?) {}
})
iv_text_letter_spacing_add.onClick {
letterSpacing += 0.1f
seek_text_letter_spacing.progress = (letterSpacing * 10).toInt() + 5
postEvent(Bus.UP_CONFIG, true)
}
iv_text_letter_spacing_remove.onClick {
letterSpacing -= 0.1f
seek_text_letter_spacing.progress = (letterSpacing * 10).toInt() + 5
postEvent(Bus.UP_CONFIG, true) postEvent(Bus.UP_CONFIG, true)
} }
rg_page_anim.onCheckedChange { _, checkedId -> rg_page_anim.onCheckedChange { _, checkedId ->

@ -84,10 +84,10 @@
android:text="@string/text_size" /> android:text="@string/text_size" />
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_text_size_add" android:id="@+id/iv_text_size_remove"
android:layout_width="24dp" android:layout_width="24dp"
android:layout_height="24dp" android:layout_height="24dp"
android:src="@drawable/ic_add" android:src="@drawable/ic_remove"
android:background="?android:attr/selectableItemBackgroundBorderless" android:background="?android:attr/selectableItemBackgroundBorderless"
android:tint="@color/tv_text_default" /> android:tint="@color/tv_text_default" />
@ -100,10 +100,10 @@
android:max="45" /> android:max="45" />
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_text_size_remove" android:id="@+id/iv_text_size_add"
android:layout_width="24dp" android:layout_width="24dp"
android:layout_height="24dp" android:layout_height="24dp"
android:src="@drawable/ic_remove" android:src="@drawable/ic_add"
android:background="?android:attr/selectableItemBackgroundBorderless" android:background="?android:attr/selectableItemBackgroundBorderless"
android:tint="@color/tv_text_default" /> android:tint="@color/tv_text_default" />
@ -125,10 +125,10 @@
android:text="@string/text_letter_spacing" /> android:text="@string/text_letter_spacing" />
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_text_letter_spacing_add" android:id="@+id/iv_text_letter_spacing_remove"
android:layout_width="24dp" android:layout_width="24dp"
android:layout_height="24dp" android:layout_height="24dp"
android:src="@drawable/ic_add" android:src="@drawable/ic_remove"
android:background="?android:attr/selectableItemBackgroundBorderless" android:background="?android:attr/selectableItemBackgroundBorderless"
android:tint="@color/tv_text_default" /> android:tint="@color/tv_text_default" />
@ -141,10 +141,10 @@
android:max="10" /> android:max="10" />
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_text_letter_spacing_remove" android:id="@+id/iv_text_letter_spacing_add"
android:layout_width="24dp" android:layout_width="24dp"
android:layout_height="24dp" android:layout_height="24dp"
android:src="@drawable/ic_remove" android:src="@drawable/ic_add"
android:background="?android:attr/selectableItemBackgroundBorderless" android:background="?android:attr/selectableItemBackgroundBorderless"
android:tint="@color/tv_text_default" /> android:tint="@color/tv_text_default" />
@ -166,10 +166,10 @@
android:text="@string/line_size" /> android:text="@string/line_size" />
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_text_line_size_add" android:id="@+id/iv_line_size_remove"
android:layout_width="24dp" android:layout_width="24dp"
android:layout_height="24dp" android:layout_height="24dp"
android:src="@drawable/ic_add" android:src="@drawable/ic_remove"
android:background="?android:attr/selectableItemBackgroundBorderless" android:background="?android:attr/selectableItemBackgroundBorderless"
android:tint="@color/tv_text_default" /> android:tint="@color/tv_text_default" />
@ -182,10 +182,10 @@
android:max="50" /> android:max="50" />
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_line_size_remove" android:id="@+id/iv_text_line_size_add"
android:layout_width="24dp" android:layout_width="24dp"
android:layout_height="24dp" android:layout_height="24dp"
android:src="@drawable/ic_remove" android:src="@drawable/ic_add"
android:background="?android:attr/selectableItemBackgroundBorderless" android:background="?android:attr/selectableItemBackgroundBorderless"
android:tint="@color/tv_text_default" /> android:tint="@color/tv_text_default" />

Loading…
Cancel
Save