修复朗读设置界面问题 #100

This commit is contained in:
HapeLee
2025-10-15 01:12:45 +08:00
parent 0cbffe866b
commit 239ee28179
2 changed files with 37 additions and 47 deletions
@@ -94,11 +94,11 @@ class ReadAloudDialog : BaseBottomSheetDialogFragment(R.layout.dialog_read_aloud
} }
private fun initEvent() = binding.run { private fun initEvent() = binding.run {
llMainMenu.setOnClickListener { ivMainMenu.setOnClickListener {
callBack?.showMenuBar() callBack?.showMenuBar()
dismissAllowingStateLoss() dismissAllowingStateLoss()
} }
llSetting.setOnClickListener { ivSetting.setOnClickListener {
ReadAloudConfigDialog().show(childFragmentManager, "readAloudConfigDialog") ReadAloudConfigDialog().show(childFragmentManager, "readAloudConfigDialog")
} }
tvPre.setOnClickListener { ReadBook.moveToPrevChapter(upContent = true, toLast = false) } tvPre.setOnClickListener { ReadBook.moveToPrevChapter(upContent = true, toLast = false) }
@@ -110,8 +110,8 @@ class ReadAloudDialog : BaseBottomSheetDialogFragment(R.layout.dialog_read_aloud
ivPlayPause.setOnClickListener { callBack?.onClickReadAloud() } ivPlayPause.setOnClickListener { callBack?.onClickReadAloud() }
ivPlayPrev.setOnClickListener { ReadAloud.prevParagraph(requireContext()) } ivPlayPrev.setOnClickListener { ReadAloud.prevParagraph(requireContext()) }
ivPlayNext.setOnClickListener { ReadAloud.nextParagraph(requireContext()) } ivPlayNext.setOnClickListener { ReadAloud.nextParagraph(requireContext()) }
llCatalog.setOnClickListener { callBack?.openChapterList() } ivCatalog.setOnClickListener { callBack?.openChapterList() }
llToBackstage.setOnClickListener { callBack?.finish() } ivToBackstage.setOnClickListener { callBack?.finish() }
cbTtsFollowSys.setOnCheckedChangeListener { _, isChecked -> cbTtsFollowSys.setOnCheckedChangeListener { _, isChecked ->
AppConfig.ttsFlowSys = isChecked AppConfig.ttsFlowSys = isChecked
upTtsSpeechRateEnabled(!isChecked) upTtsSpeechRateEnabled(!isChecked)
@@ -134,6 +134,7 @@ class ReadAloudDialog : BaseBottomSheetDialogFragment(R.layout.dialog_read_aloud
val newValue = (seekTtsSpeechRate.value - 1).coerceAtLeast(seekTtsSpeechRate.valueFrom) val newValue = (seekTtsSpeechRate.value - 1).coerceAtLeast(seekTtsSpeechRate.valueFrom)
seekTtsSpeechRate.value = newValue seekTtsSpeechRate.value = newValue
AppConfig.ttsSpeechRate = newValue.toInt() AppConfig.ttsSpeechRate = newValue.toInt()
upTtsSpeechRateText(newValue.toInt())
upTtsSpeechRate() upTtsSpeechRate()
} }
@@ -142,6 +143,7 @@ class ReadAloudDialog : BaseBottomSheetDialogFragment(R.layout.dialog_read_aloud
val newValue = (seekTtsSpeechRate.value + 1).coerceAtMost(seekTtsSpeechRate.valueTo) val newValue = (seekTtsSpeechRate.value + 1).coerceAtMost(seekTtsSpeechRate.valueTo)
seekTtsSpeechRate.value = newValue seekTtsSpeechRate.value = newValue
AppConfig.ttsSpeechRate = newValue.toInt() AppConfig.ttsSpeechRate = newValue.toInt()
upTtsSpeechRateText(newValue.toInt())
upTtsSpeechRate() upTtsSpeechRate()
} }
+31 -43
View File
@@ -254,7 +254,7 @@
<!--目录按钮--> <!--目录按钮-->
<LinearLayout <LinearLayout
android:id="@+id/ll_catalog" android:id="@+id/ll_catalog"
android:layout_width="60dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/selectableItemBackgroundBorderless" android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true" android:clickable="true"
@@ -263,16 +263,13 @@
android:orientation="vertical" android:orientation="vertical"
android:paddingBottom="7dp"> android:paddingBottom="7dp">
<androidx.appcompat.widget.AppCompatImageView <com.google.android.material.button.MaterialButton
android:id="@+id/iv_catalog" android:id="@+id/iv_catalog"
android:layout_width="match_parent" android:layout_width="60dp"
android:layout_height="0dp" android:layout_height="wrap_content"
android:layout_weight="1" style="@style/Widget.Material3Expressive.Button.IconButton.Tonal"
android:adjustViewBounds="true" app:icon="@drawable/ic_toc"
android:contentDescription="@string/chapter_list" app:iconGravity="textStart"/>
android:maxHeight="20dp"
android:src="@drawable/ic_toc"
tools:ignore="NestedWeights" />
<TextView <TextView
android:id="@+id/tv_catalog" android:id="@+id/tv_catalog"
@@ -289,11 +286,11 @@
<View <View
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="2" /> android:layout_weight="1" />
<!--调节按钮--> <!--调节按钮-->
<LinearLayout <LinearLayout
android:id="@+id/ll_main_menu" android:id="@+id/ll_main_menu"
android:layout_width="60dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/selectableItemBackgroundBorderless" android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true" android:clickable="true"
@@ -303,16 +300,13 @@
android:paddingBottom="7dp" android:paddingBottom="7dp"
tools:ignore="TextSizeCheck"> tools:ignore="TextSizeCheck">
<androidx.appcompat.widget.AppCompatImageView <com.google.android.material.button.MaterialButton
android:id="@+id/iv_main_menu" android:id="@+id/iv_main_menu"
android:layout_width="match_parent" android:layout_width="60dp"
android:layout_height="0dp" android:layout_height="wrap_content"
android:layout_weight="1" style="@style/Widget.Material3Expressive.Button.IconButton.Tonal"
android:adjustViewBounds="true" app:icon="@drawable/ic_menu"
android:contentDescription="@string/main_menu" app:iconGravity="textStart"/>
android:maxHeight="20dp"
android:src="@drawable/ic_menu"
tools:ignore="NestedWeights" />
<TextView <TextView
android:id="@+id/tv_main_menu" android:id="@+id/tv_main_menu"
@@ -329,11 +323,11 @@
<View <View
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="2" /> android:layout_weight="1" />
<!--界面按钮--> <!--界面按钮-->
<LinearLayout <LinearLayout
android:id="@+id/ll_to_backstage" android:id="@+id/ll_to_backstage"
android:layout_width="60dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/selectableItemBackgroundBorderless" android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true" android:clickable="true"
@@ -342,16 +336,13 @@
android:orientation="vertical" android:orientation="vertical"
android:paddingBottom="7dp"> android:paddingBottom="7dp">
<androidx.appcompat.widget.AppCompatImageView <com.google.android.material.button.MaterialButton
android:id="@+id/iv_to_backstage" android:id="@+id/iv_to_backstage"
android:layout_width="match_parent" android:layout_width="60dp"
android:layout_height="0dp" android:layout_height="wrap_content"
android:layout_weight="1" style="@style/Widget.Material3Expressive.Button.IconButton.Tonal"
android:adjustViewBounds="true" app:icon="@drawable/ic_visibility_off"
android:contentDescription="@string/to_backstage" app:iconGravity="textStart"/>
android:maxHeight="20dp"
android:src="@drawable/ic_visibility_off"
tools:ignore="NestedWeights" />
<TextView <TextView
android:id="@+id/tv_to_backstage" android:id="@+id/tv_to_backstage"
@@ -368,11 +359,11 @@
<View <View
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="2" /> android:layout_weight="1" />
<!--设置按钮--> <!--设置按钮-->
<LinearLayout <LinearLayout
android:id="@+id/ll_setting" android:id="@+id/ll_setting"
android:layout_width="60dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/selectableItemBackgroundBorderless" android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true" android:clickable="true"
@@ -381,16 +372,13 @@
android:orientation="vertical" android:orientation="vertical"
android:paddingBottom="7dp"> android:paddingBottom="7dp">
<androidx.appcompat.widget.AppCompatImageView <com.google.android.material.button.MaterialButton
android:id="@+id/iv_setting" android:id="@+id/iv_setting"
android:layout_width="match_parent" android:layout_width="60dp"
android:layout_height="0dp" android:layout_height="wrap_content"
android:layout_weight="1" style="@style/Widget.Material3Expressive.Button.IconButton.Tonal"
android:adjustViewBounds="true" app:icon="@drawable/ic_settings"
android:contentDescription="@string/aloud_config" app:iconGravity="textStart"/>
android:maxHeight="20dp"
android:src="@drawable/ic_settings"
tools:ignore="NestedWeights" />
<TextView <TextView
android:id="@+id/tv_setting" android:id="@+id/tv_setting"