From 8f88574fb375b5446953e078489454e0d0ec6e74 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 8 Apr 2020 20:37:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/help/AppConfig.kt | 6 ++++++ .../java/io/legado/app/ui/book/group/GroupManageDialog.kt | 6 ++++++ .../java/io/legado/app/ui/book/group/GroupSelectDialog.kt | 2 ++ app/src/main/res/menu/book_group_manage.xml | 7 +++++++ 4 files changed, 21 insertions(+) diff --git a/app/src/main/java/io/legado/app/help/AppConfig.kt b/app/src/main/java/io/legado/app/help/AppConfig.kt index 2b0b32701..9d2a3f679 100644 --- a/app/src/main/java/io/legado/app/help/AppConfig.kt +++ b/app/src/main/java/io/legado/app/help/AppConfig.kt @@ -115,6 +115,12 @@ object AppConfig { App.INSTANCE.putPrefBoolean("bookGroupAudio", value) } + var bookGroupNoneShow: Boolean + get() = App.INSTANCE.getPrefBoolean("bookGroupNone", false) + set(value) { + App.INSTANCE.putPrefBoolean("bookGroupNone", value) + } + var elevation: Int get() = App.INSTANCE.getPrefInt("elevation", -1) set(value) { diff --git a/app/src/main/java/io/legado/app/ui/book/group/GroupManageDialog.kt b/app/src/main/java/io/legado/app/ui/book/group/GroupManageDialog.kt index 60010f46d..a5d719b57 100644 --- a/app/src/main/java/io/legado/app/ui/book/group/GroupManageDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/group/GroupManageDialog.kt @@ -99,6 +99,8 @@ class GroupManageDialog : DialogFragment(), Toolbar.OnMenuItemClickListener { .isChecked = AppConfig.bookGroupLocalShow it.findItem(R.id.menu_group_audio) .isChecked = AppConfig.bookGroupAudioShow + it.findItem(R.id.menu_group_none) + .isChecked = AppConfig.bookGroupNoneShow } } @@ -120,6 +122,10 @@ class GroupManageDialog : DialogFragment(), Toolbar.OnMenuItemClickListener { AppConfig.bookGroupAudioShow = item.isChecked callBack?.upGroup() } + R.id.menu_group_none -> { + item.isChecked = !item.isChecked + AppConfig.bookGroupNoneShow = item.isChecked + } } return true } diff --git a/app/src/main/java/io/legado/app/ui/book/group/GroupSelectDialog.kt b/app/src/main/java/io/legado/app/ui/book/group/GroupSelectDialog.kt index 29df624e7..7b28c149a 100644 --- a/app/src/main/java/io/legado/app/ui/book/group/GroupSelectDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/group/GroupSelectDialog.kt @@ -94,8 +94,10 @@ class GroupSelectDialog : DialogFragment(), Toolbar.OnMenuItemClickListener { tool_bar.inflateMenu(R.menu.book_group_manage) tool_bar.menu.applyTint(requireContext(), Theme.getTheme()) tool_bar.setOnMenuItemClickListener(this) + tool_bar.menu.findItem(R.id.menu_group_all).isVisible = false tool_bar.menu.findItem(R.id.menu_group_local).isVisible = false tool_bar.menu.findItem(R.id.menu_group_audio).isVisible = false + tool_bar.menu.findItem(R.id.menu_group_none).isVisible = false adapter = GroupAdapter(requireContext()) recycler_view.layoutManager = LinearLayoutManager(requireContext()) recycler_view.addItemDecoration(VerticalDivider(requireContext())) diff --git a/app/src/main/res/menu/book_group_manage.xml b/app/src/main/res/menu/book_group_manage.xml index 94ad26c3d..9d3d9241b 100644 --- a/app/src/main/res/menu/book_group_manage.xml +++ b/app/src/main/res/menu/book_group_manage.xml @@ -31,4 +31,11 @@ android:checked="true" app:showAsAction="never" /> + + \ No newline at end of file