diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt index 5540d0386..9c118c068 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt @@ -21,7 +21,6 @@ import io.legado.app.utils.observeEvent import io.legado.app.utils.putPrefBoolean import kotlinx.android.synthetic.main.dialog_read_aloud.* import org.jetbrains.anko.sdk27.listeners.onClick -import org.jetbrains.anko.sdk27.listeners.onLongClick class ReadAloudDialog : BaseDialogFragment() { var callBack: CallBack? = null @@ -34,7 +33,7 @@ class ReadAloudDialog : BaseDialogFragment() { it.windowManager?.defaultDisplay?.getMetrics(dm) } dialog?.window?.let { - it.setBackgroundDrawableResource(R.color.transparent) + it.setBackgroundDrawableResource(R.color.background) it.decorView.setPadding(0, 0, 0, 0) val attr = it.attributes attr.dimAmount = 0.0f @@ -54,10 +53,10 @@ class ReadAloudDialog : BaseDialogFragment() { } override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { - ll_bottom_bg.setBackgroundColor(requireContext().bottomBackground) + root_view.setBackgroundColor(requireContext().bottomBackground) initOnChange() initData() - initOnClick() + initEvent() } private fun initData() { @@ -101,22 +100,19 @@ class ReadAloudDialog : BaseDialogFragment() { }) } - private fun initOnClick() { - iv_menu.onClick { callBack?.showMenuBar(); dismiss() } - iv_other_config.onClick { + private fun initEvent() { + ll_main_menu.onClick { callBack?.showMenuBar(); dismiss() } + ll_setting.onClick { ReadAloudConfigDialog().show(childFragmentManager, "readAloudConfigDialog") } + tv_pre.onClick { ReadBook.moveToPrevChapter(upContent = true, toLast = false) } + tv_next.onClick { ReadBook.moveToNextChapter(true) } iv_stop.onClick { ReadAloud.stop(requireContext()); dismiss() } iv_play_pause.onClick { callBack?.onClickReadAloud() } iv_play_prev.onClick { ReadAloud.prevParagraph(requireContext()) } - iv_play_prev.onLongClick { - ReadBook.moveToPrevChapter(upContent = true, toLast = false) - true - } iv_play_next.onClick { ReadAloud.nextParagraph(requireContext()) } - iv_play_next.onLongClick { ReadBook.moveToNextChapter(true); true } - fabToc.onClick { callBack?.openChapterList() } - fabBack.onClick { callBack?.finish() } + ll_catalog.onClick { callBack?.openChapterList() } + ll_to_backstage.onClick { callBack?.finish() } } private fun upPlayState() { diff --git a/app/src/main/res/layout/dialog_read_aloud.xml b/app/src/main/res/layout/dialog_read_aloud.xml index 627bd9414..278117426 100644 --- a/app/src/main/res/layout/dialog_read_aloud.xml +++ b/app/src/main/res/layout/dialog_read_aloud.xml @@ -1,245 +1,333 @@ + android:layout_height="wrap_content" + android:gravity="center" + android:orientation="horizontal"> - + + - - + + + + + + - + + + + + + - + android:layout_weight="1" + android:max="60" /> - + - + - - + android:layout_gravity="center_vertical" + android:orientation="horizontal" + android:padding="8dp"> - - - - - - - - - - - - - + android:layout_height="wrap_content" + android:layout_gravity="center" + android:layout_weight="1" + android:text="@string/read_aloud_speed" + android:textColor="@color/tv_text_default" + android:textSize="14sp" /> + + - + android:layout_marginStart="15dp" + android:layout_marginEnd="15dp" + android:max="45" /> + + + + + + + - - + android:contentDescription="@string/chapter_list" + android:src="@drawable/ic_toc" + app:tint="@color/tv_text_default" + tools:ignore="NestedWeights" /> - + android:layout_gravity="center_horizontal" + android:layout_marginTop="3dp" + android:text="@string/chapter_list" + android:textColor="@color/tv_text_default" + android:textSize="12sp" /> + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="2" /> + + + + + + + + + + android:id="@+id/ll_to_backstage" + android:layout_width="50dp" + android:layout_height="50dp" + android:background="?android:attr/selectableItemBackgroundBorderless" + android:clickable="true" + android:contentDescription="@string/interface_setting" + android:focusable="true" + android:orientation="vertical" + android:paddingBottom="7dp"> - + + - - - - - - - - + + + + + + + + android:layout_height="0dp" + android:layout_weight="1" + android:contentDescription="@string/aloud_config" + android:src="@drawable/ic_settings" + app:tint="@color/tv_text_default" + tools:ignore="NestedWeights" /> + diff --git a/app/src/main/res/layout/view_read_menu.xml b/app/src/main/res/layout/view_read_menu.xml index 135f5b5d9..3754c0914 100644 --- a/app/src/main/res/layout/view_read_menu.xml +++ b/app/src/main/res/layout/view_read_menu.xml @@ -210,7 +210,7 @@ diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9432842a2..e42578401 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -628,7 +628,6 @@ 更多菜单 - 其它朗读设置 系统内置字体样式 删除源文件 预设一 @@ -646,5 +645,6 @@ 导航栏阴影 当前阴影大小(elevation): %s 默认 + 主菜单