From 326bba230324227d15c16197e50bc53388aa115c Mon Sep 17 00:00:00 2001 From: kunfei Date: Fri, 23 Aug 2019 18:01:58 +0800 Subject: [PATCH] up --- .../app/ui/readbook/ReadBookActivity.kt | 22 ++++++------- .../io/legado/app/ui/readbook/ReadMenu.kt | 22 ++++++------- .../main/res/layout/activity_read_book.xml | 2 +- app/src/main/res/layout/view_read_menu.xml | 32 ++++--------------- 4 files changed, 28 insertions(+), 50 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt index 8d88c3baf..8e16368ac 100644 --- a/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt @@ -75,7 +75,7 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_rea tv_chapter_url.onClick { } - fl_menu.setListener(object : ReadMenu.Callback { + read_menu.setListener(object : ReadMenu.Callback { override fun skipToPage(page: Int) { } @@ -102,10 +102,6 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_rea } } - override fun openAdjust() { - - } - override fun showReadStyle() { ReadStyleDialog().show(supportFragmentManager, "readStyle") } @@ -142,12 +138,12 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_rea val isDown = action == 0 if (keyCode == KeyEvent.KEYCODE_MENU) { - if (isDown && !fl_menu.menuBarShow) { - fl_menu.runMenuIn() + if (isDown && !read_menu.menuBarShow) { + read_menu.runMenuIn() return true } - if (!isDown && !fl_menu.menuBarShow) { - fl_menu.menuBarShow = true + if (!isDown && !read_menu.menuBarShow) { + read_menu.menuBarShow = true return true } } @@ -180,9 +176,11 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_rea tv_chapter_url.text = bookChapter.url tv_chapter_url.visible() } - viewModel.curTextChapter = ChapterProvider.getTextChapter(content_text_view, bookChapter, content) - page_view.chapterLoadFinish() - + ChapterProvider.getTextChapter(content_text_view, bookChapter, content).let { + viewModel.curTextChapter = it + page_view.chapterLoadFinish() + read_menu.upReadProgress(it.pageSize(), viewModel.durPageIndex) + } } viewModel.durChapterIndex - 1 -> { viewModel.prevTextChapter = ChapterProvider.getTextChapter(content_text_view, bookChapter, content) diff --git a/app/src/main/java/io/legado/app/ui/readbook/ReadMenu.kt b/app/src/main/java/io/legado/app/ui/readbook/ReadMenu.kt index 2c2835074..90c228841 100644 --- a/app/src/main/java/io/legado/app/ui/readbook/ReadMenu.kt +++ b/app/src/main/java/io/legado/app/ui/readbook/ReadMenu.kt @@ -108,11 +108,16 @@ class ReadMenu : FrameLayout { } } + fun upReadProgress(max: Int, dur: Int) { + seek_read_page.max = max + seek_read_page.progress = dur + } + private fun bindEvent() { ll_floating_button.onClick { runMenuOut() } //阅读进度 - seek_bar_read_page.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener { + seek_read_page.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener { override fun onProgressChanged(seekBar: SeekBar, i: Int, b: Boolean) { } @@ -126,12 +131,6 @@ class ReadMenu : FrameLayout { } }) - //朗读 - fab_read_aloud.onClick { - postEvent(Bus.READ_ALOUD, true) - runMenuOut() - } - //自动翻页 fabAutoPage.onClick { callback?.autoPage() } @@ -157,8 +156,11 @@ class ReadMenu : FrameLayout { } } - //调节 - ll_adjust.onClick { callback?.openAdjust() } + //朗读 + ll_read_aloud.onClick { + postEvent(Bus.READ_ALOUD, true) + runMenuOut() + } //界面 ll_font.onClick { @@ -198,8 +200,6 @@ class ReadMenu : FrameLayout { fun openChapterList() - fun openAdjust() - fun showReadStyle() fun showMoreSetting() diff --git a/app/src/main/res/layout/activity_read_book.xml b/app/src/main/res/layout/activity_read_book.xml index 723bc9a00..6fb639eb6 100644 --- a/app/src/main/res/layout/activity_read_book.xml +++ b/app/src/main/res/layout/activity_read_book.xml @@ -17,7 +17,7 @@ diff --git a/app/src/main/res/layout/view_read_menu.xml b/app/src/main/res/layout/view_read_menu.xml index 06a747850..ba84bece8 100644 --- a/app/src/main/res/layout/view_read_menu.xml +++ b/app/src/main/res/layout/view_read_menu.xml @@ -57,26 +57,6 @@ android:paddingStart="32dp" android:paddingEnd="32dp"> - - - - @@ -264,8 +244,8 @@ android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" - android:contentDescription="@string/adjust" - android:src="@drawable/ic_tune" + android:contentDescription="@string/read_aloud" + android:src="@drawable/ic_read_aloud" app:tint="@color/tv_text_default" tools:ignore="NestedWeights" /> @@ -274,7 +254,7 @@ android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_marginTop="3dp" - android:text="@string/adjust" + android:text="@string/read_aloud" android:textColor="@color/tv_text_default" android:textSize="12sp" />