From 0e79e92c84de51e65967e32882dae621cb6bccb8 Mon Sep 17 00:00:00 2001 From: gedoor Date: Tue, 15 Jun 2021 14:11:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8C=89=E9=94=AE=E8=AE=BE=E7=BD=AE=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E9=87=8D=E7=BD=AE=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ui/book/read/config/PageKeyDialog.kt | 21 ++++++--- .../bookshelf/style2/BookshelfFragment2.kt | 8 ++-- app/src/main/res/layout/dialog_page_key.xml | 47 +++++++++++++++---- app/src/main/res/values-ja-rJP/strings.xml | 1 + app/src/main/res/values-pt-rBR/strings.xml | 1 + app/src/main/res/values-zh-rHK/strings.xml | 1 + app/src/main/res/values-zh-rTW/strings.xml | 1 + app/src/main/res/values-zh/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 9 files changed, 61 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/PageKeyDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/PageKeyDialog.kt index 092134e77..1d85a5963 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/PageKeyDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/PageKeyDialog.kt @@ -10,6 +10,7 @@ import io.legado.app.lib.theme.backgroundColor import io.legado.app.utils.getPrefString import io.legado.app.utils.hideSoftInput import io.legado.app.utils.putPrefString +import splitties.views.onClick class PageKeyDialog(context: Context) : Dialog(context, R.style.AppTheme_AlertDialog) { @@ -18,13 +19,19 @@ class PageKeyDialog(context: Context) : Dialog(context, R.style.AppTheme_AlertDi init { setContentView(binding.root) - binding.contentView.setBackgroundColor(context.backgroundColor) - binding.etPrev.setText(context.getPrefString(PreferKey.prevKeys)) - binding.etNext.setText(context.getPrefString(PreferKey.nextKeys)) - binding.tvOk.setOnClickListener { - context.putPrefString(PreferKey.prevKeys, binding.etPrev.text?.toString()) - context.putPrefString(PreferKey.nextKeys, binding.etNext.text?.toString()) - dismiss() + binding.run { + contentView.setBackgroundColor(context.backgroundColor) + etPrev.setText(context.getPrefString(PreferKey.prevKeys)) + etNext.setText(context.getPrefString(PreferKey.nextKeys)) + tvReset.onClick { + etPrev.setText("") + etNext.setText("") + } + tvOk.setOnClickListener { + context.putPrefString(PreferKey.prevKeys, etPrev.text?.toString()) + context.putPrefString(PreferKey.nextKeys, etNext.text?.toString()) + dismiss() + } } } diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/style2/BookshelfFragment2.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/style2/BookshelfFragment2.kt index 6b81eafb7..1676710eb 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/style2/BookshelfFragment2.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/style2/BookshelfFragment2.kt @@ -121,11 +121,9 @@ class BookshelfFragment2 : BaseBookshelfFragment(R.layout.fragment_bookshelf1), bookGroupLiveData?.removeObservers(this) bookGroupLiveData = appDb.bookGroupDao.liveDataShow().apply { observe(viewLifecycleOwner) { - if (it.size != bookGroups.size) { + if (it != bookGroups) { bookGroups = it booksAdapter.notifyDataSetChanged() - } else { - } } } @@ -183,7 +181,8 @@ class BookshelfFragment2 : BaseBookshelfFragment(R.layout.fragment_bookshelf1), override fun onItemClick(position: Int) { if (position < bookGroups.size) { val bookGroup = bookGroups[position] - + groupId = bookGroup.groupId + initBooksData() } else { val book = books[position - bookGroups.size] when (book.type) { @@ -200,6 +199,7 @@ class BookshelfFragment2 : BaseBookshelfFragment(R.layout.fragment_bookshelf1), override fun onItemLongClick(position: Int) { if (position < bookGroups.size) { + val bookGroup = bookGroups[position] } else { val book = books[position - bookGroups.size] diff --git a/app/src/main/res/layout/dialog_page_key.xml b/app/src/main/res/layout/dialog_page_key.xml index 8c5b7a1fa..bca82ea91 100644 --- a/app/src/main/res/layout/dialog_page_key.xml +++ b/app/src/main/res/layout/dialog_page_key.xml @@ -51,17 +51,44 @@ android:textColor="@color/secondaryText" android:text="@string/page_key_set_help" /> - + android:orientation="horizontal"> + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values-ja-rJP/strings.xml b/app/src/main/res/values-ja-rJP/strings.xml index 0b7147b23..5a1faaab2 100644 --- a/app/src/main/res/values-ja-rJP/strings.xml +++ b/app/src/main/res/values-ja-rJP/strings.xml @@ -844,4 +844,5 @@ 样式 分组样式 导出文件名 + 重置 diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index af54188db..b63473b0c 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -844,4 +844,5 @@ Formato Formato de grupo Exportar o nome do arquivo + 重置 diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 6114e1dfc..c9541a334 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -842,5 +842,6 @@ 样式 分组样式 导出文件名 + 重置 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 27608165e..66690b74c 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -843,5 +843,6 @@ 样式 分组样式 导出文件名 + 重置 diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 5d74d9a46..011f56181 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -843,5 +843,6 @@ 样式 分组样式 导出文件名 + 重置 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3070fd2c8..959b1b77c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -844,5 +844,6 @@ Style Group style Export file name + Reset