From fcc1e8b741b283efbddafd020f823f4a57da920b Mon Sep 17 00:00:00 2001 From: kunfei Date: Thu, 17 Mar 2022 21:01:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8D=A2=E6=BA=90=E6=B7=BB=E5=8A=A0=E5=88=B0?= =?UTF-8?q?=E5=BF=AB=E9=80=9F=E8=B7=B3=E8=BD=AC=E5=88=B0=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../changesource/ChangeBookSourceDialog.kt | 15 ++++- .../changesource/ChangeChapterSourceDialog.kt | 15 ++++- .../res/layout/dialog_book_change_source.xml | 67 +++++++++++++++++-- .../layout/dialog_chapter_change_source.xml | 62 +++++++++++++++-- app/src/main/res/menu/change_source.xml | 5 -- 5 files changed, 143 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeBookSourceDialog.kt b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeBookSourceDialog.kt index c671a7355..45a409b32 100644 --- a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeBookSourceDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeBookSourceDialog.kt @@ -66,6 +66,7 @@ class ChangeBookSourceDialog() : BaseDialogFragment(R.layout.dialog_book_change_ initMenu() initRecyclerView() initSearchView() + initBottomBar() initLiveData() } @@ -127,6 +128,19 @@ class ChangeBookSourceDialog() : BaseDialogFragment(R.layout.dialog_book_change_ }) } + private fun initBottomBar() { + binding.tvDur.text = callBack?.oldBook?.originName + binding.tvDur.setOnClickListener { + scrollToDurSource() + } + binding.ivTop.setOnClickListener { + binding.recyclerView.scrollToPosition(0) + } + binding.ivBottom.setOnClickListener { + binding.recyclerView.scrollToPosition(adapter.itemCount - 1) + } + } + private fun initLiveData() { viewModel.searchStateData.observe(viewLifecycleOwner) { binding.refreshProgressBar.isAutoLoading = it @@ -165,7 +179,6 @@ class ChangeBookSourceDialog() : BaseDialogFragment(R.layout.dialog_book_change_ override fun onMenuItemClick(item: MenuItem?): Boolean { when (item?.itemId) { - R.id.menu_scroll_to_dur -> scrollToDurSource() R.id.menu_check_author -> { AppConfig.changeSourceCheckAuthor = !item.isChecked item.isChecked = !item.isChecked diff --git a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeChapterSourceDialog.kt b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeChapterSourceDialog.kt index d32fb8e9f..f46f3cab0 100644 --- a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeChapterSourceDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeChapterSourceDialog.kt @@ -93,6 +93,7 @@ class ChangeChapterSourceDialog() : BaseDialogFragment(R.layout.dialog_chapter_c initView() initRecyclerView() initSearchView() + initBottomBar() initLiveData() } @@ -161,6 +162,19 @@ class ChangeChapterSourceDialog() : BaseDialogFragment(R.layout.dialog_chapter_c }) } + private fun initBottomBar() { + binding.tvDur.text = callBack?.oldBook?.originName + binding.tvDur.setOnClickListener { + scrollToDurSource() + } + binding.ivTop.setOnClickListener { + binding.recyclerView.scrollToPosition(0) + } + binding.ivBottom.setOnClickListener { + binding.recyclerView.scrollToPosition(searchBookAdapter.itemCount - 1) + } + } + private fun initLiveData() { viewModel.searchStateData.observe(viewLifecycleOwner) { binding.refreshProgressBar.isAutoLoading = it @@ -199,7 +213,6 @@ class ChangeChapterSourceDialog() : BaseDialogFragment(R.layout.dialog_chapter_c override fun onMenuItemClick(item: MenuItem?): Boolean { when (item?.itemId) { - R.id.menu_scroll_to_dur -> scrollToDurSource() R.id.menu_check_author -> { AppConfig.changeSourceCheckAuthor = !item.isChecked item.isChecked = !item.isChecked diff --git a/app/src/main/res/layout/dialog_book_change_source.xml b/app/src/main/res/layout/dialog_book_change_source.xml index b1c1b4592..b4b9ecc16 100644 --- a/app/src/main/res/layout/dialog_book_change_source.xml +++ b/app/src/main/res/layout/dialog_book_change_source.xml @@ -1,10 +1,10 @@ - + xmlns:tools="http://schemas.android.com/tools" + android:background="@color/background"> + android:layout_height="2dp" + app:layout_constraintTop_toBottomOf="@+id/tool_bar" /> - - \ No newline at end of file + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_chapter_change_source.xml b/app/src/main/res/layout/dialog_chapter_change_source.xml index 45f5efe81..97cc032ba 100644 --- a/app/src/main/res/layout/dialog_chapter_change_source.xml +++ b/app/src/main/res/layout/dialog_chapter_change_source.xml @@ -1,10 +1,10 @@ + android:background="@color/background"> - + + + + + + + + + @@ -73,10 +121,10 @@ android:layout_width="48dp" android:layout_height="48dp" android:visibility="gone" - app:layout_constraintTop_toTopOf="@+id/recycler_view_toc" + app:layout_constraintBottom_toBottomOf="@+id/recycler_view_toc" app:layout_constraintLeft_toLeftOf="@+id/recycler_view_toc" app:layout_constraintRight_toRightOf="@+id/recycler_view_toc" - app:layout_constraintBottom_toBottomOf="@+id/recycler_view_toc" /> + app:layout_constraintTop_toTopOf="@+id/recycler_view_toc" /> diff --git a/app/src/main/res/menu/change_source.xml b/app/src/main/res/menu/change_source.xml index 50946c57f..5e42ff079 100644 --- a/app/src/main/res/menu/change_source.xml +++ b/app/src/main/res/menu/change_source.xml @@ -18,11 +18,6 @@ app:showAsAction="always" tools:ignore="AlwaysShowAction" /> - -