From 086ccc4c405d0d2c5f49ba4808f6cc0bd96eac63 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 10 May 2020 09:58:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/debug/res/values/strings.xml | 4 +- .../book/source/manage/BookSourceActivity.kt | 5 +++ .../book/source/manage/BookSourceAdapter.kt | 2 + .../book/source/manage/BookSourceViewModel.kt | 10 +++++ .../ui/rss/source/manage/RssSourceActivity.kt | 5 +++ .../ui/rss/source/manage/RssSourceAdapter.kt | 2 + .../rss/source/manage/RssSourceViewModel.kt | 10 +++++ app/src/main/res/menu/book_source_item.xml | 4 ++ app/src/main/res/menu/book_source_sel.xml | 5 +++ app/src/main/res/menu/rss_source_item.xml | 4 ++ app/src/main/res/menu/rss_source_sel.xml | 5 +++ app/src/main/res/values-zh-rHK/strings.xml | 1 + app/src/main/res/values/pref_key_value.xml | 40 +++++++++---------- app/src/main/res/values/strings.xml | 1 + 14 files changed, 76 insertions(+), 22 deletions(-) diff --git a/app/src/debug/res/values/strings.xml b/app/src/debug/res/values/strings.xml index e4464c88d..f465472f0 100644 --- a/app/src/debug/res/values/strings.xml +++ b/app/src/debug/res/values/strings.xml @@ -1,4 +1,4 @@ - 阅读·D - 阅读·D·搜索 + 阅读·D + 阅读·D·搜索 \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt index 088d6855b..a765f3b4f 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt @@ -204,6 +204,7 @@ class BookSourceActivity : VMBaseActivity(R.layout.activity R.id.menu_export_selection -> FilePicker.selectFolder(this, exportRequestCode) R.id.menu_check_source -> CheckSource.start(this, adapter.getSelection()) R.id.menu_top_sel -> viewModel.topSource(*adapter.getSelection().toTypedArray()) + R.id.menu_bottom_sel -> viewModel.bottomSource(*adapter.getSelection().toTypedArray()) } return true } @@ -287,6 +288,10 @@ class BookSourceActivity : VMBaseActivity(R.layout.activity viewModel.topSource(bookSource) } + override fun toBottom(bookSource: BookSource) { + viewModel.bottomSource(bookSource) + } + override fun onFilePicked(requestCode: Int, currentPath: String) { when (requestCode) { exportRequestCode -> viewModel.exportSelection( diff --git a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceAdapter.kt b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceAdapter.kt index eb37cb868..c420284f8 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceAdapter.kt @@ -138,6 +138,7 @@ class BookSourceAdapter(context: Context, val callBack: CallBack) : popupMenu.setOnMenuItemClickListener { menuItem -> when (menuItem.itemId) { R.id.menu_top -> callBack.toTop(source) + R.id.menu_bottom -> callBack.toBottom(source) R.id.menu_del -> callBack.del(source) R.id.menu_enable_explore -> { callBack.update(source.copy(enabledExplore = !source.enabledExplore)) @@ -197,6 +198,7 @@ class BookSourceAdapter(context: Context, val callBack: CallBack) : fun edit(bookSource: BookSource) fun update(vararg bookSource: BookSource) fun toTop(bookSource: BookSource) + fun toBottom(bookSource: BookSource) fun upOrder() fun upCountView() } diff --git a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceViewModel.kt b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceViewModel.kt index e3ea49495..99e3fc387 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceViewModel.kt @@ -29,6 +29,16 @@ class BookSourceViewModel(application: Application) : BaseViewModel(application) } } + fun bottomSource(vararg sources: BookSource) { + execute { + val maxOrder = App.db.bookSourceDao().minOrder + 1 + sources.forEachIndexed { index, bookSource -> + bookSource.customOrder = maxOrder + index + } + App.db.bookSourceDao().update(*sources) + } + } + fun del(bookSource: BookSource) { execute { App.db.bookSourceDao().delete(bookSource) } } diff --git a/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt b/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt index f945dcc15..13f270d6a 100644 --- a/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt +++ b/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt @@ -107,6 +107,7 @@ class RssSourceActivity : VMBaseActivity(R.layout.activity_r R.id.menu_del_selection -> viewModel.delSelection(adapter.getSelection()) R.id.menu_export_selection -> FilePicker.selectFolder(this, exportRequestCode) R.id.menu_top_sel -> viewModel.topSource(*adapter.getSelection().toTypedArray()) + R.id.menu_bottom_sel -> viewModel.bottomSource(*adapter.getSelection().toTypedArray()) } return true } @@ -338,6 +339,10 @@ class RssSourceActivity : VMBaseActivity(R.layout.activity_r viewModel.topSource(source) } + override fun toBottom(source: RssSource) { + viewModel.bottomSource(source) + } + override fun upOrder() { viewModel.upOrder() } diff --git a/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceAdapter.kt b/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceAdapter.kt index 72de1e250..28ee9b48c 100644 --- a/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceAdapter.kt @@ -111,6 +111,7 @@ class RssSourceAdapter(context: Context, val callBack: CallBack) : popupMenu.setOnMenuItemClickListener { menuItem -> when (menuItem.itemId) { R.id.menu_top -> callBack.toTop(source) + R.id.menu_bottom -> callBack.toBottom(source) R.id.menu_del -> callBack.del(source) } true @@ -151,6 +152,7 @@ class RssSourceAdapter(context: Context, val callBack: CallBack) : fun edit(source: RssSource) fun update(vararg source: RssSource) fun toTop(source: RssSource) + fun toBottom(source: RssSource) fun upOrder() fun upCountView() } diff --git a/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceViewModel.kt b/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceViewModel.kt index 723710c7d..a506bad24 100644 --- a/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceViewModel.kt @@ -27,6 +27,16 @@ class RssSourceViewModel(application: Application) : BaseViewModel(application) } } + fun bottomSource(vararg sources: RssSource) { + execute { + val maxOrder = App.db.rssSourceDao().maxOrder + 1 + sources.forEachIndexed { index, rssSource -> + rssSource.customOrder = maxOrder + index + } + App.db.rssSourceDao().update(*sources) + } + } + fun del(rssSource: RssSource) { execute { App.db.rssSourceDao().delete(rssSource) } } diff --git a/app/src/main/res/menu/book_source_item.xml b/app/src/main/res/menu/book_source_item.xml index a3cdcd258..c61d69dab 100644 --- a/app/src/main/res/menu/book_source_item.xml +++ b/app/src/main/res/menu/book_source_item.xml @@ -5,6 +5,10 @@ android:id="@+id/menu_top" android:title="@string/to_top" /> + + diff --git a/app/src/main/res/menu/book_source_sel.xml b/app/src/main/res/menu/book_source_sel.xml index dd245cd43..5ed76592d 100644 --- a/app/src/main/res/menu/book_source_sel.xml +++ b/app/src/main/res/menu/book_source_sel.xml @@ -27,6 +27,11 @@ android:title="@string/to_top" app:showAsAction="never" /> + + + + diff --git a/app/src/main/res/menu/rss_source_sel.xml b/app/src/main/res/menu/rss_source_sel.xml index ffbfacf98..2c0b61e80 100644 --- a/app/src/main/res/menu/rss_source_sel.xml +++ b/app/src/main/res/menu/rss_source_sel.xml @@ -17,6 +17,11 @@ android:title="@string/to_top" app:showAsAction="never" /> + + 隱藏頁眉 隱藏頁脚 自動換源 + 置底 diff --git a/app/src/main/res/values/pref_key_value.xml b/app/src/main/res/values/pref_key_value.xml index f1f70b8c5..017bfe798 100644 --- a/app/src/main/res/values/pref_key_value.xml +++ b/app/src/main/res/values/pref_key_value.xml @@ -1,23 +1,23 @@ - - auto_refresh - list_screen_direction - full_screen - threads_num - user_agent - bookshelf_px - read_type - expandGroupFind - defaultToRead - autoDownload - checkUpdate - 开源阅读 + + auto_refresh + list_screen_direction + full_screen + threads_num + user_agent + bookshelf_px + read_type + expandGroupFind + defaultToRead + autoDownload + checkUpdate + 开源阅读 - https://gitee.com/alanskycn/yuedu/blob/master/Rule/README.md - https://github.com/gedoor/legado - https://github.com/gedoor/legado/graphs/contributors - https://gedoor.github.io/MyBookshelf/disclaimer.html - https://gedoor.github.io/MyBookshelf/ - https://github.com/gedoor/legado/releases/latest - https://api.github.com/repos/gedoor/legado/releases/latest + https://gitee.com/alanskycn/yuedu/blob/master/Rule/README.md + https://github.com/gedoor/legado + https://github.com/gedoor/legado/graphs/contributors + https://gedoor.github.io/MyBookshelf/disclaimer.html + https://gedoor.github.io/MyBookshelf/ + https://github.com/gedoor/legado/releases/latest + https://api.github.com/repos/gedoor/legado/releases/latest diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 83e6bdc84..f01493465 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -308,6 +308,7 @@ 行距 段距 置顶 + 置底 自动展开发现 默认展开第一组发现 当前线程数 %s