优化
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
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.Gravity
|
import android.view.Gravity
|
||||||
@@ -20,10 +21,7 @@ import io.legado.app.model.ReadBook
|
|||||||
import io.legado.app.service.BaseReadAloudService
|
import io.legado.app.service.BaseReadAloudService
|
||||||
import io.legado.app.ui.book.read.ReadBookActivity
|
import io.legado.app.ui.book.read.ReadBookActivity
|
||||||
import io.legado.app.ui.widget.seekbar.SeekBarChangeListener
|
import io.legado.app.ui.widget.seekbar.SeekBarChangeListener
|
||||||
import io.legado.app.utils.ColorUtils
|
import io.legado.app.utils.*
|
||||||
import io.legado.app.utils.getPrefBoolean
|
|
||||||
import io.legado.app.utils.observeEvent
|
|
||||||
import io.legado.app.utils.toastOnUi
|
|
||||||
import io.legado.app.utils.viewbindingdelegate.viewBinding
|
import io.legado.app.utils.viewbindingdelegate.viewBinding
|
||||||
|
|
||||||
|
|
||||||
@@ -67,6 +65,7 @@ class ReadAloudDialog : BaseDialogFragment(R.layout.dialog_read_aloud) {
|
|||||||
tvTimer.setTextColor(textColor)
|
tvTimer.setTextColor(textColor)
|
||||||
ivTtsSpeechReduce.setColorFilter(textColor)
|
ivTtsSpeechReduce.setColorFilter(textColor)
|
||||||
tvTtsSpeed.setTextColor(textColor)
|
tvTtsSpeed.setTextColor(textColor)
|
||||||
|
tvTtsSpeedValue.setTextColor(textColor)
|
||||||
ivTtsSpeechAdd.setColorFilter(textColor)
|
ivTtsSpeechAdd.setColorFilter(textColor)
|
||||||
ivCatalog.setColorFilter(textColor)
|
ivCatalog.setColorFilter(textColor)
|
||||||
tvCatalog.setTextColor(textColor)
|
tvCatalog.setTextColor(textColor)
|
||||||
@@ -138,6 +137,12 @@ class ReadAloudDialog : BaseDialogFragment(R.layout.dialog_read_aloud) {
|
|||||||
//设置保存的默认值
|
//设置保存的默认值
|
||||||
seekTtsSpeechRate.progress = AppConfig.ttsSpeechRate
|
seekTtsSpeechRate.progress = AppConfig.ttsSpeechRate
|
||||||
seekTtsSpeechRate.setOnSeekBarChangeListener(object : SeekBarChangeListener {
|
seekTtsSpeechRate.setOnSeekBarChangeListener(object : SeekBarChangeListener {
|
||||||
|
|
||||||
|
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
|
||||||
|
super.onProgressChanged(seekBar, progress, fromUser)
|
||||||
|
upTtsSpeechRateText(progress)
|
||||||
|
}
|
||||||
|
|
||||||
override fun onStopTrackingTouch(seekBar: SeekBar) {
|
override fun onStopTrackingTouch(seekBar: SeekBar) {
|
||||||
AppConfig.ttsSpeechRate = seekBar.progress
|
AppConfig.ttsSpeechRate = seekBar.progress
|
||||||
upTtsSpeechRate()
|
upTtsSpeechRate()
|
||||||
@@ -156,6 +161,8 @@ class ReadAloudDialog : BaseDialogFragment(R.layout.dialog_read_aloud) {
|
|||||||
|
|
||||||
private fun upTtsSpeechRateEnabled(enabled: Boolean) {
|
private fun upTtsSpeechRateEnabled(enabled: Boolean) {
|
||||||
binding.run {
|
binding.run {
|
||||||
|
upTtsSpeechRateText(AppConfig.ttsSpeechRate)
|
||||||
|
tvTtsSpeedValue.visible(enabled)
|
||||||
seekTtsSpeechRate.isEnabled = enabled
|
seekTtsSpeechRate.isEnabled = enabled
|
||||||
ivTtsSpeechReduce.isEnabled = enabled
|
ivTtsSpeechReduce.isEnabled = enabled
|
||||||
ivTtsSpeechAdd.isEnabled = enabled
|
ivTtsSpeechAdd.isEnabled = enabled
|
||||||
@@ -194,6 +201,11 @@ class ReadAloudDialog : BaseDialogFragment(R.layout.dialog_read_aloud) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
private fun upTtsSpeechRateText(value: Int) {
|
||||||
|
binding.tvTtsSpeedValue.text = ((value + 5) / 10f).toString()
|
||||||
|
}
|
||||||
|
|
||||||
private fun upTtsSpeechRate() {
|
private fun upTtsSpeechRate() {
|
||||||
ReadAloud.upTtsSpeechRate(requireContext())
|
ReadAloud.upTtsSpeechRate(requireContext())
|
||||||
if (!BaseReadAloudService.pause) {
|
if (!BaseReadAloudService.pause) {
|
||||||
|
|||||||
@@ -165,14 +165,28 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_tts_speed"
|
android:id="@+id/tv_tts_speed"
|
||||||
android:layout_width="0dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_weight="1"
|
|
||||||
android:text="@string/read_aloud_speed"
|
android:text="@string/read_aloud_speed"
|
||||||
android:textColor="@color/primaryText"
|
android:textColor="@color/primaryText"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_tts_speed_value"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:paddingHorizontal="3dp"
|
||||||
|
android:textColor="@color/primaryText"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_gravity="center" />
|
||||||
|
|
||||||
<io.legado.app.lib.theme.view.ThemeSwitch
|
<io.legado.app.lib.theme.view.ThemeSwitch
|
||||||
android:id="@+id/cb_tts_follow_sys"
|
android:id="@+id/cb_tts_follow_sys"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@@ -279,7 +293,8 @@
|
|||||||
android:contentDescription="@string/read_aloud"
|
android:contentDescription="@string/read_aloud"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingBottom="7dp">
|
android:paddingBottom="7dp"
|
||||||
|
tools:ignore="TextSizeCheck">
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
android:id="@+id/iv_main_menu"
|
android:id="@+id/iv_main_menu"
|
||||||
@@ -297,9 +312,9 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
android:layout_marginTop="3dp"
|
android:layout_marginTop="3dp"
|
||||||
android:text="@string/main_menu"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:ellipsize="middle"
|
android:ellipsize="middle"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="@string/main_menu"
|
||||||
android:textColor="@color/primaryText"
|
android:textColor="@color/primaryText"
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
Reference in New Issue
Block a user